diff mbox series

[v2,02/12] block: Make QUEUE_FLAG_x as an enum

Message ID 20240711082339.1155658-3-john.g.garry@oracle.com (mailing list archive)
State New, archived
Headers show
Series block: Catch missing debugfs flag array members | expand

Commit Message

John Garry July 11, 2024, 8:23 a.m. UTC
This will allow us better keep in sync with blk_queue_flag_name[].

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 include/linux/blkdev.h | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

Comments

Bart Van Assche July 11, 2024, 6:05 p.m. UTC | #1
On 7/11/24 1:23 AM, John Garry wrote:
> +enum {
> +	QUEUE_FLAG_DYING		= 0,	/* queue being torn down */

Please leave out " = 0" since it is redundant.

Thanks,

Bart.
John Garry July 12, 2024, 10:33 a.m. UTC | #2
On 11/07/2024 19:05, Bart Van Assche wrote:
> On 7/11/24 1:23 AM, John Garry wrote:
>> +enum {
>> +    QUEUE_FLAG_DYING        = 0,    /* queue being torn down */
> 
> Please leave out " = 0" since it is redundant.

ok. I think that assigning the base member to zero is 50/50 habit and 
paranoia for me.

I'll look at the rest of your comments next week.

Thanks,
John
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 942ad4e0f231..bb521745c702 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -588,19 +588,22 @@  struct request_queue {
 };
 
 /* Keep blk_queue_flag_name[] in sync with the definitions below */
-#define QUEUE_FLAG_DYING	1	/* queue being torn down */
-#define QUEUE_FLAG_NOMERGES     3	/* disable merge attempts */
-#define QUEUE_FLAG_SAME_COMP	4	/* complete on same CPU-group */
-#define QUEUE_FLAG_FAIL_IO	5	/* fake timeout */
-#define QUEUE_FLAG_NOXMERGES	9	/* No extended merges */
-#define QUEUE_FLAG_SAME_FORCE	12	/* force complete on same CPU */
-#define QUEUE_FLAG_INIT_DONE	14	/* queue is initialized */
-#define QUEUE_FLAG_STATS	20	/* track IO start and completion times */
-#define QUEUE_FLAG_REGISTERED	22	/* queue has been registered to a disk */
-#define QUEUE_FLAG_QUIESCED	24	/* queue has been quiesced */
-#define QUEUE_FLAG_RQ_ALLOC_TIME 27	/* record rq->alloc_time_ns */
-#define QUEUE_FLAG_HCTX_ACTIVE	28	/* at least one blk-mq hctx is active */
-#define QUEUE_FLAG_SQ_SCHED     30	/* single queue style io dispatch */
+enum {
+	QUEUE_FLAG_DYING		= 0,	/* queue being torn down */
+	QUEUE_FLAG_NOMERGES,			/* disable merge attempts */
+	QUEUE_FLAG_SAME_COMP,			/* complete on same CPU-group */
+	QUEUE_FLAG_FAIL_IO,			/* fake timeout */
+	QUEUE_FLAG_NOXMERGES,			/* No extended merges */
+	QUEUE_FLAG_SAME_FORCE,			/* force complete on same CPU */
+	QUEUE_FLAG_INIT_DONE,			/* queue is initialized */
+	QUEUE_FLAG_STATS,			/* track IO start and completion times */
+	QUEUE_FLAG_REGISTERED,			/* queue has been registered to a disk */
+	QUEUE_FLAG_QUIESCED,			/* queue has been quiesced */
+	QUEUE_FLAG_RQ_ALLOC_TIME,		/* record rq->alloc_time_ns */
+	QUEUE_FLAG_HCTX_ACTIVE,			/* at least one blk-mq hctx is active */
+	QUEUE_FLAG_SQ_SCHED,			/* single queue style io dispatch */
+	QUEUE_FLAG_MAX
+};
 
 #define QUEUE_FLAG_MQ_DEFAULT	(1UL << QUEUE_FLAG_SAME_COMP)