Skip to contentSkip to conversation

ceph: Convert to use jiffies macro

PATCH Superseded Chen Yufan 2 participants 2 messages Aug 22, 2024 – Aug 23, 2024 Ceph client

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chen Yufan

author
#0 lore raw

PATCH v2 1/1 ceph: Convert to use jiffies macro

Use time_after_eq macro instead of using
jiffies directly to handle wraparound.
The modifications made compared to the previous version are as follows:
1. Remove extra '+' in the header.

---
 fs/ceph/caps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/caps.c +2 -1
index 808c9c048..6a55825c3 100644
@@ -17,6 +17,7 @@
 #include "crypto.h"
 #include <linux/ceph/decode.h>
 #include <linux/ceph/messenger.h>
+#include <linux/jiffies.h>
 
 /*
  * Capability management
@@ -4659,7 +4660,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
 		 * slowness doesn't block mdsc delayed work,
 		 * preventing send_renew_caps() from running.
 		 */
-		if (jiffies - loop_start >= 5 * HZ)
+		if (time_after_eq(jiffies, loop_start + 5 * HZ))
 			break;
 	}
 	spin_unlock(&mdsc->cap_delay_lock);
Signature · 1 line
2.39.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 23 lines · Chen Yufan

Use time_after_eq macro instead of using
jiffies directly to handle wraparound.
The modifications made compared to the previous version are as follows:
1. Remove extra '+' in the header.

---
  fs/ceph/caps.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/caps.c +1 -0
index 808c9c048..6a55825c3 100644
@@ -17,6 +17,7 @@
  #include "crypto.h"
  #include <linux/ceph/decode.h>
  #include <linux/ceph/messenger.h>
+#include <linux/jiffies.h>
 
  /*
   * Capability management

fs/ceph/caps.c unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc) · line 4666

Quoted 8 lines
fs/ceph/caps.c +1 -1
@@ -4659,7 +4660,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
  		 * slowness doesn't block mdsc delayed work,
  		 * preventing send_renew_caps() from running.
  		 */
-		if (jiffies - loop_start >= 5 * HZ)
+		if (time_after_eq(jiffies, loop_start + 5 * HZ))
  			break;
  	}
  	spin_unlock(&mdsc->cap_delay_lock);

Hi Yufan,

Thanks for your patch and this LGTM.

Will apply to the 'testing' branch with an adjustment of the header files order.

Thanks

- Xiubo