blk-iolatency: only account submitted bios
authorDennis Zhou <dennis@kernel.org>
Thu, 23 May 2019 20:10:18 +0000 (16:10 -0400)
committerJens Axboe <axboe@kernel.dk>
Thu, 20 Jun 2019 09:29:56 +0000 (03:29 -0600)
As is, iolatency recognizes done_bio and cleanup as ending paths. If a
request is marked REQ_NOWAIT and fails to get a request, the bio is
cleaned up via rq_qos_cleanup() and ended in bio_wouldblock_error().
This results in underflowing the inflight counter. Fix this by only
accounting bios that were actually submitted.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iolatency.c

index 17896bb3aaf28da2b3440a537305ba3d0ad2133d..e8859350ab6ea0b25def8a76b5f99ea3db404405 100644 (file)
@@ -600,6 +600,10 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
        if (!blkg || !bio_flagged(bio, BIO_TRACKED))
                return;
 
+       /* We didn't actually submit this bio, don't account it. */
+       if (bio->bi_status == BLK_STS_AGAIN)
+               return;
+
        iolat = blkg_to_lat(bio->bi_blkg);
        if (!iolat)
                return;