Skip to content

block: Split padded I/O vectors exceeding IOV_MAX

Hanna Czenczek qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 16 repliesSuperseded

Changes in v2 from the cover letter

- Patch 1: Made a note in the commit message of having renamed

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4util/iov: Make qiov_slice() publicinclude/qemu/iov.h util/iov.c+10 -70 replies
2/4block: Collapse padded I/O vecs exceeding IOV_MAXblock/io.c+151 -151 reply
3/4util/iov: Remove qemu_iovec_init_extended()include/qemu/iov.h util/iov.c+11 -730 replies
4/4iotests/iov-padding: New testtests/qemu-iotests/tests/iov-padding tests/qemu-iotests/tests/iov-padding.out+144 -00 replies

Reviews trailers per patch

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

PatchEric BlakeVladimir Sementsov-Ogievskiy
1/4R-b R-b
2/4R-b
3/4R-b R-b
4/4R-b R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/4] block: Split padded I/O vectors exceeding IOV_MAX

RFC:
https://lists.nongnu.org/archive/html/qemu-block/2023-03/msg00446.html

v1:
https://lists.nongnu.org/archive/html/qemu-devel/2023-03/msg05049.html

As explained in the RFC’s cover letter, the problem this series addresses is that we pad requests from the guest that are unaligned to the underlying storage’s alignment requirements so they fit. This involves giving them head and/or tail padding.

We generally work with I/O vectors, so this padding is added via prepending/appending vector elements. We have a maximum limit on the number of elements, though (1024, specifically), so it is possible that padding has the vector exceed this limit, resulting in an unrecoverable I/O error that is returned to the guest -- on a perfectly valid request, as far as the guest is concerned.

To fix this, when the limit would be exceeded, this series temporarily merges some (up to three) I/O vector element into one to decrease the number of vector elements as far as necessary.

v2:
- Patch 1: Made a note in the commit message of having renamed

           qiov_slice() -> qemu_iovec_slice()

- Patch 2:
- Renamed bdrv_padding_destroy() to bdrv_padding_finalize(), indicating that the padding is not just simply destroyed, but more steps may be taken (i.e. copying back the contents of the temporary buffer used for the merged elements)

- Generally replaced “couple of” by “two or three”

Hanna Czenczek (4):
util/iov: Make qiov_slice() public
block: Collapse padded I/O vecs exceeding IOV_MAX util/iov: Remove qemu_iovec_init_extended() iotests/iov-padding: New test

 include/qemu/iov.h                       |   8 +-
 block/io.c                               | 166 +++++++++++++++++++++--
 util/iov.c                               |  89 +++---------
 tests/qemu-iotests/tests/iov-padding     |  85 ++++++++++++
 tests/qemu-iotests/tests/iov-padding.out |  59 ++++++++
 5 files changed, 314 insertions(+), 93 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/iov-padding
 create mode 100644 tests/qemu-iotests/tests/iov-padding.out
Signature · 1 line
2.39.1