ext4: use folio_end_read()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 4 Oct 2023 16:53:04 +0000 (17:53 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 18 Oct 2023 21:34:16 +0000 (14:34 -0700)
folio_end_read() is the perfect fit for ext4.

Link: https://lkml.kernel.org/r/20231004165317.1061855-5-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ext4/readpage.c

index 3e7d160f543f0cc6b5daddaec3f4785086c52c7a..21e8f0aebb3c6477c62dff8d80e606f23379b414 100644 (file)
@@ -70,15 +70,8 @@ static void __read_end_io(struct bio *bio)
 {
        struct folio_iter fi;
 
-       bio_for_each_folio_all(fi, bio) {
-               struct folio *folio = fi.folio;
-
-               if (bio->bi_status)
-                       folio_clear_uptodate(folio);
-               else
-                       folio_mark_uptodate(folio);
-               folio_unlock(folio);
-       }
+       bio_for_each_folio_all(fi, bio)
+               folio_end_read(fi.folio, bio->bi_status == 0);
        if (bio->bi_private)
                mempool_free(bio->bi_private, bio_post_read_ctx_pool);
        bio_put(bio);
@@ -336,8 +329,7 @@ int ext4_mpage_readpages(struct inode *inode,
                                if (ext4_need_verity(inode, folio->index) &&
                                    !fsverity_verify_folio(folio))
                                        goto set_error_page;
-                               folio_mark_uptodate(folio);
-                               folio_unlock(folio);
+                               folio_end_read(folio, true);
                                continue;
                        }
                } else if (fully_mapped) {