[11/11] blk-throttle: Use more siutable time_after check for update slice_start

Message ID 20221123060401.20392-12-shikemeng@huawei.com
State New
Headers
Series A few bugfix and cleanup patches for blk-throttle |

Commit Message

Kemeng Shi Nov. 23, 2022, 6:04 a.m. UTC
  Use more siutable time_after check for update slice_start

Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
---
 block/blk-throttle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tejun Heo Nov. 23, 2022, 6:29 p.m. UTC | #1
On Wed, Nov 23, 2022 at 02:04:01PM +0800, Kemeng Shi wrote:
> Use more siutable time_after check for update slice_start

Why is it more suitable?
  
Kemeng Shi Nov. 24, 2022, 1:02 p.m. UTC | #2
on 11/24/2022 2:29 AM, Tejun Heo wrote:
> On Wed, Nov 23, 2022 at 02:04:01PM +0800, Kemeng Shi wrote:
>> Use more siutable time_after check for update slice_start
> 
> Why is it more suitable?
There is no need to assign tg->slice_start[rw] to start when they are
equal already. So time_after seems more suitable here.
  

Patch

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 82fe23e79b4b..69eeff764dee 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -635,7 +635,7 @@  static inline void throtl_start_new_slice_with_credit(struct throtl_grp *tg,
 	 * that bandwidth. Do try to make use of that bandwidth while giving
 	 * credit.
 	 */
-	if (time_after_eq(start, tg->slice_start[rw]))
+	if (time_after(start, tg->slice_start[rw]))
 		tg->slice_start[rw] = start;
 
 	tg->slice_end[rw] = jiffies + tg->td->throtl_slice;