aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-throttle.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 8c6e13359781..52321a42cd78 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1239,12 +1239,16 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
1239 1239
1240 sq = &tg->service_queue; 1240 sq = &tg->service_queue;
1241 1241
1242 /* throtl is FIFO - if other bios are already queued, should queue */ 1242 while (true) {
1243 if (sq->nr_queued[rw]) 1243 /* throtl is FIFO - if bios are already queued, should queue */
1244 goto queue_bio; 1244 if (sq->nr_queued[rw])
1245 break;
1245 1246
1246 /* Bio is with-in rate limit of group */ 1247 /* if above limits, break to queue */
1247 if (tg_may_dispatch(tg, bio, NULL)) { 1248 if (!tg_may_dispatch(tg, bio, NULL))
1249 break;
1250
1251 /* within limits, let's charge and dispatch directly */
1248 throtl_charge_bio(tg, bio); 1252 throtl_charge_bio(tg, bio);
1249 1253
1250 /* 1254 /*
@@ -1259,10 +1263,19 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
1259 * So keep on trimming slice even if bio is not queued. 1263 * So keep on trimming slice even if bio is not queued.
1260 */ 1264 */
1261 throtl_trim_slice(tg, rw); 1265 throtl_trim_slice(tg, rw);
1262 goto out_unlock; 1266
1267 /*
1268 * @bio passed through this layer without being throttled.
1269 * Climb up the ladder. If we''re already at the top, it
1270 * can be executed directly.
1271 */
1272 sq = sq->parent_sq;
1273 tg = sq_to_tg(sq);
1274 if (!tg)
1275 goto out_unlock;
1263 } 1276 }
1264 1277
1265queue_bio: 1278 /* out-of-limit, queue to @tg */
1266 throtl_log(sq, "[%c] bio. bdisp=%llu sz=%u bps=%llu iodisp=%u iops=%u queued=%d/%d", 1279 throtl_log(sq, "[%c] bio. bdisp=%llu sz=%u bps=%llu iodisp=%u iops=%u queued=%d/%d",
1267 rw == READ ? 'R' : 'W', 1280 rw == READ ? 'R' : 'W',
1268 tg->bytes_disp[rw], bio->bi_size, tg->bps[rw], 1281 tg->bytes_disp[rw], bio->bi_size, tg->bps[rw],