summaryrefslogtreecommitdiff
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2021-09-15 15:17:17 +0800
committerDavid Sterba <dsterba@suse.com>2021-10-26 19:08:02 +0200
commitcd8e0cca95912df42a559a80e13cb6a38bb5c449 (patch)
tree5cbfc08e2ae1ea14a3a08efad6c1374e31a76b84 /fs/btrfs/scrub.c
parent4c6646117912397d026d70c04d92ec1599522e9f (diff)
downloadlinux-cd8e0cca95912df42a559a80e13cb6a38bb5c449.tar.gz
linux-cd8e0cca95912df42a559a80e13cb6a38bb5c449.tar.bz2
linux-cd8e0cca95912df42a559a80e13cb6a38bb5c449.zip
btrfs: remove btrfs_bio_alloc() helper
The helper btrfs_bio_alloc() is almost the same as btrfs_io_bio_alloc(), except it's allocating using BIO_MAX_VECS as @nr_iovecs, and initializes bio->bi_iter.bi_sector. However the naming itself is not using "btrfs_io_bio" to indicate its parameter is "strcut btrfs_io_bio" and can be easily confused with "struct btrfs_bio". Considering assigned bio->bi_iter.bi_sector is such a simple work and there are already tons of call sites doing that manually, there is no need to do that in a helper. Remove btrfs_bio_alloc() helper, and enhance btrfs_io_bio_alloc() function to provide a fail-safe value for its @nr_iovecs. And then replace all btrfs_bio_alloc() callers with btrfs_io_bio_alloc(). Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r--fs/btrfs/scrub.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 717d8f98cf0b..1a9d485f8056 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2225,7 +2225,7 @@ static void scrub_missing_raid56_pages(struct scrub_block *sblock)
goto bioc_out;
}
- bio = btrfs_io_bio_alloc(0);
+ bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
bio->bi_iter.bi_sector = logical >> 9;
bio->bi_private = sblock;
bio->bi_end_io = scrub_missing_raid56_end_io;
@@ -2841,7 +2841,7 @@ static void scrub_parity_check_and_repair(struct scrub_parity *sparity)
if (ret || !bioc || !bioc->raid_map)
goto bioc_out;
- bio = btrfs_io_bio_alloc(0);
+ bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
bio->bi_iter.bi_sector = sparity->logic_start >> 9;
bio->bi_private = sparity;
bio->bi_end_io = scrub_parity_bio_endio;