Linux block layer
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: chengkaitao <pilgrimtao@gmail.com>, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	chengkaitao <chengkaitao@kylinos.cn>
Subject: Re: [PATCH] block/mq-deadline: Replace DD_PRIO_MAX with DD_PRIO_COUNT
Date: Thu, 28 Aug 2025 21:38:24 -0700	[thread overview]
Message-ID: <62c9b68f-6adc-41d8-b504-4bce4d721e64@acm.org> (raw)
In-Reply-To: <20250829015444.91369-1-pilgrimtao@gmail.com>

On 8/28/25 6:54 PM, chengkaitao wrote:
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index b9b7cdf1d3c9..1a031922c447 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -41,19 +41,16 @@ static const int fifo_batch = 16;       /* # of sequential requests treated as o
>   enum dd_data_dir {
>   	DD_READ		= READ,
>   	DD_WRITE	= WRITE,
> +	DD_DIR_COUNT	= 2
>   };
>   
> -enum { DD_DIR_COUNT = 2 };
> -

This change is not an improvement in my opinion because it makes it
less clear what the role of DD_DIR_COUNT is.

>   enum dd_prio {
> -	DD_RT_PRIO	= 0,
> -	DD_BE_PRIO	= 1,
> -	DD_IDLE_PRIO	= 2,
> -	DD_PRIO_MAX	= 2,
> +	DD_RT_PRIO,
> +	DD_BE_PRIO,
> +	DD_IDLE_PRIO,

There is code that depends on DD_RT_PRIO < DD_BE_PRIO < DD_IDLE_PRIO so 
I'd like to keep the explicit enum values.

> +	DD_PRIO_COUNT
>   };
>   
> -enum { DD_PRIO_COUNT = 3 };

I see the above change as a step backwards because it makes the role of
DD_PRIO_COUNT less clear.

> -	for (prio = DD_BE_PRIO; prio <= DD_PRIO_MAX; prio++) {
> +	for (prio = DD_BE_PRIO; prio < DD_PRIO_COUNT; prio++) {

The current code is easier to read IMHO than the new code.

Thanks,

Bart.

  reply	other threads:[~2025-08-29  4:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  1:54 [PATCH] block/mq-deadline: Replace DD_PRIO_MAX with DD_PRIO_COUNT chengkaitao
2025-08-29  4:38 ` Bart Van Assche [this message]
2025-08-29  6:19   ` Tao pilgrim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62c9b68f-6adc-41d8-b504-4bce4d721e64@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=chengkaitao@kylinos.cn \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pilgrimtao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox