Linux block layer
 help / color / mirror / Atom feed
* [PATCH v2] block: remove test of incorrect io priority level
@ 2025-05-08  8:30 Aaron Lu
  2025-05-08  8:31 ` Damien Le Moal
  2025-05-08 15:06 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Aaron Lu @ 2025-05-08  8:30 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Damien Le Moal, Kexin Wei, linux-block, linux-kernel

Ever since commit eca2040972b4("scsi: block: ioprio: Clean up interface
definition"), the macro IOPRIO_PRIO_LEVEL() will mask the level value to
something between 0 and 7 so necessarily, level will always be lower than
IOPRIO_NR_LEVELS(8).

Remove this obsolete check.

Reported-by: Kexin Wei <ys.weikexin@h3c.com>
Cc: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Aaron Lu <ziqianlu@bytedance.com>
---
v2:
Address comments from Damien Le Moal, thanks.
- Rephrase changelog as suggested by Damien Le Moal;
- Remove an useless break for IOPRIO_CLASS_BE as suggested by Damien Le
  Moal.

 block/ioprio.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/block/ioprio.c b/block/ioprio.c
index 73301a261429f..f0ee2798539c0 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -46,12 +46,8 @@ int ioprio_check_cap(int ioprio)
 			 */
 			if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE))
 				return -EPERM;
-			fallthrough;
-			/* rt has prio field too */
-		case IOPRIO_CLASS_BE:
-			if (level >= IOPRIO_NR_LEVELS)
-				return -EINVAL;
 			break;
+		case IOPRIO_CLASS_BE:
 		case IOPRIO_CLASS_IDLE:
 			break;
 		case IOPRIO_CLASS_NONE:
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] block: remove test of incorrect io priority level
  2025-05-08  8:30 [PATCH v2] block: remove test of incorrect io priority level Aaron Lu
@ 2025-05-08  8:31 ` Damien Le Moal
  2025-05-08 15:06 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2025-05-08  8:31 UTC (permalink / raw)
  To: Aaron Lu, Jens Axboe; +Cc: Kexin Wei, linux-block, linux-kernel

On 5/8/25 5:30 PM, Aaron Lu wrote:
> Ever since commit eca2040972b4("scsi: block: ioprio: Clean up interface
> definition"), the macro IOPRIO_PRIO_LEVEL() will mask the level value to
> something between 0 and 7 so necessarily, level will always be lower than
> IOPRIO_NR_LEVELS(8).
> 
> Remove this obsolete check.
> 
> Reported-by: Kexin Wei <ys.weikexin@h3c.com>
> Cc: Damien Le Moal <dlemoal@kernel.org>
> Signed-off-by: Aaron Lu <ziqianlu@bytedance.com>

Looks good.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] block: remove test of incorrect io priority level
  2025-05-08  8:30 [PATCH v2] block: remove test of incorrect io priority level Aaron Lu
  2025-05-08  8:31 ` Damien Le Moal
@ 2025-05-08 15:06 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-05-08 15:06 UTC (permalink / raw)
  To: Aaron Lu; +Cc: Damien Le Moal, Kexin Wei, linux-block, linux-kernel


On Thu, 08 May 2025 16:30:36 +0800, Aaron Lu wrote:
> Ever since commit eca2040972b4("scsi: block: ioprio: Clean up interface
> definition"), the macro IOPRIO_PRIO_LEVEL() will mask the level value to
> something between 0 and 7 so necessarily, level will always be lower than
> IOPRIO_NR_LEVELS(8).
> 
> Remove this obsolete check.
> 
> [...]

Applied, thanks!

[1/1] block: remove test of incorrect io priority level
      (no commit info)

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-08 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08  8:30 [PATCH v2] block: remove test of incorrect io priority level Aaron Lu
2025-05-08  8:31 ` Damien Le Moal
2025-05-08 15:06 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox