summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-06-17 12:04:10 +0200
committerDavid Sterba <dsterba@suse.com>2022-07-25 17:45:40 +0200
commitb9af128d1e81645e7d9030e30def06ea5032f201 (patch)
tree2057050cf71ef22515f913177387e521b2e95d7e /fs/btrfs/volumes.c
parent6065fd95dae1013f339c78d067eb71f0761c654b (diff)
downloadlinux-b9af128d1e81645e7d9030e30def06ea5032f201.tar.bz2
btrfs: raid56: transfer the bio counter reference to the raid submission helpers
Transfer the bio counter reference acquired by btrfs_submit_bio to raid56_parity_write and raid56_parity_recovery together with the bio that the reference was acquired for instead of acquiring another reference in those helpers and dropping the original one in btrfs_submit_bio. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Tested-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c9328cbd7fe9..bf4e140f6bfc 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6750,8 +6750,12 @@ void btrfs_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio, int mirror
btrfs_bio_counter_inc_blocked(fs_info);
ret = __btrfs_map_block(fs_info, btrfs_op(bio), logical,
&map_length, &bioc, mirror_num, 1);
- if (ret)
- goto out_dec;
+ if (ret) {
+ btrfs_bio_counter_dec(fs_info);
+ bio->bi_status = errno_to_blk_status(ret);
+ bio_endio(bio);
+ return;
+ }
total_devs = bioc->num_stripes;
bioc->orig_bio = bio;
@@ -6765,7 +6769,7 @@ void btrfs_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio, int mirror
raid56_parity_write(bio, bioc);
else
raid56_parity_recover(bio, bioc, mirror_num, true);
- goto out_dec;
+ return;
}
if (map_length < length) {
@@ -6780,12 +6784,7 @@ void btrfs_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio, int mirror
submit_stripe_bio(bioc, bio, dev_nr, should_clone);
}
-out_dec:
btrfs_bio_counter_dec(fs_info);
- if (ret) {
- bio->bi_status = errno_to_blk_status(ret);
- bio_endio(bio);
- }
}
static bool dev_args_match_fs_devices(const struct btrfs_dev_lookup_args *args,