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

Hanna Czenczek posted 4 patches 1 year ago
Failed in applying to current master (apply log)
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
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
[PATCH v2 0/4] block: Split padded I/O vectors exceeding IOV_MAX
Posted by Hanna Czenczek 1 year ago
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

-- 
2.39.1