]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - block/blk-throttle.c
compat_ioctl: block: handle Persistent Reservations
[mirror_ubuntu-bionic-kernel.git] / block / blk-throttle.c
index 825bc29767e6699ac85675d319a9866b70cc9b84..df1a741f1a1c7d760f5c97d4d71fd681d1aa1e96 100644 (file)
@@ -892,13 +892,10 @@ static bool tg_with_in_iops_limit(struct throtl_grp *tg, struct bio *bio,
        unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;
        u64 tmp;
 
-       jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw];
-
-       /* Slice has just started. Consider one slice interval */
-       if (!jiffy_elapsed)
-               jiffy_elapsed_rnd = tg->td->throtl_slice;
+       jiffy_elapsed = jiffies - tg->slice_start[rw];
 
-       jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice);
+       /* Round up to the next throttle slice, wait time must be nonzero */
+       jiffy_elapsed_rnd = roundup(jiffy_elapsed + 1, tg->td->throtl_slice);
 
        /*
         * jiffy_elapsed_rnd should not be a big value as minimum iops can be
@@ -2226,13 +2223,7 @@ again:
 out_unlock:
        spin_unlock_irq(q->queue_lock);
 out:
-       /*
-        * As multiple blk-throtls may stack in the same issue path, we
-        * don't want bios to leave with the flag set.  Clear the flag if
-        * being issued.
-        */
-       if (!throttled)
-               bio_clear_flag(bio, BIO_THROTTLED);
+       bio_set_flag(bio, BIO_THROTTLED);
 
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
        if (throttled || !td->track_bio_latency)