Cleanup: Remove unused __REQ_NR_BITS from enum rq_flag_bits
PATCH 1/1 Cleanup: Remove unused __REQ_NR_BITS from enum rq_flag_bits
The __REQ_NR_BITS was being used by blk_dump_rq_flags() long back, while printing the individual request flag bits as strings to limit to the used bits. But it does not use it now. Remove unused enum.
---
include/linux/blkdev.h +0 -1
@@ -118,7 +118,6 @@ enum rq_flag_bits { __REQ_COPY_USER,/* contains copies of user pages */ __REQ_INTEGRITY,/* integrity metadata has been remapped */ __REQ_NOIDLE, /* Don't anticipate more IO after this one */ - __REQ_NR_BITS, /* stops here */ };#define REQ_RW (1 << __REQ_RW)
Quoted 13 lines · Nikanth Karthikesan
The
__REQ_NR_BITSwas being used byblk_dump_rq_flags()long back, while printing the individual request flag bits as strings to limit to the used bits. But it does not use it now. Remove unused enum.Signed-off-by Nikanth Karthikesan <[email protected]>---
include/linux/blkdev.h +0
-0
include/linux/blkdev.h enum rq_flag_bits { · line 123
Quoted 7 lines
include/linux/blkdev.h +0
-1@@ -118,7 +118,6 @@ enum rq_flag_bits { __REQ_COPY_USER,/* contains copies of user pages */ __REQ_INTEGRITY,/* integrity metadata has been remapped */ __REQ_NOIDLE, /* Don't anticipate more IO after this one */ - __REQ_NR_BITS, /* stops here */ };#define REQ_RW (1 << __REQ_RW)
Lets turn it into something useful instead. It's meant to catch someone adding too many flags, how about something like this:
Untested ;-)
block/blk-core.c +2 -0
@@ -2159,6 +2159,8 @@ EXPORT_SYMBOL(kblockd_schedule_work);int __init blk_dev_init (void ) { +BUILD_BUG_ON (__REQ_NR_BITS >8 *sizeof (int )); + kblockd_workqueue =create_workqueue ("kblockd" );if (!kblockd_workqueue)panic ("Failed to create kblockd\n" );
Signature · 1 line
Jens Axboe
Quoted 32 lines · On Monday 27 April 2009 17:16:33 Jens Axboe wrote:
Quoted 13 lines · Nikanth Karthikesan
The
__REQ_NR_BITSwas being used byblk_dump_rq_flags()long back, while printing the individual request flag bits as strings to limit to the used bits. But it does not use it now. Remove unused enum.Signed-off-by Nikanth Karthikesan <[email protected]>---
include/linux/blkdev.h +0
-0include/linux/blkdev.h enum rq_flag_bits { · line 123
Quoted 7 lines
include/linux/blkdev.h +0
-1@@ -118,7 +118,6 @@ enum rq_flag_bits { __REQ_COPY_USER,/* contains copies of user pages */ __REQ_INTEGRITY,/* integrity metadata has been remapped */ __REQ_NOIDLE, /* Don't anticipate more IO after this one */ - __REQ_NR_BITS, /* stops here */ };#define REQ_RW (1 << __REQ_RW)Lets turn it into something useful instead. It's meant to catch someone adding too many flags, how about something like this:
Untested ;-)
block/blk-core.c +0
-0
block/blk-core.c EXPORT_SYMBOL(kblockd_schedule_work); · line 2166
Quoted 8 lines
block/blk-core.c +2
-0@@ -2159,6 +2159,8 @@ EXPORT_SYMBOL(kblockd_schedule_work);int __init blk_dev_init (void ) { +BUILD_BUG_ON (__REQ_NR_BITS >8 *sizeof (int )); + kblockd_workqueue =create_workqueue ("kblockd" );if (!kblockd_workqueue)panic ("Failed to create kblockd\n" );
Good idea. How about this?
Thanks
Nikanth
Catch trying to use more bits than request->cmd_flags has.
---
block/blk-core.c +3 -0
@@ -2156,6 +2156,9 @@ EXPORT_SYMBOL(kblockd_schedule_work);int __init blk_dev_init (void ) { +BUILD_BUG_ON (__REQ_NR_BITS >8 * +sizeof (((struct request *)0 )->cmd_flags)); + kblockd_workqueue =create_workqueue ("kblockd" );if (!kblockd_workqueue)panic ("Failed to create kblockd\n" );
Quoted 34 lines · Nikanth Karthikesan
Quoted 33 lines · On Monday 27 April 2009 17:16:33 Jens Axboe wrote:
Quoted 13 lines · Nikanth Karthikesan
The
__REQ_NR_BITSwas being used byblk_dump_rq_flags()long back, while printing the individual request flag bits as strings to limit to the used bits. But it does not use it now. Remove unused enum.Signed-off-by Nikanth Karthikesan <[email protected]>---
include/linux/blkdev.h +0
-0include/linux/blkdev.h enum rq_flag_bits { · line 123
Quoted 7 lines
include/linux/blkdev.h +0
-1@@ -118,7 +118,6 @@ enum rq_flag_bits { __REQ_COPY_USER,/* contains copies of user pages */ __REQ_INTEGRITY,/* integrity metadata has been remapped */ __REQ_NOIDLE, /* Don't anticipate more IO after this one */ - __REQ_NR_BITS, /* stops here */ };#define REQ_RW (1 << __REQ_RW)Lets turn it into something useful instead. It's meant to catch someone adding too many flags, how about something like this:
Untested ;-)
block/blk-core.c +0
-0@@ -2159,6 +2159,8 @@ EXPORT_SYMBOL(kblockd_schedule_work);
Quoted 9 lines
block/blk-core.c EXPORT_SYMBOL(kblockd_schedule_work); · line 2164
Quoted 7 lines
block/blk-core.c +2
-0int __init blk_dev_init (void ) { +BUILD_BUG_ON (__REQ_NR_BITS >8 *sizeof (int )); + kblockd_workqueue =create_workqueue ("kblockd" );if (!kblockd_workqueue)panic ("Failed to create kblockd\n" );Good idea. How about this?
That's fine, better explains the check. It doesn't matter in practice though, since we will be restricted to 32 flags even on 64-bit archs (as long as we support 32-bit archs).
I'll add it, thanks.
Signature · 1 line
Jens Axboe