@@ -6620,9 +6620,11 @@ static void btrfs_end_bio(struct bio *bio)
}
static void submit_stripe_bio(struct btrfs_io_context *bioc, struct bio *bio,
- u64 physical, struct btrfs_device *dev)
+ unsigned int stripe_nr)
{
struct btrfs_fs_info *fs_info = bioc->fs_info;
+ struct btrfs_device *dev = bioc->stripes[stripe_nr].dev;
+ const u64 physical = bioc->stripes[stripe_nr].physical;
btrfs_bio(bio)->bioc = bioc;
btrfs_bio(bio)->device = dev;
@@ -6674,7 +6676,6 @@ static void bioc_error(struct btrfs_io_context *bioc, struct bio *bio, u64 logic
blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
int mirror_num)
{
- struct btrfs_device *dev;
struct bio *first_bio = bio;
u64 logical = bio->bi_iter.bi_sector << 9;
u64 length = 0;
@@ -6725,7 +6726,8 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
}
for (dev_nr = 0; dev_nr < total_devs; dev_nr++) {
- dev = bioc->stripes[dev_nr].dev;
+ struct btrfs_device *dev = bioc->stripes[dev_nr].dev;
+
if (!dev || !dev->bdev || test_bit(BTRFS_DEV_STATE_MISSING,
&dev->dev_state) ||
(btrfs_op(first_bio) == BTRFS_MAP_WRITE &&
@@ -6739,7 +6741,7 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
else
bio = first_bio;
- submit_stripe_bio(bioc, bio, bioc->stripes[dev_nr].physical, dev);
+ submit_stripe_bio(bioc, bio, dev_nr);
}
btrfs_bio_counter_dec(fs_info);
return BLK_STS_OK;
Function submit_stripe_bio() is to submit bio using provided btrfs_io_context, which will map the logical address to physical address, and set the target device. All the required info is already in bioc, including the device and physical address, we only need to know which stripe we're targeting at. This patch will replace @physical and @dev parameters with @stripe_nr. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/volumes.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)