]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: do not return errors from btrfs_submit_metadata_bio
authorChristoph Hellwig <hch@lst.de>
Fri, 15 Apr 2022 14:33:26 +0000 (16:33 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:03:14 +0000 (17:03 +0200)
btrfs_submit_metadata_bio already calls ->bi_end_io on error and the
caller must ignore the return value, so remove it.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h

index 97da1ac062cd24964fac207522d1ca03cd2be257..647e93691b3644c569917fbb6331c07509753d2f 100644 (file)
@@ -920,8 +920,7 @@ static bool should_async_write(struct btrfs_fs_info *fs_info,
        return true;
 }
 
-blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
-                                      int mirror_num)
+void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_num)
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        blk_status_t ret;
@@ -933,14 +932,12 @@ blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
                 */
                ret = btrfs_bio_wq_end_io(fs_info, bio,
                                          BTRFS_WQ_ENDIO_METADATA);
-               if (ret)
-                       goto out_w_error;
-               ret = btrfs_map_bio(fs_info, bio, mirror_num);
+               if (!ret)
+                       ret = btrfs_map_bio(fs_info, bio, mirror_num);
        } else if (!should_async_write(fs_info, BTRFS_I(inode))) {
                ret = btree_csum_one_bio(bio);
-               if (ret)
-                       goto out_w_error;
-               ret = btrfs_map_bio(fs_info, bio, mirror_num);
+               if (!ret)
+                       ret = btrfs_map_bio(fs_info, bio, mirror_num);
        } else {
                /*
                 * kthread helpers are used to submit writes so that
@@ -950,14 +947,10 @@ blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
                                          0, btree_submit_bio_start);
        }
 
-       if (ret)
-               goto out_w_error;
-       return 0;
-
-out_w_error:
-       bio->bi_status = ret;
-       bio_endio(bio);
-       return ret;
+       if (ret) {
+               bio->bi_status = ret;
+               bio_endio(bio);
+       }
 }
 
 #ifdef CONFIG_MIGRATION
index 56607abe75aa47531c399420af6fbe54cbff25b3..9340e3266e0ac4fc9a2e621f614d9531b24450ea 100644 (file)
@@ -87,8 +87,7 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
 int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
                                   struct page *page, u64 start, u64 end,
                                   int mirror);
-blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
-                                      int mirror_num);
+void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_num);
 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
 struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info);
 #endif