[PATCH v4 0/2] iov_iter: allow iov_iter_get_pages_alloc to allocate more pages per call

From: Jeff Layton
Date: Fri Jan 27 2017 - 08:33:37 EST


v1: Initial iteration (too many iov_iter details exposed to callers)
v2: just change iov_iter_get_pages_alloc to add more pages to the array
if the previous vector and the current one are page aligned
v3: Move maxsize handling into iov_iter_pvec_size. Add patch to make
ceph use iov_iter_get_pages_alloc instead of doing its own thing.
v4: Fix length handling when neither start nor end of iovec is page
aligned. Rework error handling when there is a change to iovec
after calculating the array length. Eliminate a BUG_ON.

Currently iov_iter_get_pages_alloc doesn't actually iterate past the
first element in the vector array. If you have a long array of small
iovecs that are well aligned and you want to stitch them together into a
single I/O, you have to try to do it yourself with multiple calls to
iov_iter_get_pages.

Ceph attempts to do this, but it doesn't handle ITER_BVEC correctly,
which is necessary to handle splice writes into a file open with
O_DIRECT. That usually leads to a softlockup with the current code.

While I can't locate the report at the moment, ISTR that we've also had
people complain in the past that the NFS client doesn't handle small
iovecs well with O_DIRECT. Each iovec gets its own RPC, even when they
are page-aligned. The first patch in the series fixes that as well.

This may also silimarly help lustre and 9p in that situation as well,
but I don't have a great way to test that so I can't verify it.

Jeff Layton (2):
iov_iter: allow iov_iter_get_pages_alloc to allocate more pages per
call
ceph: switch DIO code to use iov_iter_get_pages_alloc

fs/ceph/file.c | 75 +-----------------------
lib/iov_iter.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 154 insertions(+), 101 deletions(-)

--
2.9.3