Skip to content

Commit c4f512d

Browse files
author
Mike Snitzer
committed
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 <[email protected]>
1 parent 06eed76 commit c4f512d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/md/dm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
597597
if (blk_queue_io_stat(md->queue))
598598
dm_io_set_flag(io, DM_IO_BLK_STAT);
599599

600-
if (static_branch_unlikely(&stats_enabled))
600+
if (static_branch_unlikely(&stats_enabled) &&
601+
unlikely(dm_stats_used(&md->stats)))
601602
dm_stats_record_start(&md->stats, &io->stats_aux);
602603

603604
return io;

0 commit comments

Comments
 (0)