Skip to content

Commit b2f609e

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: move the blk-mq calls out of part_in_flight{,_rw}
Don't bother to call part_in_flight / part_in_flight_rw on blk-mq devices, just call the blk-mq versions directly. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f1394b7 commit b2f609e

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎block/genhd.c‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,9 @@ void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, int rw)
142142
static unsigned int part_in_flight(struct request_queue *q,
143143
struct hd_struct *part)
144144
{
145+
unsigned int inflight = 0;
145146
int cpu;
146-
unsigned int inflight;
147-
148-
if (queue_is_mq(q)) {
149-
return blk_mq_in_flight(q, part);
150-
}
151147

152-
inflight = 0;
153148
for_each_possible_cpu(cpu) {
154149
inflight += part_stat_local_read_cpu(part, in_flight[0], cpu) +
155150
part_stat_local_read_cpu(part, in_flight[1], cpu);
@@ -165,11 +160,6 @@ static void part_in_flight_rw(struct request_queue *q, struct hd_struct *part,
165160
{
166161
int cpu;
167162

168-
if (queue_is_mq(q)) {
169-
blk_mq_in_flight_rw(q, part, inflight);
170-
return;
171-
}
172-
173163
inflight[0] = 0;
174164
inflight[1] = 0;
175165
for_each_possible_cpu(cpu) {
@@ -1307,7 +1297,10 @@ ssize_t part_stat_show(struct device *dev,
13071297
unsigned int inflight;
13081298

13091299
part_stat_read_all(p, &stat);
1310-
inflight = part_in_flight(q, p);
1300+
if (queue_is_mq(q))
1301+
inflight = blk_mq_in_flight(q, p);
1302+
else
1303+
inflight = part_in_flight(q, p);
13111304

13121305
return sprintf(buf,
13131306
"%8lu %8lu %8llu %8u "
@@ -1346,7 +1339,11 @@ ssize_t part_inflight_show(struct device *dev, struct device_attribute *attr,
13461339
struct request_queue *q = part_to_disk(p)->queue;
13471340
unsigned int inflight[2];
13481341

1349-
part_in_flight_rw(q, p, inflight);
1342+
if (queue_is_mq(q))
1343+
blk_mq_in_flight_rw(q, p, inflight);
1344+
else
1345+
part_in_flight_rw(q, p, inflight);
1346+
13501347
return sprintf(buf, "%8u %8u\n", inflight[0], inflight[1]);
13511348
}
13521349

@@ -1601,7 +1598,10 @@ static int diskstats_show(struct seq_file *seqf, void *v)
16011598
disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0);
16021599
while ((hd = disk_part_iter_next(&piter))) {
16031600
part_stat_read_all(hd, &stat);
1604-
inflight = part_in_flight(gp->queue, hd);
1601+
if (queue_is_mq(gp->queue))
1602+
inflight = blk_mq_in_flight(gp->queue, hd);
1603+
else
1604+
inflight = part_in_flight(gp->queue, hd);
16051605

16061606
seq_printf(seqf, "%4d %7d %s "
16071607
"%lu %lu %lu %u "

0 commit comments

Comments
 (0)