aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-08-06 10:03:28 +0200
committerDavid Sterba <dsterba@suse.com>2022-09-26 12:27:59 +0200
commit28793b194e6a0e50d4abc6fec7472799aa734d1f (patch)
treefc04866d78037e7cac16bb0d4672dc653757abb6 /fs/btrfs/volumes.c
parentbtrfs: factor out low-level bio setup from submit_stripe_bio (diff)
downloadlinux-dev-28793b194e6a0e50d4abc6fec7472799aa734d1f.tar.xz
linux-dev-28793b194e6a0e50d4abc6fec7472799aa734d1f.zip
btrfs: decide bio cloning inside submit_stripe_bio
Remove the orig_bio argument as it can be derived from the bioc, and the clone argument as it can be calculated from bioc and dev_nr. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 79c222b8e292..67c3aa8de0b7 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6788,13 +6788,12 @@ static void btrfs_submit_dev_bio(struct btrfs_device *dev, struct bio *bio)
submit_bio(bio);
}
-static void submit_stripe_bio(struct btrfs_io_context *bioc,
- struct bio *orig_bio, int dev_nr, bool clone)
+static void submit_stripe_bio(struct btrfs_io_context *bioc, int dev_nr)
{
- struct bio *bio;
+ struct bio *orig_bio = bioc->orig_bio, *bio;
/* Reuse the bio embedded into the btrfs_bio for the last mirror */
- if (!clone) {
+ if (dev_nr == bioc->num_stripes - 1) {
bio = orig_bio;
btrfs_bio(bio)->device = bioc->stripes[dev_nr].dev;
bio->bi_end_io = btrfs_end_bio;
@@ -6850,11 +6849,8 @@ void btrfs_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio, int mirror
BUG();
}
- for (dev_nr = 0; dev_nr < total_devs; dev_nr++) {
- const bool should_clone = (dev_nr < total_devs - 1);
-
- submit_stripe_bio(bioc, bio, dev_nr, should_clone);
- }
+ for (dev_nr = 0; dev_nr < total_devs; dev_nr++)
+ submit_stripe_bio(bioc, dev_nr);
}
static bool dev_args_match_fs_devices(const struct btrfs_dev_lookup_args *args,