Skip to content

block: Fixes for bdrv_drain

Fam Zheng qemu-devel 4 versions – Applied

Status from this message: Thanks, applied to my block tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest9 patches 2 repliesApplied
  2. v39 patches 4 repliesSuperseded
  3. v29 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v19 patches7 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/9block: Add more types for tracked requestblock/io.c include/block/block_int.h+14 -50 replies
2/9block: Track flush requestsblock/io.c+8 -30 replies
3/9block: Track discard requestsblock/io.c+10 -30 replies
4/9iscsi: Emulate commands in iscsi_aio_ioctl as iscsi_ioctlblock/iscsi.c+38 -20 replies
5/9block: Add ioctl parameter fields to BlockRequestinclude/block/block.h+12 -40 replies
6/9block: Emulate bdrv_ioctl with bdrv_aio_ioctl and track bothblock/io.c+92 -90 replies
7/9block: Drop BlockDriver.bdrv_ioctlblock/iscsi.c block/raw-posix.c block/raw_bsd.c +1 more+0 -480 replies
8/9block: Introduce BlockDriver.bdrv_drain callbackblock/io.c include/block/block_int.h+21 -11 reply
9/9qed: Implement .bdrv_drainblock/qed.c+13 -00 replies

Reviews trailers per patch

8 of 9 patches have a Reviewed-by or Acked-by.

PatchKevin WolfPaolo Bonzini
1/9R-b
2/9R-b
3/9R-b
4/9R-b
5/9R-b
6/9
7/9R-b
8/9R-b
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [Qemu-devel] [PATCH v4 0/9] block: Fixes for bdrv_drain

v4: Don't miss children's children. [Paolo]

v3: Don't reuse coroutine in bdrv_aio_ioctl. [Stefan]
Recursely call .bdrv_drain callback only. [Stefan, Paolo] Added Kevin's reviewed-by in other patches.

v2: Add Kevin's reviewed-by in patches 1, 2, 5-7, 9.
Address Kevin's reviewing comments which are:
- Explicit "ret = 0" before out label in patch 3.
- Add missing qemu_aio_unref() in patch 4.
- Recurse into all children in bdrv_drain in patch 8.

Previously bdrv_drain and bdrv_drain_all don't handle ioctl, flush and discard requests (which are fundamentally the same as read and write requests that change disk state). Forgetting such requests leaves us in risk of violating the invariant that bdrv_drain() callers rely on - all asynchronous requests must have completed after bdrv_drain returns.

Enrich the tracked request types, and add tracked_request_begin/end pairs to all three code paths. As a prerequisite, ioctl code is moved into coroutine too.

The last two patches take care of QED's "need check" timer, so that after bdrv_drain returns, the driver is in a consistent state.

Fam

Fam Zheng (9):
block: Add more types for tracked request
block: Track flush requests
block: Track discard requests
iscsi: Emulate commands in iscsi_aio_ioctl as iscsi_ioctl
block: Add ioctl parameter fields to BlockRequest
block: Emulate bdrv_ioctl with bdrv_aio_ioctl and track both
block: Drop BlockDriver.bdrv_ioctl
block: Introduce BlockDriver.bdrv_drain callback
qed: Implement .bdrv_drain

 block/io.c                | 150 +++++++++++++++++++++++++++++++++++++++-------
 block/iscsi.c             |  73 +++++++++++-----------
 block/qed.c               |  13 ++++
 block/raw-posix.c         |   8 ---
 block/raw_bsd.c           |   6 --
 include/block/block.h     |  16 +++--
 include/block/block_int.h |  17 +++++-
 7 files changed, 208 insertions(+), 75 deletions(-)
Signature · 1 line
2.4.3