aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Bo <bo.liu@linux.alibaba.com>2019-01-24 19:12:48 -0500
committerJens Axboe <axboe@kernel.dk>2019-02-08 14:42:27 -0500
commit391f552af213985d3d324c60004475759a7030c5 (patch)
treef4f2268199a07c7343b4989371140227358f51c2
parent8c772a9bfc7c07c76f4a58b58910452fbb20843b (diff)
Blk-iolatency: warn on negative inflight IO counter
This is to catch any unexpected negative value of inflight IO counter. Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-iolatency.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 1893686a9c1f..2620baa1f699 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -592,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
592 u64 now = ktime_to_ns(ktime_get()); 592 u64 now = ktime_to_ns(ktime_get());
593 bool issue_as_root = bio_issue_as_root_blkg(bio); 593 bool issue_as_root = bio_issue_as_root_blkg(bio);
594 bool enabled = false; 594 bool enabled = false;
595 int inflight = 0;
595 596
596 blkg = bio->bi_blkg; 597 blkg = bio->bi_blkg;
597 if (!blkg || !bio_flagged(bio, BIO_TRACKED)) 598 if (!blkg || !bio_flagged(bio, BIO_TRACKED))
@@ -613,7 +614,8 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
613 } 614 }
614 rqw = &iolat->rq_wait; 615 rqw = &iolat->rq_wait;
615 616
616 atomic_dec(&rqw->inflight); 617 inflight = atomic_dec_return(&rqw->inflight);
618 WARN_ON_ONCE(inflight < 0);
617 if (iolat->min_lat_nsec == 0) 619 if (iolat->min_lat_nsec == 0)
618 goto next; 620 goto next;
619 iolatency_record_time(iolat, &bio->bi_issue, now, 621 iolatency_record_time(iolat, &bio->bi_issue, now,