From: Nikolay Borisov Date: Thu, 2 Jul 2020 12:23:31 +0000 (+0300) Subject: btrfs: don't check for btrfs_device::bdev in btrfs_end_bio X-Git-Tag: v5.15~2817^2~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3eee86c8fd9a9cdeba7afa943ae00bd166e2899a;p=platform%2Fkernel%2Flinux-starfive.git btrfs: don't check for btrfs_device::bdev in btrfs_end_bio btrfs_map_bio ensures that all submitted bios to devices have valid btrfs_device::bdev so this check can be removed from btrfs_end_bio. This check was added in june 2012 597a60fadedf ("Btrfs: don't count I/O statistic read errors for missing devices") but then in October of the same year another commit de1ee92ac3bc ("Btrfs: recheck bio against block device when we map the bio") started checking for the presence of btrfs_device::bdev before actually issuing the bio. Reviewed-by: Josef Bacik Signed-off-by: Nikolay Borisov Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index fb35021..98f75f7 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6263,17 +6263,16 @@ static void btrfs_end_bio(struct bio *bio) bio->bi_status == BLK_STS_TARGET) { struct btrfs_device *dev = btrfs_io_bio(bio)->device; - if (dev->bdev) { - if (bio_op(bio) == REQ_OP_WRITE) - btrfs_dev_stat_inc_and_print(dev, + ASSERT(dev->bdev); + if (bio_op(bio) == REQ_OP_WRITE) + btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); - else if (!(bio->bi_opf & REQ_RAHEAD)) - btrfs_dev_stat_inc_and_print(dev, + else if (!(bio->bi_opf & REQ_RAHEAD)) + btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_READ_ERRS); - if (bio->bi_opf & REQ_PREFLUSH) - btrfs_dev_stat_inc_and_print(dev, + if (bio->bi_opf & REQ_PREFLUSH) + btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_FLUSH_ERRS); - } } }