Skip to content

Commit 5b8f19a

Browse files
committed
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>
1 parent c151919 commit 5b8f19a

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

block/genhd.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,6 @@ static void part_stat_read_all(struct block_device *part,
125125
}
126126
}
127127

128-
unsigned int part_in_flight(struct block_device *part)
129-
{
130-
unsigned int inflight = 0;
131-
int cpu;
132-
133-
for_each_possible_cpu(cpu) {
134-
inflight += part_stat_local_read_cpu(part, in_flight[0], cpu) +
135-
part_stat_local_read_cpu(part, in_flight[1], cpu);
136-
}
137-
if ((int)inflight < 0)
138-
inflight = 0;
139-
140-
return inflight;
141-
}
142-
143128
static void part_in_flight_rw(struct block_device *part,
144129
unsigned int inflight[2])
145130
{
@@ -157,6 +142,15 @@ static void part_in_flight_rw(struct block_device *part,
157142
inflight[1] = 0;
158143
}
159144

145+
unsigned int part_in_flight(struct block_device *part)
146+
{
147+
unsigned int inflight[2];
148+
149+
part_in_flight_rw(part, inflight);
150+
151+
return inflight[READ] + inflight[WRITE];
152+
}
153+
160154
/*
161155
* Can be deleted altogether. Later.
162156
*

0 commit comments

Comments
 (0)