X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=block%2Fblk-throttle.c;h=a3ea8260c94c89236f938fb255158be8cb880a73;hb=8c4b172123c08a7138ee01675c130c83f9c1117c;hp=47a3e540631a38b123a078350d28ae457753ebbd;hpb=1b2d8b94c8781adfb1eeb9cd1cbe23fab601519a;p=cascardo%2Flinux.git diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 47a3e540631a..a3ea8260c94c 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -145,11 +145,6 @@ struct throtl_data /* Total Number of queued bios on READ and WRITE lists */ unsigned int nr_queued[2]; - /* - * number of total undestroyed groups - */ - unsigned int nr_undestroyed_grps; - /* Work for dispatching throttled bios */ struct work_struct dispatch_work; }; @@ -785,9 +780,11 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio, /* * If previous slice expired, start a new one otherwise renew/extend * existing slice to make sure it is at least throtl_slice interval - * long since now. + * long since now. New slice is started only for empty throttle group. + * If there is queued bio, that means there should be an active + * slice and it should be extended instead. */ - if (throtl_slice_used(tg, rw)) + if (throtl_slice_used(tg, rw) && !(tg->service_queue.nr_queued[rw])) throtl_start_new_slice(tg, rw); else { if (time_before(tg->slice_end[rw], jiffies + throtl_slice)) @@ -826,8 +823,8 @@ static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio) * second time when it eventually gets issued. Set it when a bio * is being charged to a tg. */ - if (!(bio->bi_rw & REQ_THROTTLED)) - bio->bi_rw |= REQ_THROTTLED; + if (!(bio->bi_opf & REQ_THROTTLED)) + bio->bi_opf |= REQ_THROTTLED; } /** @@ -1404,7 +1401,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, WARN_ON_ONCE(!rcu_read_lock_held()); /* see throtl_charge_bio() */ - if ((bio->bi_rw & REQ_THROTTLED) || !tg->has_rules[rw]) + if ((bio->bi_opf & REQ_THROTTLED) || !tg->has_rules[rw]) goto out; spin_lock_irq(q->queue_lock); @@ -1483,7 +1480,7 @@ out: * being issued. */ if (!throttled) - bio->bi_rw &= ~REQ_THROTTLED; + bio->bi_opf &= ~REQ_THROTTLED; return throttled; }