* [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio
@ 2018-11-08 14:16 Nikolay Borisov
2018-11-09 21:03 ` Josef Bacik
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Nikolay Borisov @ 2018-11-08 14:16 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
Before btrfs_map_bio submits all stripe bio 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.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/volumes.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 44c5e8ccb644..3312cad65209 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6106,12 +6106,6 @@ static noinline void btrfs_schedule_bio(struct btrfs_device *device,
int should_queue = 1;
struct btrfs_pending_bios *pending_bios;
- if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state) ||
- !device->bdev) {
- bio_io_error(bio);
- return;
- }
-
/* don't bother with additional async steps for reads, right now */
if (bio_op(bio) == REQ_OP_READ) {
btrfsic_submit_bio(bio);
@@ -6240,7 +6234,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 = bbio->stripes[dev_nr].dev;
- if (!dev || !dev->bdev ||
+ if (!dev || !dev->bdev || test_bit(BTRFS_DEV_STATE_MISSING,
+ &dev->dev_state) ||
(bio_op(first_bio) == REQ_OP_WRITE &&
!test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state))) {
bbio_error(bbio, first_bio, logical);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio
2018-11-08 14:16 [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio Nikolay Borisov
@ 2018-11-09 21:03 ` Josef Bacik
2018-11-10 23:21 ` Anand Jain
2018-11-12 18:50 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Josef Bacik @ 2018-11-09 21:03 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: linux-btrfs
On Thu, Nov 08, 2018 at 04:16:38PM +0200, Nikolay Borisov wrote:
> Before btrfs_map_bio submits all stripe bio 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.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio
2018-11-08 14:16 [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio Nikolay Borisov
2018-11-09 21:03 ` Josef Bacik
@ 2018-11-10 23:21 ` Anand Jain
2018-11-12 18:50 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Anand Jain @ 2018-11-10 23:21 UTC (permalink / raw)
To: Nikolay Borisov, linux-btrfs
On 11/08/2018 10:16 PM, Nikolay Borisov wrote:
> Before btrfs_map_bio submits all stripe bio 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.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Thanks, Anand
> ---
> fs/btrfs/volumes.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 44c5e8ccb644..3312cad65209 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6106,12 +6106,6 @@ static noinline void btrfs_schedule_bio(struct btrfs_device *device,
> int should_queue = 1;
> struct btrfs_pending_bios *pending_bios;
>
> - if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state) ||
> - !device->bdev) {
> - bio_io_error(bio);
> - return;
> - }
> -
> /* don't bother with additional async steps for reads, right now */
> if (bio_op(bio) == REQ_OP_READ) {
> btrfsic_submit_bio(bio);
> @@ -6240,7 +6234,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 = bbio->stripes[dev_nr].dev;
> - if (!dev || !dev->bdev ||
> + if (!dev || !dev->bdev || test_bit(BTRFS_DEV_STATE_MISSING,
> + &dev->dev_state) ||
> (bio_op(first_bio) == REQ_OP_WRITE &&
> !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state))) {
> bbio_error(bbio, first_bio, logical);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio
2018-11-08 14:16 [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio Nikolay Borisov
2018-11-09 21:03 ` Josef Bacik
2018-11-10 23:21 ` Anand Jain
@ 2018-11-12 18:50 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2018-11-12 18:50 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: linux-btrfs
On Thu, Nov 08, 2018 at 04:16:38PM +0200, Nikolay Borisov wrote:
> Before btrfs_map_bio submits all stripe bio 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.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-12 18:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 14:16 [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio Nikolay Borisov
2018-11-09 21:03 ` Josef Bacik
2018-11-10 23:21 ` Anand Jain
2018-11-12 18:50 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.