linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: genhd: use max() to improve inflight IO counting code
@ 2025-08-08 12:28 Akhilesh Patil
  0 siblings, 0 replies; only message in thread
From: Akhilesh Patil @ 2025-08-08 12:28 UTC (permalink / raw)
  To: axboe, hare, hch, john.g.garry, yukuai3
  Cc: yi.zhang, calvin, david, yukuai1, yi.zhang, yangerkun,
	johnny.chenyi, linux-block, linux-kernel, akhileshpatilvnit,
	skhan

Use max() macro in bdev_count_inflight_rw() while populating buffer of
read/write inflight block IO count. Use standard macro to
simplify the code without impacting functionality.

Fixes: c007062188d8 ("block: fix false warning in bdev_count_inflight_rw()")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202506272336.CvAqaAxB-lkp@intel.com/
Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
---
 block/genhd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index c26733f6324b..af74cb80eadb 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -147,8 +147,8 @@ static void bdev_count_inflight_rw(struct block_device *part,
 	 * traversed and complete on a CPU that has not yet been traversed,
 	 * causing the inflight number to be negative.
 	 */
-	inflight[READ] = read > 0 ? read : 0;
-	inflight[WRITE] = write > 0 ? write : 0;
+	inflight[READ] = max(read, 0);
+	inflight[WRITE] = max(write, 0);
 }
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-08 12:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 12:28 [PATCH] block: genhd: use max() to improve inflight IO counting code Akhilesh Patil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).