summaryrefslogtreecommitdiff
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2022-03-26 21:14:00 +0300
committerMike Snitzer <snitzer@kernel.org>2022-05-06 00:31:34 +0300
commit442761fd2b297d65d1cb5786249e1e07a19e9122 (patch)
tree5f2b1b8f1c25cd74c1e2c0af3ce2e6fed3941c5b /drivers/md/dm-table.c
parent563a225c9fd207326c2a2af9d59b4097cb31ce70 (diff)
downloadlinux-442761fd2b297d65d1cb5786249e1e07a19e9122.tar.xz
dm: conditionally enable branching for less used features
Use jump_labels to further reduce cost of unlikely branches for zoned block devices, dm-stats and swap_bios throttling. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 73ed15d8cfc6..a37c7b763643 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -719,6 +719,9 @@ int dm_table_add_target(struct dm_table *t, const char *type,
DMWARN("%s: %s: ignoring discards_supported because num_discard_bios is zero.",
dm_device_name(t->md), type);
+ if (tgt->limit_swap_bios && !static_key_enabled(&swap_bios_enabled.key))
+ static_branch_enable(&swap_bios_enabled);
+
return 0;
bad:
@@ -2040,6 +2043,8 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
r = dm_set_zones_restrictions(t, q);
if (r)
return r;
+ if (!static_key_enabled(&zoned_enabled.key))
+ static_branch_enable(&zoned_enabled);
}
dm_update_crypto_profile(q, t);