Commit 391f552a authored by Liu Bo's avatar Liu Bo Committed by Jens Axboe

Blk-iolatency: warn on negative inflight IO counter

This is to catch any unexpected negative value of inflight IO counter.
Signed-off-by: default avatarLiu Bo <bo.liu@linux.alibaba.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8c772a9b
...@@ -592,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) ...@@ -592,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
u64 now = ktime_to_ns(ktime_get()); u64 now = ktime_to_ns(ktime_get());
bool issue_as_root = bio_issue_as_root_blkg(bio); bool issue_as_root = bio_issue_as_root_blkg(bio);
bool enabled = false; bool enabled = false;
int inflight = 0;
blkg = bio->bi_blkg; blkg = bio->bi_blkg;
if (!blkg || !bio_flagged(bio, BIO_TRACKED)) 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,7 +614,8 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
} }
rqw = &iolat->rq_wait; rqw = &iolat->rq_wait;
atomic_dec(&rqw->inflight); inflight = atomic_dec_return(&rqw->inflight);
WARN_ON_ONCE(inflight < 0);
if (iolat->min_lat_nsec == 0) if (iolat->min_lat_nsec == 0)
goto next; goto next;
iolatency_record_time(iolat, &bio->bi_issue, now, iolatency_record_time(iolat, &bio->bi_issue, now,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment