Re: [PATCH] block/mq-deadline: Replace DD_PRIO_MAX with DD_PRIO_COUNT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux