summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-06-13 23:02:17 +0300
committerMike Snitzer <snitzer@kernel.org>2023-06-17 01:24:13 +0300
commitc4f512d255e3c4ade80a1d68ca816c1b11556a13 (patch)
tree88ae8332518d51897b669fe2a4b89c7bba58362f /drivers/md
parent06eed768ea64c7a128582efda4f6107cb14ee962 (diff)
downloadlinux-c4f512d255e3c4ade80a1d68ca816c1b11556a13.tar.xz
dm: skip dm-stats work in alloc_io() unless needed
Don't dm_stats_record_start() if dm_stats_used() is false. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 658323aff676..ea1671c39ba1 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -597,7 +597,8 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
if (blk_queue_io_stat(md->queue))
dm_io_set_flag(io, DM_IO_BLK_STAT);
- if (static_branch_unlikely(&stats_enabled))
+ if (static_branch_unlikely(&stats_enabled) &&
+ unlikely(dm_stats_used(&md->stats)))
dm_stats_record_start(&md->stats, &io->stats_aux);
return io;