diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 3e064438082e64f4eafbda325e83f711cbc9593b..bd5479d8a5612b54be604caedb2f72eadbae2541 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2324,6 +2324,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, struct throtl_service_queue *sq; bool rw = bio_data_dir(bio); bool throttled = false; + bool has_rules = tg->has_rules[rw]; struct throtl_data *td = tg->td; WARN_ON_ONCE(!rcu_read_lock_held()); @@ -2332,11 +2333,11 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, if (bio_flagged(bio, BIO_THROTTLED)) goto out; - throtl_bio_stats_start(bio, tg); - - if (!tg->has_rules[rw]) + if (!has_rules) goto out; + throtl_bio_stats_start(bio, tg); + spin_lock_irq(q->queue_lock); throtl_update_latency_buckets(td); @@ -2435,7 +2436,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, out_unlock: spin_unlock_irq(q->queue_lock); out: - if (!throttled) + if (!throttled && has_rules) bio_set_io_start_time_ns(bio); bio_set_flag(bio, BIO_THROTTLED);