block: merge part_{inc,dev}_in_flight into their only callers
authorChristoph Hellwig <hch@lst.de>
Wed, 13 May 2020 10:49:35 +0000 (12:49 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 19 May 2020 15:35:24 +0000 (09:35 -0600)
part_inc_in_flight and part_dec_in_flight only have one caller each, and
those callers are purely for bio based drivers.  Merge each function into
the only caller, and remove the superflous blk-mq checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c
block/blk.h
block/genhd.c

index 1594804fe8bcf9ed697327cb97c67b8ddc548849..9c101a0572ca2845509dc20b64ac09798f6c57fc 100644 (file)
@@ -1396,13 +1396,16 @@ void generic_start_io_acct(struct request_queue *q, int op,
                           unsigned long sectors, struct hd_struct *part)
 {
        const int sgrp = op_stat_group(op);
+       int rw = op_is_write(op);
 
        part_stat_lock();
 
        update_io_ticks(part, jiffies, false);
        part_stat_inc(part, ios[sgrp]);
        part_stat_add(part, sectors[sgrp], sectors);
-       part_inc_in_flight(q, part, op_is_write(op));
+       part_stat_local_inc(part, in_flight[rw]);
+       if (part->partno)
+               part_stat_local_inc(&part_to_disk(part)->part0, in_flight[rw]);
 
        part_stat_unlock();
 }
@@ -1414,12 +1417,15 @@ void generic_end_io_acct(struct request_queue *q, int req_op,
        unsigned long now = jiffies;
        unsigned long duration = now - start_time;
        const int sgrp = op_stat_group(req_op);
+       int rw = op_is_write(req_op);
 
        part_stat_lock();
 
        update_io_ticks(part, now, true);
        part_stat_add(part, nsecs[sgrp], jiffies_to_nsecs(duration));
-       part_dec_in_flight(q, part, op_is_write(req_op));
+       part_stat_local_dec(part, in_flight[rw]);
+       if (part->partno)
+               part_stat_local_dec(&part_to_disk(part)->part0, in_flight[rw]);
 
        part_stat_unlock();
 }
index eb09216b533a05ceb8d2ce9b5f5a203f8b0898a9..af11fd400c72c8555142ff789fc6085c5a128796 100644 (file)
@@ -345,10 +345,6 @@ void blk_queue_free_zone_bitmaps(struct request_queue *q);
 static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {}
 #endif
 
-void part_dec_in_flight(struct request_queue *q, struct hd_struct *part,
-                       int rw);
-void part_inc_in_flight(struct request_queue *q, struct hd_struct *part,
-                       int rw);
 void update_io_ticks(struct hd_struct *part, unsigned long now, bool end);
 struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector);
 
index 56e0560738c49505fc4114e1c031cd16f1cf2cd6..094ed9096496427d636600ec3b4c0588d6d6a417 100644 (file)
@@ -119,26 +119,6 @@ static void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat)
 }
 #endif /* CONFIG_SMP */
 
-void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, int rw)
-{
-       if (queue_is_mq(q))
-               return;
-
-       part_stat_local_inc(part, in_flight[rw]);
-       if (part->partno)
-               part_stat_local_inc(&part_to_disk(part)->part0, in_flight[rw]);
-}
-
-void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, int rw)
-{
-       if (queue_is_mq(q))
-               return;
-
-       part_stat_local_dec(part, in_flight[rw]);
-       if (part->partno)
-               part_stat_local_dec(&part_to_disk(part)->part0, in_flight[rw]);
-}
-
 static unsigned int part_in_flight(struct request_queue *q,
                struct hd_struct *part)
 {