mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 16:14:13 +08:00
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:
parent
59bb69c67c
commit
18fa9af726
@ -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)
|
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;
|
if (!i->count)
|
||||||
bi.bi_bvec_done = i->iov_offset;
|
return;
|
||||||
bi.bi_idx = 0;
|
i->count -= size;
|
||||||
bvec_iter_advance(i->bvec, &bi, size);
|
|
||||||
|
|
||||||
i->bvec += bi.bi_idx;
|
size += i->iov_offset;
|
||||||
i->nr_segs -= bi.bi_idx;
|
|
||||||
i->count = bi.bi_size;
|
for (bvec = i->bvec, end = bvec + i->nr_segs; bvec < end; bvec++) {
|
||||||
i->iov_offset = bi.bi_bvec_done;
|
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)
|
static void iov_iter_iovec_advance(struct iov_iter *i, size_t size)
|
||||||
|
Loading…
Reference in New Issue
Block a user