block: don't try to throttle split bio if iops limit isn't set
[linux-2.6-microblaze.git] / block / blk-throttle.h
index cb43f44..c996a15 100644 (file)
@@ -52,6 +52,12 @@ struct throtl_service_queue {
        struct timer_list       pending_timer;  /* fires on first_pending_disptime */
 };
 
+enum tg_state_flags {
+       THROTL_TG_PENDING       = 1 << 0,       /* on parent's pending tree */
+       THROTL_TG_WAS_EMPTY     = 1 << 1,       /* bio_lists[] became non-empty */
+       THROTL_TG_HAS_IOPS_LIMIT = 1 << 2,      /* tg has iops limit */
+};
+
 enum {
        LIMIT_LOW,
        LIMIT_MAX,
@@ -170,6 +176,11 @@ static inline bool blk_throtl_bio(struct bio *bio)
 {
        struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg);
 
+       /* no need to throttle bps any more if the bio has been throttled */
+       if (bio_flagged(bio, BIO_THROTTLED) &&
+           !(tg->flags & THROTL_TG_HAS_IOPS_LIMIT))
+               return false;
+
        if (!tg->has_rules[bio_data_dir(bio)])
                return false;