copy_page_to_iter(): don't split high-order page in case of ITER_PIPE
... just shove it into one pipe_buffer. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
310d9d5a50
commit
f0f6b614f8
1 changed files with 6 additions and 15 deletions
|
@ -706,30 +706,21 @@ static inline bool page_copy_sane(struct page *page, size_t offset, size_t n)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t __copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
|
|
||||||
struct iov_iter *i)
|
|
||||||
{
|
|
||||||
if (unlikely(iov_iter_is_pipe(i))) {
|
|
||||||
return copy_page_to_iter_pipe(page, offset, bytes, i);
|
|
||||||
} else {
|
|
||||||
void *kaddr = kmap_local_page(page);
|
|
||||||
size_t wanted = _copy_to_iter(kaddr + offset, bytes, i);
|
|
||||||
kunmap_local(kaddr);
|
|
||||||
return wanted;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
|
size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
|
||||||
struct iov_iter *i)
|
struct iov_iter *i)
|
||||||
{
|
{
|
||||||
size_t res = 0;
|
size_t res = 0;
|
||||||
if (unlikely(!page_copy_sane(page, offset, bytes)))
|
if (unlikely(!page_copy_sane(page, offset, bytes)))
|
||||||
return 0;
|
return 0;
|
||||||
|
if (unlikely(iov_iter_is_pipe(i)))
|
||||||
|
return copy_page_to_iter_pipe(page, offset, bytes, i);
|
||||||
page += offset / PAGE_SIZE; // first subpage
|
page += offset / PAGE_SIZE; // first subpage
|
||||||
offset %= PAGE_SIZE;
|
offset %= PAGE_SIZE;
|
||||||
while (1) {
|
while (1) {
|
||||||
size_t n = __copy_page_to_iter(page, offset,
|
void *kaddr = kmap_local_page(page);
|
||||||
min(bytes, (size_t)PAGE_SIZE - offset), i);
|
size_t n = min(bytes, (size_t)PAGE_SIZE - offset);
|
||||||
|
n = _copy_to_iter(kaddr + offset, n, i);
|
||||||
|
kunmap_local(kaddr);
|
||||||
res += n;
|
res += n;
|
||||||
bytes -= n;
|
bytes -= n;
|
||||||
if (!bytes || !n)
|
if (!bytes || !n)
|
||||||
|
|
Loading…
Add table
Reference in a new issue