]> xenbits.xensource.com Git - people/jgross/linux.git/commitdiff
ext4: Convert pagecache_read() to use a folio
authorMatthew Wilcox <willy@infradead.org>
Fri, 24 Mar 2023 18:01:28 +0000 (18:01 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Apr 2023 17:39:52 +0000 (13:39 -0400)
Use the folio API and support folios of arbitrary sizes.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20230324180129.1220691-29-willy@infradead.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/verity.c

index e4da1704438e2421dbfd669f423e099004a019da..afe847c967a450d42e164086ceb8a5f9a879c4eb 100644 (file)
@@ -42,18 +42,16 @@ static int pagecache_read(struct inode *inode, void *buf, size_t count,
                          loff_t pos)
 {
        while (count) {
-               size_t n = min_t(size_t, count,
-                                PAGE_SIZE - offset_in_page(pos));
-               struct page *page;
+               struct folio *folio;
+               size_t n;
 
-               page = read_mapping_page(inode->i_mapping, pos >> PAGE_SHIFT,
+               folio = read_mapping_folio(inode->i_mapping, pos >> PAGE_SHIFT,
                                         NULL);
-               if (IS_ERR(page))
-                       return PTR_ERR(page);
-
-               memcpy_from_page(buf, page, offset_in_page(pos), n);
+               if (IS_ERR(folio))
+                       return PTR_ERR(folio);
 
-               put_page(page);
+               n = memcpy_from_file_folio(buf, folio, pos, count);
+               folio_put(folio);
 
                buf += n;
                pos += n;