iov_iter_bvec_advance(): don't bother with bvec_iter

do what we do for iovec/kvec; that ends up generating better code,
AFAICS.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2022-06-06 23:44:33 -04:00
parent 59bb69c67c
commit 18fa9af726

View File

@ -846,17 +846,22 @@ static void pipe_advance(struct iov_iter *i, size_t size)
static void iov_iter_bvec_advance(struct iov_iter *i, size_t size)
{
struct bvec_iter bi;
const struct bio_vec *bvec, *end;
bi.bi_size = i->count;
bi.bi_bvec_done = i->iov_offset;
bi.bi_idx = 0;
bvec_iter_advance(i->bvec, &bi, size);
if (!i->count)
return;
i->count -= size;
i->bvec += bi.bi_idx;
i->nr_segs -= bi.bi_idx;
i->count = bi.bi_size;
i->iov_offset = bi.bi_bvec_done;
size += i->iov_offset;
for (bvec = i->bvec, end = bvec + i->nr_segs; bvec < end; bvec++) {
if (likely(size < bvec->bv_len))
break;
size -= bvec->bv_len;
}
i->iov_offset = size;
i->nr_segs -= bvec - i->bvec;
i->bvec = bvec;
}
static void iov_iter_iovec_advance(struct iov_iter *i, size_t size)