Skip to content

Commit 81055e5

Browse files
author
Al Viro
committed
optimize copy_page_{to,from}_iter()
if we'd ended up in the end of a segment, jump to the beginning of the next one (iov_offset = 0, iov++), rather than having the next primitive deal with that. Ought to be folded back... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 6abd232 commit 81055e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mm/iov_iter.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
7474
}
7575
kunmap(page);
7676
done:
77+
if (skip == iov->iov_len) {
78+
iov++;
79+
skip = 0;
80+
}
7781
i->count -= wanted - bytes;
7882
i->nr_segs -= iov - i->iov;
7983
i->iov = iov;
@@ -152,6 +156,10 @@ size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
152156
}
153157
kunmap(page);
154158
done:
159+
if (skip == iov->iov_len) {
160+
iov++;
161+
skip = 0;
162+
}
155163
i->count -= wanted - bytes;
156164
i->nr_segs -= iov - i->iov;
157165
i->iov = iov;

0 commit comments

Comments
 (0)