aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro2022-06-23 17:24:09 -0400
committerAl Viro2022-08-08 22:37:26 -0400
commitc7d57ab1632d29e256e3ae68f925751142330d88 (patch)
tree18fc4628d0540897f98ad633d293d692a58d7db6
parentf0f6b614f83dbae99d283b7b12ab5dd2e04df979 (diff)
hugetlbfs: copy_page_to_iter() can deal with compound pages
... since April 2021 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/hugetlbfs/inode.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 20336cb3c040..40e124a24efa 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -284,35 +284,6 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
}
#endif
-static size_t
-hugetlbfs_read_actor(struct page *page, unsigned long offset,
- struct iov_iter *to, unsigned long size)
-{
- size_t copied = 0;
- int i, chunksize;
-
- /* Find which 4k chunk and offset with in that chunk */
- i = offset >> PAGE_SHIFT;
- offset = offset & ~PAGE_MASK;
-
- while (size) {
- size_t n;
- chunksize = PAGE_SIZE;
- if (offset)
- chunksize -= offset;
- if (chunksize > size)
- chunksize = size;
- n = copy_page_to_iter(&page[i], offset, chunksize, to);
- copied += n;
- if (n != chunksize)
- return copied;
- offset = 0;
- size -= chunksize;
- i++;
- }
- return copied;
-}
-
/*
* Support for read() - Find the page attached to f_mapping and copy out the
* data. Its *very* similar to generic_file_buffered_read(), we can't use that
@@ -363,7 +334,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
/*
* We have the page, copy it to user space buffer.
*/
- copied = hugetlbfs_read_actor(page, offset, to, nr);
+ copied = copy_page_to_iter(page, offset, nr, to);
put_page(page);
}
offset += copied;