[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250903121405.386483-1-liaoyuanhong@vivo.com>
Date: Wed, 3 Sep 2025 20:14:05 +0800
From: Liao Yuanhong <liaoyuanhong@...o.com>
To: Jens Axboe <axboe@...nel.dk>,
linux-block@...r.kernel.org (open list:BLOCK LAYER),
linux-kernel@...r.kernel.org (open list)
Cc: Liao Yuanhong <liaoyuanhong@...o.com>
Subject: [PATCH] elevator: avoid redundant conditions
While 'if (i < 0) ... else if (i >= 0) ...' is technically equivalent to
'if (i < 0) ... else ...', the latter is vastly easier to read because
it avoids writing out a condition that is unnecessary. Let's drop such
unnecessary conditions.
Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
---
block/elevator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/elevator.c b/block/elevator.c
index fe96c6f4753c..3828c35f5753 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -240,7 +240,7 @@ void elv_rb_add(struct rb_root *root, struct request *rq)
if (blk_rq_pos(rq) < blk_rq_pos(__rq))
p = &(*p)->rb_left;
- else if (blk_rq_pos(rq) >= blk_rq_pos(__rq))
+ else
p = &(*p)->rb_right;
}
--
2.34.1
Powered by blists - more mailing lists