diff options
author | Li Nan <linan122@huawei.com> | 2024-01-17 11:19:46 +0800 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2024-04-08 21:15:46 -0700 |
commit | 9d1110f99c253ccef82e480bfe9f38a12eb797a7 (patch) | |
tree | 0d9dc93d6676c34e0b609a625aa81a4b0317781b /drivers/md/md.h | |
parent | 3f9f231236ce7e48780d8a4f1f8cb9fae2df1e4e (diff) | |
download | linux-stable-9d1110f99c253ccef82e480bfe9f38a12eb797a7.tar.gz linux-stable-9d1110f99c253ccef82e480bfe9f38a12eb797a7.tar.bz2 linux-stable-9d1110f99c253ccef82e480bfe9f38a12eb797a7.zip |
md: don't account sync_io if iostats of the disk is disabled
If iostats is disabled, disk_stats will not be updated and
part_stat_read_accum() only returns a constant value. In this case,
continuing to count sync_io and to check is_mddev_idle() is no longer
meaningful.
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240117031946.2324519-3-linan666@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r-- | drivers/md/md.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index d0db98c0d33b..029dd0491a36 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -621,7 +621,8 @@ extern void mddev_unlock(struct mddev *mddev); static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors) { - atomic64_add(nr_sectors, &bdev->bd_disk->sync_io); + if (blk_queue_io_stat(bdev->bd_disk->queue)) + atomic64_add(nr_sectors, &bdev->bd_disk->sync_io); } static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors) |