All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RESEND 00/50] blockdev: BlockBackend and media
@ 2015-01-27 19:45 Max Reitz
  2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 01/50] blockdev: Allow creation of BDS trees without BB Max Reitz
                   ` (49 more replies)
  0 siblings, 50 replies; 107+ messages in thread
From: Max Reitz @ 2015-01-27 19:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Fam Zheng, Jeff Cody, Markus Armbruster, Max Reitz,
	Stefan Hajnoczi, John Snow

** This is a resend due to me messing up John's CC in the first thread.
Sorry for the superfluous mails, but I feel like it's better to bother
you all with the same mails again than to keep bothering innocent
people. **

This series reworks a lot regarding BlockBackend and media. It is
essentially a v3 to the "blockdev: Add blockdev-change-medium with
read-only option" series (which is in fact a part of this series), but
of course does a lot more.

Basically, this series allows empty BlockBackends, that is BBs without a
BDS tree.

Before this series, empty drives are represented by a BlockBackend with
an empty BDS attached to it (a BDS with a NULL driver). However, now we
have BlockBackends, thus an empty drive should be represented by a
BlockBackend without any BDS tree attached to it. This is what this
series does.


I am CC'ing a lot of people (basically everyone who is working on the
block layer) due to the fact that this series touches a lot of places in
the block layer. Please pick out patches that seem to be relevant to
your area of expertise (e.g. there is an FDC tray patch for John; there
are some block job patches for Jeff; etc. pp.). I want to explicitly
encourage you to review only parts of this series! (Of course, reviewing
everything is fine, too :-))

Also, brace for a follow-up regarding bdrv_close_all() (there is a nice
bug in there which I found while working on this series).


This series depends on v3 (or any later version) of my series
'block: Remove "growable", add blk_new_open()'.


- Patches 1 and 2 make it possible to use blockdev-add without creating
  a BlockBackend. This is necessary because the QMP command introduced
  in patch 42 (blockdev-insert-medium) will insert a BDS tree (a medium)
  into a BlockBackend (a drive). Creating a BlockBackend for such a BDS
  tree would both be a hassle and a waste, so this makes it possible to
  omit creating a BB.
  Patches 35 and 36 are kind of a follow-up to these; but patch 35
  depends on patch 34 which is the reason why there is a large gap
  between patch 2 and 35.

- Patch 3 implements a tray status for floppy disk drives. See the
  commit message for more information on what this means.

- Patches 3 to 33 basically all prepare the block layer for having BBs
  without BDS trees. I will only list the most notable ones (patch 3,
  for instance, is not notable).
  They do so by moving some information into the BlockBackend, and
  primarily by intercepting accesses to empty BBs in the BB layer and
  resorting to default actions there.
  Furthermore, hopefully all non-BB calls to bdrv_*() functions are
  guarded by checking whether that BDS actually exists.

- Patch 6 makes blk_is_inserted() return true only if there is a BDS
  tree; furthermore, blk_is_available() is added which additionally
  checks whether the guest device tray is closed.

- Patches 7 and 8 are some kind of follow-up to patch 6; they make
  bdrv_is_inserted() actually useful (unless I'm not mistaken; maybe I
  am and they make bdrv_is_inserted() actually useless).

- Patches 9, 11 and 12 move some (root!) BDS fields into the BB, because
  that is where they belong. This way they survive a medium (BDS tree)
  change.

- Patch 10 is necessary because the structure moved in patch 11
  (BlockAcctStats) contains one field which does belong into the BDS
  (wr_highest_offset). Thus, this field is moved out of that structure
  into the BDS here.

- Patch 13 adds a structure to the BB which can save some options from
  the root BDS so they survive a medium change. In theory, those options
  should probably not survive a medium change (they are not really
  drive- but medium-related), but this is how the 'change' command
  always handled it so this structure (the BlockBackendRootState, BBRS)
  is required for compatibility.
  One of these options is the read-only status, for example.

- Patches 17 to 30 and patches 32 and 33 prepare functions in the block
  layer which directly access a BDS to cope with a non-existing BDS
  tree. Patch 31 is a prerequisite for patch 32.

- Patch 34 "gets down to business": Empty drives no longer have a BDS
  tree.

- Patches 35 and 36 are, as described above, a follow-up to patch 1.

- Patch 37 is the counterpart to patch 31, obviously.

- Patches 38 to 41 implement the basic QMP operations for tray and
  medium operation: blockdev-open-tray, blockdev-close-tray,
  blockdev-remove-medium and blockdev-insert-medium.

- Patches 42 and 43 reimplement 'eject' and 'change' using these new
  medium operations.

- With me now knowing exactly what 'change' does (because I
  reimplemented it), patch 44 became possible.

- Patches 45 to 48 are from v2 of series (slightly modified)
  "blockdev: Add blockdev-change-medium with read-only option"
  One modification are notes in patch 45 that blockdev-change-medium is
  preferred over simply 'change' [Eric] and what atomic operations
  blockdev-change-medium itself performs.

- Patch 50 adds a test for 'change' and all associated QMP commands,
  patch 49 makes small amendments to VM.add_drive() in iotests.py to
  make the new test work.


git-backport-diff output against v2 of
"blockdev: Add blockdev-change-medium with read-only option":

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

045/50:[0007] [FC] 'qmp: Introduce blockdev-change-medium'
046/50:[----] [--] 'hmp: Use blockdev-change-medium for change command'
047/50:[0005] [FC] 'blockdev: Add read-only option to blockdev-change-medium'
048/50:[----] [--] 'hmp: Add read-only option to change command'

(rest is "downstream-only")


Max Reitz (50):
  blockdev: Allow creation of BDS trees without BB
  iotests: Only create BB if necessary
  hw/block/fdc: Implement tray status
  hw/usb-storage: Check whether BB is inserted
  block: Fix BB AIOCB AioContext without BDS
  block: Add blk_is_available()
  block: Make bdrv_is_inserted() recursive
  block/quorum: Implement bdrv_is_inserted()
  block: Move guest_block_size into BlockBackend
  block: Remove wr_highest_offset from BlockAcctStats
  block: Move BlockAcctStats into BlockBackend
  block: Move I/O status and error actions into BB
  block: Add BlockBackendRootState
  block: Make some BB functions fall back to BBRS
  block: Fail requests to empty BlockBackend
  block: Prepare remaining BB functions for NULL BDS
  block: Respect empty BB in bdrv_lookup_bs()
  block: Respect empty BB in bdrv_query_info()
  blockdev: Use BlockBackend for blockdev-backup TA
  blockdev: Check blk_is_available() in sn-del-int-sync
  blockdev: Check BB validity in internal snapshot TA
  blockdev: Check BB validity in drive-backup TA
  blockdev: Catch NULL BDS in block_set_io_throttle
  blockdev: Check BB validity in block-stream
  blockdev: Check BB validity in block-commit
  blockdev: Check BB validity in drive-backup
  blockdev: Check BB validity in blockdev-backup
  blockdev: Check BB validity in drive-mirror
  blockdev: Check BB validity in find_block_job()
  blockdev: Check BB validity in change-backing-file
  block: Add blk_insert_bs()
  blockdev: Check BB validity in eject and change
  blockdev: Respect NULL BDS in do_drive_del()
  blockdev: Do not create BDS for empty drive
  blockdev: Pull out blockdev option extraction
  blockdev: Allow more options for BB-less BDS tree
  block: Add blk_remove_bs()
  blockdev: Add blockdev-open-tray
  blockdev: Add blockdev-close-tray
  blockdev: Add blockdev-remove-medium
  blockdev: Add blockdev-insert-medium
  blockdev: Implement eject with basic operations
  blockdev: Implement change with basic operations
  block: Inquire tray state before tray-moved events
  qmp: Introduce blockdev-change-medium
  hmp: Use blockdev-change-medium for change command
  blockdev: Add read-only option to blockdev-change-medium
  hmp: Add read-only option to change command
  iotests: More options for VM.add_drive()
  iotests: Add test for change-related QMP commands

 block.c                        | 161 +-------
 block/accounting.c             |   9 -
 block/backup.c                 |  17 +-
 block/block-backend.c          | 356 ++++++++++++++--
 block/commit.c                 |   3 +-
 block/mirror.c                 |  17 +-
 block/qapi.c                   |  32 +-
 block/quorum.c                 |  16 +
 block/stream.c                 |   3 +-
 blockdev.c                     | 915 +++++++++++++++++++++++++++++------------
 blockjob.c                     |   5 +-
 hmp-commands.hx                |  20 +-
 hmp.c                          |  46 ++-
 hw/block/fdc.c                 |  20 +-
 hw/usb/dev-storage.c           |   2 +-
 include/block/accounting.h     |   3 -
 include/block/block.h          |  14 -
 include/block/block_int.h      |  22 +-
 include/qemu/typedefs.h        |   1 +
 include/sysemu/block-backend.h |  12 +
 include/sysemu/blockdev.h      |   2 -
 qapi-schema.json               |   3 +-
 qapi/block-core.json           | 110 +++++
 qmp-commands.hx                | 204 +++++++++
 qmp.c                          |   9 +-
 tests/fdc-test.c               |   4 +-
 tests/qemu-iotests/067.out     | 104 +----
 tests/qemu-iotests/071         |  50 ++-
 tests/qemu-iotests/071.out     |  16 +-
 tests/qemu-iotests/081         |  14 +-
 tests/qemu-iotests/081.out     |   7 +-
 tests/qemu-iotests/087         |  20 -
 tests/qemu-iotests/087.out     |  22 -
 tests/qemu-iotests/118         | 649 +++++++++++++++++++++++++++++
 tests/qemu-iotests/118.out     |   5 +
 tests/qemu-iotests/group       |   1 +
 tests/qemu-iotests/iotests.py  |   9 +-
 37 files changed, 2198 insertions(+), 705 deletions(-)
 create mode 100755 tests/qemu-iotests/118
 create mode 100644 tests/qemu-iotests/118.out

-- 
2.1.0

^ permalink raw reply	[flat|nested] 107+ messages in thread

end of thread, other threads:[~2015-01-30 21:05 UTC | newest]

Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 19:45 [Qemu-devel] [PATCH RESEND 00/50] blockdev: BlockBackend and media Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 01/50] blockdev: Allow creation of BDS trees without BB Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 02/50] iotests: Only create BB if necessary Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 03/50] hw/block/fdc: Implement tray status Max Reitz
2015-01-30 21:04   ` John Snow
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 04/50] hw/usb-storage: Check whether BB is inserted Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 05/50] block: Fix BB AIOCB AioContext without BDS Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 06/50] block: Add blk_is_available() Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 07/50] block: Make bdrv_is_inserted() recursive Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 08/50] block/quorum: Implement bdrv_is_inserted() Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 09/50] block: Move guest_block_size into BlockBackend Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 10/50] block: Remove wr_highest_offset from BlockAcctStats Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 11/50] block: Move BlockAcctStats into BlockBackend Max Reitz
2015-01-27 20:31   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 12/50] block: Move I/O status and error actions into BB Max Reitz
2015-01-27 20:51   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 13/50] block: Add BlockBackendRootState Max Reitz
2015-01-27 21:03   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 14/50] block: Make some BB functions fall back to BBRS Max Reitz
2015-01-27 21:15   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 15/50] block: Fail requests to empty BlockBackend Max Reitz
2015-01-27 21:24   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 16/50] block: Prepare remaining BB functions for NULL BDS Max Reitz
2015-01-27 21:36   ` Eric Blake
2015-01-27 21:39     ` Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 17/50] block: Respect empty BB in bdrv_lookup_bs() Max Reitz
2015-01-27 21:56   ` Eric Blake
2015-01-28 18:31   ` John Snow
2015-01-28 18:35     ` Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 18/50] block: Respect empty BB in bdrv_query_info() Max Reitz
2015-01-27 21:57   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 19/50] blockdev: Use BlockBackend for blockdev-backup TA Max Reitz
2015-01-27 21:59   ` Eric Blake
2015-01-27 22:13     ` Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 20/50] blockdev: Check blk_is_available() in sn-del-int-sync Max Reitz
2015-01-27 22:10   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 21/50] blockdev: Check BB validity in internal snapshot TA Max Reitz
2015-01-27 23:02   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 22/50] blockdev: Check BB validity in drive-backup TA Max Reitz
2015-01-27 23:44   ` Eric Blake
2015-01-28 16:27     ` Max Reitz
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 23/50] blockdev: Catch NULL BDS in block_set_io_throttle Max Reitz
2015-01-28 15:26   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 24/50] blockdev: Check BB validity in block-stream Max Reitz
2015-01-28 15:28   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 25/50] blockdev: Check BB validity in block-commit Max Reitz
2015-01-28 16:09   ` Eric Blake
2015-01-27 19:45 ` [Qemu-devel] [PATCH RESEND 26/50] blockdev: Check BB validity in drive-backup Max Reitz
2015-01-28 16:20   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 27/50] blockdev: Check BB validity in blockdev-backup Max Reitz
2015-01-28 16:42   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 28/50] blockdev: Check BB validity in drive-mirror Max Reitz
2015-01-28 16:43   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 29/50] blockdev: Check BB validity in find_block_job() Max Reitz
2015-01-28 16:44   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 30/50] blockdev: Check BB validity in change-backing-file Max Reitz
2015-01-28 16:50   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 31/50] block: Add blk_insert_bs() Max Reitz
2015-01-28 16:52   ` Eric Blake
2015-01-28 16:58     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 32/50] blockdev: Check BB validity in eject and change Max Reitz
2015-01-28 17:42   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 33/50] blockdev: Respect NULL BDS in do_drive_del() Max Reitz
2015-01-28 17:45   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 34/50] blockdev: Do not create BDS for empty drive Max Reitz
2015-01-28 17:50   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 35/50] blockdev: Pull out blockdev option extraction Max Reitz
2015-01-28 19:23   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 36/50] blockdev: Allow more options for BB-less BDS tree Max Reitz
2015-01-28 19:26   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 37/50] block: Add blk_remove_bs() Max Reitz
2015-01-28 19:49   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 38/50] blockdev: Add blockdev-open-tray Max Reitz
2015-01-28 19:56   ` Eric Blake
2015-01-28 19:59     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 39/50] blockdev: Add blockdev-close-tray Max Reitz
2015-01-28 19:58   ` Eric Blake
2015-01-28 20:00     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 40/50] blockdev: Add blockdev-remove-medium Max Reitz
2015-01-28 20:11   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 41/50] blockdev: Add blockdev-insert-medium Max Reitz
2015-01-28 20:18   ` Eric Blake
2015-01-28 20:20     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 42/50] blockdev: Implement eject with basic operations Max Reitz
2015-01-28 20:26   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 43/50] blockdev: Implement change " Max Reitz
2015-01-28 20:30   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 44/50] block: Inquire tray state before tray-moved events Max Reitz
2015-01-28 20:37   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 45/50] qmp: Introduce blockdev-change-medium Max Reitz
2015-01-28 21:01   ` Eric Blake
2015-01-28 21:19     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 46/50] hmp: Use blockdev-change-medium for change command Max Reitz
2015-01-28 21:02   ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 47/50] blockdev: Add read-only option to blockdev-change-medium Max Reitz
2015-01-28 21:08   ` Eric Blake
2015-01-28 21:22     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 48/50] hmp: Add read-only option to change command Max Reitz
2015-01-28 21:22   ` Eric Blake
2015-01-28 21:26     ` Max Reitz
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 49/50] iotests: More options for VM.add_drive() Max Reitz
2015-01-28 21:27   ` Eric Blake
2015-01-28 21:28     ` Max Reitz
2015-01-28 21:58       ` Eric Blake
2015-01-27 19:46 ` [Qemu-devel] [PATCH RESEND 50/50] iotests: Add test for change-related QMP commands Max Reitz
2015-01-28 21:57   ` Eric Blake
2015-01-28 22:02     ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.