[PATCH 12/26] iov_iter: Add a segmented queue of bio_vec[]
Paulo Alcantara
pc at manguebit.com
Sat Mar 28 11:39:55 PDT 2026
David Howells <dhowells at redhat.com> writes:
> Add the concept of a segmented queue of bio_vec[] arrays. This allows an
> indefinite quantity of elements to be handled and allows things like
> network filesystems and crypto drivers to glue bits on the ends without
> having to reallocate the array.
>
> The bvecq struct that defines each segment also carries capacity/usage
> information along with flags indicating whether the constituent memory
> regions need freeing or unpinning and the file position of the first
> element in a segment. The bvecq structs are refcounted to allow a queue to
> be extracted in batches and split between a number of subrequests.
>
> The bvecq can have the bio_vec[] it manages allocated in with it, but this
> is not required. A flag is provided for if this is the case as comparing
> ->bv to ->__bv is not sufficient to detect this case.
>
> Add an iterator type ITER_BVECQ for it. This is intended to replace
> ITER_FOLIOQ (and ITER_XARRAY).
>
> Note that the prev pointer is only really needed for iov_iter_revert() and
> could be dispensed with if struct iov_iter contained the head information
> as well as the current point.
>
> Signed-off-by: David Howells <dhowells at redhat.com>
> cc: Paulo Alcantara <pc at manguebit.org>
> cc: Matthew Wilcox <willy at infradead.org>
> cc: Christoph Hellwig <hch at infradead.org>
> cc: Jens Axboe <axboe at kernel.dk>
> cc: linux-block at vger.kernel.org
> cc: netfs at lists.linux.dev
> cc: linux-fsdevel at vger.kernel.org
> ---
> include/linux/bvecq.h | 46 ++++++
> include/linux/iov_iter.h | 63 +++++++-
> include/linux/uio.h | 11 ++
> lib/iov_iter.c | 288 ++++++++++++++++++++++++++++++++++++-
> lib/scatterlist.c | 66 +++++++++
> lib/tests/kunit_iov_iter.c | 180 +++++++++++++++++++++++
> 6 files changed, 649 insertions(+), 5 deletions(-)
> create mode 100644 include/linux/bvecq.h
Reviewed-by: Paulo Alcantara (Red Hat) <pc at manguebit.org>
More information about the linux-afs
mailing list