Use an enum for tagset flags, so that they don't need to be manually renumbered when modified. Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 4b6b20ccdb53..d00f1cb016fa 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -196,7 +196,7 @@ static int hctx_flags_show(void *data, struct seq_file *m) const int alloc_policy = BLK_MQ_FLAG_TO_ALLOC_POLICY(hctx->flags); BUILD_BUG_ON(ARRAY_SIZE(hctx_flag_name) != - BLK_MQ_F_ALLOC_POLICY_START_BIT); + BLK_MQ_B_ALLOC_POLICY_START_BIT); BUILD_BUG_ON(ARRAY_SIZE(alloc_policy_name) != BLK_TAG_ALLOC_MAX); seq_puts(m, "alloc_policy="); diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 7f6c482ebf54..8ef1a2455490 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -666,33 +666,39 @@ struct blk_mq_ops { #endif }; -/* Keep hctx_flag_name[] in sync with the definitions below */ enum { - BLK_MQ_F_TAG_QUEUE_SHARED = 1 << 1, + BLK_MQ_B_TAG_QUEUE_SHARED, /* * Set when this device requires underlying blk-mq device for * completing IO: */ - BLK_MQ_F_STACKING = 1 << 2, - BLK_MQ_F_TAG_HCTX_SHARED = 1 << 3, - BLK_MQ_F_BLOCKING = 1 << 4, + BLK_MQ_B_STACKING, + BLK_MQ_B_TAG_HCTX_SHARED, + BLK_MQ_B_BLOCKING, /* Do not allow an I/O scheduler to be configured. */ - BLK_MQ_F_NO_SCHED = 1 << 5, - + BLK_MQ_B_NO_SCHED, /* * Select 'none' during queue registration in case of a single hwq * or shared hwqs instead of 'mq-deadline'. */ - BLK_MQ_F_NO_SCHED_BY_DEFAULT = 1 << 6, - BLK_MQ_F_ALLOC_POLICY_START_BIT = 7, - BLK_MQ_F_ALLOC_POLICY_BITS = 1, + BLK_MQ_B_NO_SCHED_BY_DEFAULT, + BLK_MQ_B_ALLOC_POLICY_START_BIT, + BLK_MQ_B_ALLOC_POLICY_BITS = 1, }; +/* Keep hctx_flag_name[] in sync with the definitions below */ +#define BLK_MQ_F_TAG_QUEUE_SHARED (1 << BLK_MQ_B_TAG_QUEUE_SHARED) +#define BLK_MQ_F_STACKING (1 << BLK_MQ_B_STACKING) +#define BLK_MQ_F_TAG_HCTX_SHARED (1 << BLK_MQ_B_TAG_HCTX_SHARED) +#define BLK_MQ_F_BLOCKING (1 << BLK_MQ_B_BLOCKING) +#define BLK_MQ_F_NO_SCHED (1 << BLK_MQ_B_NO_SCHED) +#define BLK_MQ_F_NO_SCHED_BY_DEFAULT (1 << BLK_MQ_B_NO_SCHED_BY_DEFAULT) + #define BLK_MQ_FLAG_TO_ALLOC_POLICY(flags) \ - ((flags >> BLK_MQ_F_ALLOC_POLICY_START_BIT) & \ - ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) + ((flags >> BLK_MQ_B_ALLOC_POLICY_START_BIT) & \ + ((1 << BLK_MQ_B_ALLOC_POLICY_BITS) - 1)) #define BLK_ALLOC_POLICY_TO_MQ_FLAG(policy) \ - ((policy & ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) \ - << BLK_MQ_F_ALLOC_POLICY_START_BIT) + ((policy & ((1 << BLK_MQ_B_ALLOC_POLICY_BITS) - 1)) \ + << BLK_MQ_B_ALLOC_POLICY_START_BIT) #define BLK_MQ_MAX_DEPTH (10240) #define BLK_MQ_NO_HCTX_IDX (-1U) -- 2.31.1