Skip to contentSkip to conversation

ocfs2: Use max() to improve ocfs2_dlm_seq_show()

PATCH Applied Thorsten Blum 2 participants 2 messages Aug 20, 2024 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: Use max() to improve ocfs2_dlm_seq_show()

Use the max() macro to simplify the ocfs2_dlm_seq_show() function and improve its readability.

---
 fs/ocfs2/dlmglue.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
fs/ocfs2/dlmglue.c +2 -5
index da78a04d6f0b..60df52e4c1f8 100644
@@ -3151,11 +3151,8 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
 #ifdef CONFIG_OCFS2_FS_STATS
 	if (!lockres->l_lock_wait && dlm_debug->d_filter_secs) {
 		now = ktime_to_us(ktime_get_real());
-		if (lockres->l_lock_prmode.ls_last >
-		    lockres->l_lock_exmode.ls_last)
-			last = lockres->l_lock_prmode.ls_last;
-		else
-			last = lockres->l_lock_exmode.ls_last;
+		last = max(lockres->l_lock_prmode.ls_last,
+			   lockres->l_lock_exmode.ls_last);
 		/*
 		 * Use d_filter_secs field to filter lock resources dump,
 		 * the default d_filter_secs(0) value filters nothing,
Signature · 1 line
2.46.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Thorsten Blum

Use the max() macro to simplify the ocfs2_dlm_seq_show() function and improve its readability.

Quoted 22 lines
---
 fs/ocfs2/dlmglue.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
fs/ocfs2/dlmglue.c +2 -5
index da78a04d6f0b..60df52e4c1f8 100644
@@ -3151,11 +3151,8 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
 #ifdef CONFIG_OCFS2_FS_STATS
 	if (!lockres->l_lock_wait && dlm_debug->d_filter_secs) {
 		now = ktime_to_us(ktime_get_real());
-		if (lockres->l_lock_prmode.ls_last >
-		    lockres->l_lock_exmode.ls_last)
-			last = lockres->l_lock_prmode.ls_last;
-		else
-			last = lockres->l_lock_exmode.ls_last;
+		last = max(lockres->l_lock_prmode.ls_last,
+			   lockres->l_lock_exmode.ls_last);
 		/*
 		 * Use d_filter_secs field to filter lock resources dump,
 		 * the default d_filter_secs(0) value filters nothing,