mbox series

[v3,00/15] block: Catch missing blk-mq debugfs flag array members

Message ID 20240719112912.3830443-1-john.g.garry@oracle.com (mailing list archive)
Headers show
Series block: Catch missing blk-mq debugfs flag array members | expand

Message

John Garry July 19, 2024, 11:28 a.m. UTC
Currently we rely on the developer to remember to add the appropriate
entry to a blk-mq debugfs flag array when we add a new member.

This has shown to be error prone.

Add compile-time assertions that we are not missing flag array entries.

A limitation of this approach is that if a non-end-of-array entry was now
later removed from a flag name array, we could not detect that at build
time. But this is unlikely to occur. To actually detect that, we could
make the flag name array entries a flag and name tuple. That would just
add extra complexity and slow the code, which I am not sure if is really
required.

Differences to v2:
- Add Bart's RB tags (thanks)
- Drop redundant enum initializer (Bart)
- Re-order patches to put latent fixes at the front
- Relocate BLK_MQ_CPU_WORK_BATCH and BLK_MQ_MAX_DEPTH
- Put BLK_MQ_S_x in separate enum (Bart)
- Commit message tweaks (Bart)

Christoph Hellwig (1):
  block: remove QUEUE_FLAG_STOPPED

John Garry (14):
  block: Add missing entries from cmd_flag_name[]
  block: Add zone write plugging entry to rqf_name[]
  block: Add missing entry to hctx_flag_name[]
  block: Relocate BLK_MQ_CPU_WORK_BATCH
  block: Relocate BLK_MQ_MAX_DEPTH
  block: Make QUEUE_FLAG_x as an enum
  block: Catch possible entries missing from blk_queue_flag_name[]
  block: Catch possible entries missing from hctx_state_name[]
  block: Catch possible entries missing from hctx_flag_name[]
  block: Catch possible entries missing from alloc_policy_name[]
  block: Catch possible entries missing from cmd_flag_name[]
  block: Use enum to define RQF_x bit indexes
  block: Simplify definition of RQF_NAME()
  block: Catch possible entries missing from rqf_name[]

 block/blk-mq-debugfs.c    |  26 ++++++--
 block/blk-mq.h            |   2 +
 include/linux/blk-mq.h    | 127 +++++++++++++++++++++++---------------
 include/linux/blk_types.h |   1 +
 include/linux/blkdev.h    |  31 +++++-----
 5 files changed, 118 insertions(+), 69 deletions(-)

Comments

Jens Axboe July 19, 2024, 3:39 p.m. UTC | #1
On Fri, 19 Jul 2024 11:28:57 +0000, John Garry wrote:
> Currently we rely on the developer to remember to add the appropriate
> entry to a blk-mq debugfs flag array when we add a new member.
> 
> This has shown to be error prone.
> 
> Add compile-time assertions that we are not missing flag array entries.
> 
> [...]

Applied, thanks!

[01/15] block: Add missing entries from cmd_flag_name[]
        commit: 6b3789e6c5310a8f517796b0f4a11039f9e5cf8f
[02/15] block: Add zone write plugging entry to rqf_name[]
        commit: af54963f193533dd7c1fe8f3d4e7af18de2406d8
[03/15] block: Add missing entry to hctx_flag_name[]
        commit: 1c83c5375e2f1bc7b59fa3ec5aa1e5909ec8710c
[04/15] block: remove QUEUE_FLAG_STOPPED
        commit: c8f51feee135f37f0d77b4616083c25524daa7b0
[05/15] block: Relocate BLK_MQ_CPU_WORK_BATCH
        commit: 3dff6155733f25872530ad358c6f5559800f4ccb
[06/15] block: Relocate BLK_MQ_MAX_DEPTH
        commit: 793356d23f8a817e164a917c792741a6d6d651ed
[07/15] block: Make QUEUE_FLAG_x as an enum
        commit: 55177adf1837bc56f878f7f6f7123947a2088148
[08/15] block: Catch possible entries missing from blk_queue_flag_name[]
        commit: cce496de061d09794825b7c7c7d57faca4772d82
[09/15] block: Catch possible entries missing from hctx_state_name[]
        commit: 23827310cce7eff3477aeaeb59ea3718f5c9c633
[10/15] block: Catch possible entries missing from hctx_flag_name[]
        commit: 226f0f6afc3e5c8903c6e57e1f6073ad8ad189b5
[11/15] block: Catch possible entries missing from alloc_policy_name[]
        commit: 26d3bdb57ec3fa56eaf8d2e74b5d488e55f43013
[12/15] block: Catch possible entries missing from cmd_flag_name[]
        commit: 6fa99325ec86bcd442363d77561a1babd8d9a427
[13/15] block: Use enum to define RQF_x bit indexes
        commit: 5f89154e8e9e3445f9b592e58a7045e06153b822
[14/15] block: Simplify definition of RQF_NAME()
        commit: 2d61a6c2ca7aadce3771f81a3624848f97dcc39e
[15/15] block: Catch possible entries missing from rqf_name[]
        commit: 8a47e33f50dd779f94bc277c6d3de81672463c5e

Best regards,