Skip to content

Implement bdrv_{pread, pwrite, pwrite_sync, pwrite_zeroes}() using generated_co_wrapper

Alberto Faria qemu-devel 5 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v410 patches 0 repliesNew
  2. v5 Latest10 patches 16 repliesApplied
  3. v310 patches 25 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches7 repliesSuperseded
v17 patches9 repliesSuperseded

Changes in v5 from the cover letter

- Picking up a few R-b from v3 that I forgot. Sorry for the noise.

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/10block: Add a 'flags' param to bdrv_{pread, pwrite, pwrite_sync}()block/blklogwrites.c block/bochs.c block/cloop.c +21 more+219 -2191 reply
2/10block: Change bdrv_{pread, pwrite, pwrite_sync}() param orderblock/blklogwrites.c block/bochs.c block/cloop.c +21 more+242 -2391 reply
3/10block: Make bdrv_{pread, pwrite}() return 0 on successblock/cloop.c block/crypto.c block/dmg.c +7 more+19 -311 reply
4/10crypto: Make block callbacks return 0 on successblock/crypto.c block/qcow2.c crypto/block-luks.c +3 more+79 -791 reply
5/10block: Make bdrv_co_pwrite() take a const bufferinclude/block/block_int-io.h+1 -11 reply
6/10block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_tblock/coroutines.h include/block/block_int-io.h+4 -42 replies
7/10block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapperblock/io.c include/block/block-io.h+9 -473 replies
8/10block: Add bdrv_co_pwrite_sync()block/io.c include/block/block-io.h+11 -61 reply
9/10block: Use bdrv_co_pwrite_sync() when caller is coroutine_fnblock/parallels.c block/qcow2-snapshot.c block/qcow2.c+6 -61 reply
10/10block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty()block/qcow2.c+3 -61 reply

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchPaolo BonziniStefan HajnocziVladimir Sementsov-OgievskiyEric BlakeHanna Reitz
1/10R-b R-b R-b R-b
2/10R-b R-b R-b R-b
3/10R-b R-b R-b
4/10R-b R-b R-b
5/10R-b R-b R-b
6/10R-b R-b
7/10R-b R-b
8/10R-b R-b R-b
9/10R-b R-b R-b
10/10R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/10] Implement bdrv_{pread, pwrite, pwrite_sync, pwrite_zeroes}() using generated_co_wrapper

Start by making the interfaces of analogous non-coroutine and coroutine functions consistent with each other, then implement the non-coroutine ones using generated_co_wrapper.

For the bdrv_pwrite_sync() case, also add the missing bdrv_co_pwrite_sync() function.

Changes v4 --> v5:
- Picking up a few R-b from v3 that I forgot. Sorry for the noise.

Changes v3 --> v4:
- Removed assert(bytes <= SIZE_MAX) from bdrv_co_{pread,pwrite}() (undoing v3) since bdrv_check_request32(), which is called further down the stack, will cause -EIO to be returned if bytes > SIZE_MAX.
- Audited callers to make sure bdrv_{pread,pwrite}() now returning -EIO instead of -EINVAL when 'bytes' is negative doesn't break things. Still, would appreciate it if someone more accustomed to the code base were able to double-check this.

Changes v2 --> v3:
- Add assert(bytes <= SIZE_MAX) to bdrv_co_{pread,pwrite}().

Changes v1 --> v2:
- Drop unnecessary assignments to ret in vhdx_log_peek_hdr(), vhdx_log_read_sectors(), and vhdx_log_write_sectors().
- Simplify vdi_co_pwritev() return expression.
- Add patch making crypto block callbacks return 0 on success.
- Clarify in commit message that bdrv_pwrite_zeroes() now calls trace_bdrv_co_pwrite_zeroes() and clears the BDRV_REQ_MAY_UNMAP flag when appropriate, which it didn't previously.
- Use _co_ functions in the implementation of bdrv_co_pwrite_sync().
- Add patch converting uses of bdrv_pwrite_sync() into bdrv_co_pwrite_sync() when the callers are already coroutine_fn.
- Add patch making qcow2_mark_dirty() use bdrv_pwrite_sync() instead of calling bdrv_pwrite() and bdrv_flush() separately.

Alberto Faria (10):
block: Add a 'flags' param to bdrv_{pread,pwrite,pwrite_sync}()
block: Change bdrv_{pread,pwrite,pwrite_sync}() param order
block: Make bdrv_{pread,pwrite}() return 0 on success
crypto: Make block callbacks return 0 on success
block: Make bdrv_co_pwrite() take a const buffer
block: Make 'bytes' param of bdrv_co_{pread,pwrite,preadv,pwritev}()

    an int64_t

block: Implement bdrv_{pread,pwrite,pwrite_zeroes}() using
generated_co_wrapper
block: Add bdrv_co_pwrite_sync()
block: Use bdrv_co_pwrite_sync() when caller is coroutine_fn block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty()

 block/blklogwrites.c             |  6 +--
 block/bochs.c                    | 10 ++--
 block/cloop.c                    | 12 ++---
 block/coroutines.h               |  4 +-
 block/crypto.c                   | 56 +++++++++++-----------
 block/dmg.c                      | 36 +++++++-------
 block/io.c                       | 55 ++--------------------
 block/parallels-ext.c            |  6 +--
 block/parallels.c                | 12 ++---
 block/qcow.c                     | 41 ++++++++--------
 block/qcow2-bitmap.c             | 14 +++---
 block/qcow2-cache.c              |  9 ++--
 block/qcow2-cluster.c            | 19 ++++----
 block/qcow2-refcount.c           | 58 ++++++++++++-----------
 block/qcow2-snapshot.c           | 53 ++++++++++-----------
 block/qcow2.c                    | 80 ++++++++++++++++----------------
 block/qed.c                      | 13 ++----
 block/vdi.c                      | 16 +++----
 block/vhdx-log.c                 | 23 +++++----
 block/vhdx.c                     | 36 +++++++-------
 block/vmdk.c                     | 70 +++++++++++++---------------
 block/vpc.c                      | 23 ++++-----
 block/vvfat.c                    | 11 +++--
 crypto/block-luks.c              |  8 ++--
 crypto/block.c                   |  6 +--
 include/block/block-io.h         | 22 ++++++---
 include/block/block_int-io.h     |  4 +-
 include/crypto/block.h           | 32 ++++++-------
 tests/unit/test-block-iothread.c | 12 ++---
 tests/unit/test-crypto-block.c   | 38 +++++++--------
 30 files changed, 370 insertions(+), 415 deletions(-)
Signature · 1 line
2.35.3