]> www.infradead.org Git - users/hch/block.git/commitdiff
blk-mq: do not include passthrough requests in I/O accounting
authorChristoph Hellwig <hch@lst.de>
Fri, 18 Feb 2022 08:08:32 +0000 (09:08 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 2 Mar 2022 14:44:39 +0000 (16:44 +0200)
I/O accounting buckets I/O into the read/write/discard categories into
which passthrough I/O does not fit at all.  It also accounts to the
block_device, which may not even exist for passthrough I/O.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/blk-mq.c
block/blk.h

index f1b067d06ab51ddc80ca87f4294082f56acd348b..2204affde9b0bb906f7fbf443a8028a67f627511 100644 (file)
@@ -887,11 +887,7 @@ static inline void blk_account_io_done(struct request *req, u64 now)
 
 static void __blk_account_io_start(struct request *rq)
 {
-       /* passthrough requests can hold bios that do not have ->bi_bdev set */
-       if (rq->bio && rq->bio->bi_bdev)
-               rq->part = rq->bio->bi_bdev;
-       else if (rq->q->disk)
-               rq->part = rq->q->disk->part0;
+       rq->part = rq->bio->bi_bdev;
 
        part_stat_lock();
        update_io_ticks(rq->part, jiffies, false);
index ebaa59ca46ca635a35afc5a03bc07ac81d44667d..6f21859c7f0ff21cfdea99faf9bfe21984bd13c6 100644 (file)
@@ -325,7 +325,7 @@ int blk_dev_init(void);
  */
 static inline bool blk_do_io_stat(struct request *rq)
 {
-       return (rq->rq_flags & RQF_IO_STAT) && rq->q->disk;
+       return (rq->rq_flags & RQF_IO_STAT) && !blk_rq_is_passthrough(rq);
 }
 
 void update_io_ticks(struct block_device *part, unsigned long now, bool end);