Skip to content

Commit b23fb76

Browse files
Matthew Wilcoxtytso
authored andcommitted
ext4: Convert pagecache_read() to use a folio
Use the folio API and support folios of arbitrary sizes. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 3060b6e commit b23fb76

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

fs/ext4/verity.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,16 @@ static int pagecache_read(struct inode *inode, void *buf, size_t count,
4242
loff_t pos)
4343
{
4444
while (count) {
45-
size_t n = min_t(size_t, count,
46-
PAGE_SIZE - offset_in_page(pos));
47-
struct page *page;
45+
struct folio *folio;
46+
size_t n;
4847

49-
page = read_mapping_page(inode->i_mapping, pos >> PAGE_SHIFT,
48+
folio = read_mapping_folio(inode->i_mapping, pos >> PAGE_SHIFT,
5049
NULL);
51-
if (IS_ERR(page))
52-
return PTR_ERR(page);
53-
54-
memcpy_from_page(buf, page, offset_in_page(pos), n);
50+
if (IS_ERR(folio))
51+
return PTR_ERR(folio);
5552

56-
put_page(page);
53+
n = memcpy_from_file_folio(buf, folio, pos, count);
54+
folio_put(folio);
5755

5856
buf += n;
5957
pos += n;

0 commit comments

Comments
 (0)