Skip to content

Commit c7d57ab

Browse files
author
Al Viro
committed
hugetlbfs: copy_page_to_iter() can deal with compound pages
... since April 2021 Signed-off-by: Al Viro <[email protected]>
1 parent f0f6b61 commit c7d57ab

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

fs/hugetlbfs/inode.c

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -284,35 +284,6 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
284284
}
285285
#endif
286286

287-
static size_t
288-
hugetlbfs_read_actor(struct page *page, unsigned long offset,
289-
struct iov_iter *to, unsigned long size)
290-
{
291-
size_t copied = 0;
292-
int i, chunksize;
293-
294-
/* Find which 4k chunk and offset with in that chunk */
295-
i = offset >> PAGE_SHIFT;
296-
offset = offset & ~PAGE_MASK;
297-
298-
while (size) {
299-
size_t n;
300-
chunksize = PAGE_SIZE;
301-
if (offset)
302-
chunksize -= offset;
303-
if (chunksize > size)
304-
chunksize = size;
305-
n = copy_page_to_iter(&page[i], offset, chunksize, to);
306-
copied += n;
307-
if (n != chunksize)
308-
return copied;
309-
offset = 0;
310-
size -= chunksize;
311-
i++;
312-
}
313-
return copied;
314-
}
315-
316287
/*
317288
* Support for read() - Find the page attached to f_mapping and copy out the
318289
* 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)
363334
/*
364335
* We have the page, copy it to user space buffer.
365336
*/
366-
copied = hugetlbfs_read_actor(page, offset, to, nr);
337+
copied = copy_page_to_iter(page, offset, nr, to);
367338
put_page(page);
368339
}
369340
offset += copied;

0 commit comments

Comments
 (0)