[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250427082928.131295-3-yukuai1@huaweicloud.com>
Date: Sun, 27 Apr 2025 16:29:21 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: hch@...radead.org,
axboe@...nel.dk,
xni@...hat.com,
agk@...hat.com,
snitzer@...nel.org,
mpatocka@...hat.com,
song@...nel.org,
yukuai3@...wei.com,
cl@...ux.com,
nadav.amit@...il.com,
ubizjak@...il.com,
akpm@...ux-foundation.org
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
dm-devel@...ts.linux.dev,
linux-raid@...r.kernel.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com,
johnny.chenyi@...wei.com
Subject: [PATCH v2 2/9] block: reuse part_in_flight_rw for part_in_flight
From: Yu Kuai <yukuai3@...wei.com>
They are almost identical, to make code cleaner.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
block/genhd.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index c2bd86cd09de..f671d9ee00c4 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -125,21 +125,6 @@ static void part_stat_read_all(struct block_device *part,
}
}
-unsigned int part_in_flight(struct block_device *part)
-{
- unsigned int inflight = 0;
- int cpu;
-
- for_each_possible_cpu(cpu) {
- inflight += part_stat_local_read_cpu(part, in_flight[0], cpu) +
- part_stat_local_read_cpu(part, in_flight[1], cpu);
- }
- if ((int)inflight < 0)
- inflight = 0;
-
- return inflight;
-}
-
static void part_in_flight_rw(struct block_device *part,
unsigned int inflight[2])
{
@@ -157,6 +142,15 @@ static void part_in_flight_rw(struct block_device *part,
inflight[1] = 0;
}
+unsigned int part_in_flight(struct block_device *part)
+{
+ unsigned int inflight[2];
+
+ part_in_flight_rw(part, inflight);
+
+ return inflight[READ] + inflight[WRITE];
+}
+
/*
* Can be deleted altogether. Later.
*
--
2.39.2
Powered by blists - more mailing lists