bcachefs: Remove calls to folio_set_error
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 20 Apr 2024 02:50:01 +0000 (03:50 +0100)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 May 2024 21:29:20 +0000 (17:29 -0400)
Common code doesn't test the error flag, so we don't need to set it in
bcachefs.  We can use folio_end_read() to combine the setting (or not)
of the uptodate flag and clearing the lock flag.

Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Brian Foster <bfoster@redhat.com>
Cc: linux-bcachefs@vger.kernel.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io-buffered.c

index 120430abdae747f72117e4172a515ca6dc1a5013..b0a33fabadf81cf920f7644d8cb29b4b5faf21b6 100644 (file)
@@ -30,15 +30,8 @@ static void bch2_readpages_end_io(struct bio *bio)
 {
        struct folio_iter fi;
 
-       bio_for_each_folio_all(fi, bio) {
-               if (!bio->bi_status) {
-                       folio_mark_uptodate(fi.folio);
-               } else {
-                       folio_clear_uptodate(fi.folio);
-                       folio_set_error(fi.folio);
-               }
-               folio_unlock(fi.folio);
-       }
+       bio_for_each_folio_all(fi, bio)
+               folio_end_read(fi.folio, bio->bi_status == BLK_STS_OK);
 
        bio_put(bio);
 }
@@ -408,7 +401,6 @@ static void bch2_writepage_io_done(struct bch_write_op *op)
                bio_for_each_folio_all(fi, bio) {
                        struct bch_folio *s;
 
-                       folio_set_error(fi.folio);
                        mapping_set_error(fi.folio->mapping, -EIO);
 
                        s = __bch2_folio(fi.folio);