ext4: use time_is_before_jiffies() instead of open coding it
authorWang Qing <wangqing@vivo.com>
Mon, 28 Feb 2022 03:15:20 +0000 (19:15 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 3 Mar 2022 04:50:02 +0000 (23:50 -0500)
Use the helper function time_is_{before,after}_jiffies() to improve
code readability.

Signed-off-by: Wang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1646018120-61462-1-git-send-email-wangqing@vivo.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/resize.c

index f507f34..90a941d 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <linux/errno.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 
 #include "ext4_jbd2.h"
 
@@ -2100,7 +2101,7 @@ retry:
         */
        while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count,
                                              flexbg_size)) {
-               if (jiffies - last_update_time > HZ * 10) {
+               if (time_is_before_jiffies(last_update_time + HZ * 10)) {
                        if (last_update_time)
                                ext4_msg(sb, KERN_INFO,
                                         "resized to %llu blocks",