From c4f512d255e3c4ade80a1d68ca816c1b11556a13 Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Tue, 13 Jun 2023 16:02:17 -0400 Subject: [PATCH] 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 --- drivers/md/dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 658323a..ea1671c 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; -- 2.7.4