Re: [PATCH] Cleanup: Remove unused __REQ_NR_BITS from enumrq_flag_bits

From: Jens Axboe
Date: Mon Apr 27 2009 - 07:46:44 EST


On Mon, Apr 27 2009, Nikanth Karthikesan wrote:
> 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.
>
> Signed-off-by: Nikanth Karthikesan <knikanth@xxxxxxx>
>
> ---
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index ba54c83..f41abbb 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -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 ;-)

diff --git a/block/blk-core.c b/block/blk-core.c
index d73eb76..e62ef94 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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");

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/