diff options
| author | Yu Kuai <yukuai3@huawei.com> | 2025-05-06 20:48:55 +0800 |
|---|---|---|
| committer | Yu Kuai <yukuai3@huawei.com> | 2025-05-10 16:05:38 +0800 |
| commit | 5b8f19aee47414b4cf76b6ea0310b2937ebb97e7 (patch) | |
| tree | 49cbdedd7eb5e05c58b098d9c0418966b7b9f6eb /block/genhd.c | |
| parent | blk-mq: remove blk_mq_in_flight() (diff) | |
| download | linux-5b8f19aee47414b4cf76b6ea0310b2937ebb97e7.tar.gz linux-5b8f19aee47414b4cf76b6ea0310b2937ebb97e7.zip | |
block: reuse part_in_flight_rw for part_in_flight
They are almost identical, to make code cleaner.
Link: https://lore.kernel.org/linux-raid/20250506124903.2540268-2-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'block/genhd.c')
| -rw-r--r-- | block/genhd.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/block/genhd.c b/block/genhd.c index 9c7c657380db..1df776e4ef92 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. * |
