diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-11-08 09:16:38 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-12-17 08:51:32 -0500 |
commit | fc8a168aa9ab1680c2bd52bf9db7c994e0f2524f (patch) | |
tree | 5053642c07010c27328e5692bed011952cc87adb /fs/btrfs | |
parent | ab457246f8a45bbb3e79fd2a9c1044b5ac14ec99 (diff) |
btrfs: Check for missing device before bio submission in btrfs_map_bio
Before btrfs_map_bio submits all stripe bios it does a number of checks
to ensure the device for every stripe is present. However, it doesn't do
a DEV_STATE_MISSING check, instead this is relegated to the lower level
btrfs_schedule_bio (in the async submission case, sync submission
doesn't check DEV_STATE_MISSING at all). Additionally
btrfs_schedule_bios does the duplicate device->bdev check which has
already been performed in btrfs_map_bio.
This patch moves the DEV_STATE_MISSING check in btrfs_map_bio and
removes the duplicate device->bdev check. Doing so ensures that no bio
cloning/submission happens for both async/sync requests in the face of
missing device. This makes the async io submission path slightly shorter
in terms of instruction count. No functional changes.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e392ca5103cc..bb76263c3ad4 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -6109,12 +6109,6 @@ static noinline void btrfs_schedule_bio(struct btrfs_device *device, | |||
6109 | int should_queue = 1; | 6109 | int should_queue = 1; |
6110 | struct btrfs_pending_bios *pending_bios; | 6110 | struct btrfs_pending_bios *pending_bios; |
6111 | 6111 | ||
6112 | if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state) || | ||
6113 | !device->bdev) { | ||
6114 | bio_io_error(bio); | ||
6115 | return; | ||
6116 | } | ||
6117 | |||
6118 | /* don't bother with additional async steps for reads, right now */ | 6112 | /* don't bother with additional async steps for reads, right now */ |
6119 | if (bio_op(bio) == REQ_OP_READ) { | 6113 | if (bio_op(bio) == REQ_OP_READ) { |
6120 | btrfsic_submit_bio(bio); | 6114 | btrfsic_submit_bio(bio); |
@@ -6243,7 +6237,8 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio, | |||
6243 | 6237 | ||
6244 | for (dev_nr = 0; dev_nr < total_devs; dev_nr++) { | 6238 | for (dev_nr = 0; dev_nr < total_devs; dev_nr++) { |
6245 | dev = bbio->stripes[dev_nr].dev; | 6239 | dev = bbio->stripes[dev_nr].dev; |
6246 | if (!dev || !dev->bdev || | 6240 | if (!dev || !dev->bdev || test_bit(BTRFS_DEV_STATE_MISSING, |
6241 | &dev->dev_state) || | ||
6247 | (bio_op(first_bio) == REQ_OP_WRITE && | 6242 | (bio_op(first_bio) == REQ_OP_WRITE && |
6248 | !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state))) { | 6243 | !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state))) { |
6249 | bbio_error(bbio, first_bio, logical); | 6244 | bbio_error(bbio, first_bio, logical); |