@@ -741,12 +741,16 @@ static void throtl_charge_bps_bio(struct throtl_grp *tg, struct bio *bio)
unsigned int bio_size = throtl_bio_data_size(bio);
/* Charge the bio to the group */
- if (!bio_flagged(bio, BIO_BPS_THROTTLED))
+ if (!bio_flagged(bio, BIO_BPS_THROTTLED) &&
+ !bio_flagged(bio, BIO_TG_BPS_THROTTLED)) {
+ bio_set_flag(bio, BIO_TG_BPS_THROTTLED);
tg->bytes_disp[bio_data_dir(bio)] += bio_size;
+ }
}
static void throtl_charge_iops_bio(struct throtl_grp *tg, struct bio *bio)
{
+ bio_clear_flag(bio, BIO_TG_BPS_THROTTLED);
tg->io_disp[bio_data_dir(bio)]++;
}
@@ -772,7 +776,8 @@ static unsigned long tg_dispatch_bps_time(struct throtl_grp *tg, struct bio *bio
/* no need to throttle if this bio's bytes have been accounted */
if (bps_limit == U64_MAX || tg->flags & THROTL_TG_CANCELING ||
- bio_flagged(bio, BIO_BPS_THROTTLED))
+ bio_flagged(bio, BIO_BPS_THROTTLED) ||
+ bio_flagged(bio, BIO_TG_BPS_THROTTLED))
return 0;
tg_update_slice(tg, rw);
@@ -296,6 +296,11 @@ enum {
* of this bio. */
BIO_CGROUP_ACCT, /* has been accounted to a cgroup */
BIO_QOS_THROTTLED, /* bio went through rq_qos throttle path */
+ /*
+ * This bio has undergone rate limiting at the single throtl_grp level bps
+ * queue. Since throttle and QoS are not at the same level, reuse the value.
+ */
+ BIO_TG_BPS_THROTTLED = BIO_QOS_THROTTLED,
BIO_QOS_MERGED, /* but went through rq_qos merge path */
BIO_REMAPPED,
BIO_ZONE_WRITE_PLUGGING, /* bio handled through zone write plugging */