btrfs: use the folio iterator in btrfs_end_super_write()
[linux-2.6-block.git] / fs / btrfs / disk-io.c
index 9e8d0b86d3e0f444d5e38e3a18acf6ef90314768..90c54466ecc3a3b9029d09c7ca8e1bc072bfb822 100644 (file)
@@ -3626,28 +3626,21 @@ ALLOW_ERROR_INJECTION(open_ctree, ERRNO);
 static void btrfs_end_super_write(struct bio *bio)
 {
        struct btrfs_device *device = bio->bi_private;
-       struct bio_vec *bvec;
-       struct bvec_iter_all iter_all;
-       struct page *page;
-
-       bio_for_each_segment_all(bvec, bio, iter_all) {
-               page = bvec->bv_page;
+       struct folio_iter fi;
 
+       bio_for_each_folio_all(fi, bio) {
                if (bio->bi_status) {
                        btrfs_warn_rl_in_rcu(device->fs_info,
-                               "lost page write due to IO error on %s (%d)",
+                               "lost super block write due to IO error on %s (%d)",
                                btrfs_dev_name(device),
                                blk_status_to_errno(bio->bi_status));
-                       ClearPageUptodate(page);
-                       SetPageError(page);
+                       folio_set_error(fi.folio);
                        btrfs_dev_stat_inc_and_print(device,
                                                     BTRFS_DEV_STAT_WRITE_ERRS);
-               } else {
-                       SetPageUptodate(page);
                }
 
-               put_page(page);
-               unlock_page(page);
+               folio_unlock(fi.folio);
+               folio_put(fi.folio);
        }
 
        bio_put(bio);