diff mbox series

blk-mq: fix the cmd_flag_name array

Message ID 1548325735-1760-1-git-send-email-jianchao.w.wang@oracle.com (mailing list archive)
State New, archived
Headers show
Series blk-mq: fix the cmd_flag_name array | expand

Commit Message

jianchao.wang Jan. 24, 2019, 10:28 a.m. UTC
Swap REQ_NOWAIT and REQ_NOUNMAP and add REQ_HIPRI.

Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
---
 block/blk-mq-debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jeff Moyer Jan. 24, 2019, 3:09 p.m. UTC | #1
Jianchao Wang <jianchao.w.wang@oracle.com> writes:

> Swap REQ_NOWAIT and REQ_NOUNMAP and add REQ_HIPRI.
>
> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
> ---
>  block/blk-mq-debugfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
> index 90d6876..f812083 100644
> --- a/block/blk-mq-debugfs.c
> +++ b/block/blk-mq-debugfs.c
> @@ -308,8 +308,9 @@ static const char *const cmd_flag_name[] = {
>  	CMD_FLAG_NAME(PREFLUSH),
>  	CMD_FLAG_NAME(RAHEAD),
>  	CMD_FLAG_NAME(BACKGROUND),
> -	CMD_FLAG_NAME(NOUNMAP),
>  	CMD_FLAG_NAME(NOWAIT),
> +	CMD_FLAG_NAME(NOUNMAP),
> +	CMD_FLAG_NAME(HIPRI),
>  };
>  #undef CMD_FLAG_NAME

Acked-by: Jeff Moyer <jmoyer@redhat.com>

You might consider also adding a comment above the req_flag_bits enum
noting that modifications also need to be propagated to cmd_flag_name.
Jens Axboe Jan. 24, 2019, 4:21 p.m. UTC | #2
On 1/24/19 3:28 AM, Jianchao Wang wrote:
> Swap REQ_NOWAIT and REQ_NOUNMAP and add REQ_HIPRI.

Applied, thanks.
Jens Axboe Jan. 24, 2019, 4:22 p.m. UTC | #3
On 1/24/19 8:09 AM, Jeff Moyer wrote:
> Jianchao Wang <jianchao.w.wang@oracle.com> writes:
> 
>> Swap REQ_NOWAIT and REQ_NOUNMAP and add REQ_HIPRI.
>>
>> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
>> ---
>>  block/blk-mq-debugfs.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
>> index 90d6876..f812083 100644
>> --- a/block/blk-mq-debugfs.c
>> +++ b/block/blk-mq-debugfs.c
>> @@ -308,8 +308,9 @@ static const char *const cmd_flag_name[] = {
>>  	CMD_FLAG_NAME(PREFLUSH),
>>  	CMD_FLAG_NAME(RAHEAD),
>>  	CMD_FLAG_NAME(BACKGROUND),
>> -	CMD_FLAG_NAME(NOUNMAP),
>>  	CMD_FLAG_NAME(NOWAIT),
>> +	CMD_FLAG_NAME(NOUNMAP),
>> +	CMD_FLAG_NAME(HIPRI),
>>  };
>>  #undef CMD_FLAG_NAME
> 
> Acked-by: Jeff Moyer <jmoyer@redhat.com>
> 
> You might consider also adding a comment above the req_flag_bits enum
> noting that modifications also need to be propagated to cmd_flag_name.

Agree... These things are notoriously difficult to keep in sync, this
isn't the first time we've had a fixup. Not sure if that situation
is improvable, but at least a comment might help.
Bart Van Assche Jan. 24, 2019, 4:28 p.m. UTC | #4
On Thu, 2019-01-24 at 09:22 -0700, Jens Axboe wrote:
> On 1/24/19 8:09 AM, Jeff Moyer wrote:
> > Jianchao Wang <jianchao.w.wang@oracle.com> writes:
> > 
> > > Swap REQ_NOWAIT and REQ_NOUNMAP and add REQ_HIPRI.
> > > 
> > > Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
> > > ---
> > >  block/blk-mq-debugfs.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
> > > index 90d6876..f812083 100644
> > > --- a/block/blk-mq-debugfs.c
> > > +++ b/block/blk-mq-debugfs.c
> > > @@ -308,8 +308,9 @@ static const char *const cmd_flag_name[] = {
> > >  	CMD_FLAG_NAME(PREFLUSH),
> > >  	CMD_FLAG_NAME(RAHEAD),
> > >  	CMD_FLAG_NAME(BACKGROUND),
> > > -	CMD_FLAG_NAME(NOUNMAP),
> > >  	CMD_FLAG_NAME(NOWAIT),
> > > +	CMD_FLAG_NAME(NOUNMAP),
> > > +	CMD_FLAG_NAME(HIPRI),
> > >  };
> > >  #undef CMD_FLAG_NAME
> > 
> > Acked-by: Jeff Moyer <jmoyer@redhat.com>
> > 
> > You might consider also adding a comment above the req_flag_bits enum
> > noting that modifications also need to be propagated to cmd_flag_name.
> 
> Agree... These things are notoriously difficult to keep in sync, this
> isn't the first time we've had a fixup. Not sure if that situation
> is improvable, but at least a comment might help.

How about making the build system derive the CMD_FLAG_NAME() declarations
from the include/linux/blk* header files? It's not that hard to do that e.g.
with the help of sed. The output of sed could be written into a .h file and
that file could be #included from blk-mq-debugfs.c.

Bart.
Jens Axboe Jan. 24, 2019, 4:34 p.m. UTC | #5
On 1/24/19 9:28 AM, Bart Van Assche wrote:
> On Thu, 2019-01-24 at 09:22 -0700, Jens Axboe wrote:
>> On 1/24/19 8:09 AM, Jeff Moyer wrote:
>>> Jianchao Wang <jianchao.w.wang@oracle.com> writes:
>>>
>>>> Swap REQ_NOWAIT and REQ_NOUNMAP and add REQ_HIPRI.
>>>>
>>>> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
>>>> ---
>>>>  block/blk-mq-debugfs.c | 3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
>>>> index 90d6876..f812083 100644
>>>> --- a/block/blk-mq-debugfs.c
>>>> +++ b/block/blk-mq-debugfs.c
>>>> @@ -308,8 +308,9 @@ static const char *const cmd_flag_name[] = {
>>>>  	CMD_FLAG_NAME(PREFLUSH),
>>>>  	CMD_FLAG_NAME(RAHEAD),
>>>>  	CMD_FLAG_NAME(BACKGROUND),
>>>> -	CMD_FLAG_NAME(NOUNMAP),
>>>>  	CMD_FLAG_NAME(NOWAIT),
>>>> +	CMD_FLAG_NAME(NOUNMAP),
>>>> +	CMD_FLAG_NAME(HIPRI),
>>>>  };
>>>>  #undef CMD_FLAG_NAME
>>>
>>> Acked-by: Jeff Moyer <jmoyer@redhat.com>
>>>
>>> You might consider also adding a comment above the req_flag_bits enum
>>> noting that modifications also need to be propagated to cmd_flag_name.
>>
>> Agree... These things are notoriously difficult to keep in sync, this
>> isn't the first time we've had a fixup. Not sure if that situation
>> is improvable, but at least a comment might help.
> 
> How about making the build system derive the CMD_FLAG_NAME() declarations
> from the include/linux/blk* header files? It's not that hard to do that e.g.
> with the help of sed. The output of sed could be written into a .h file and
> that file could be #included from blk-mq-debugfs.c.

I'd be fine with that, if we already require sed for building other parts.
If it can't be handled with pre processor macros or similar.
diff mbox series

Patch

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 90d6876..f812083 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -308,8 +308,9 @@  static const char *const cmd_flag_name[] = {
 	CMD_FLAG_NAME(PREFLUSH),
 	CMD_FLAG_NAME(RAHEAD),
 	CMD_FLAG_NAME(BACKGROUND),
-	CMD_FLAG_NAME(NOUNMAP),
 	CMD_FLAG_NAME(NOWAIT),
+	CMD_FLAG_NAME(NOUNMAP),
+	CMD_FLAG_NAME(HIPRI),
 };
 #undef CMD_FLAG_NAME