mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ocfs2: Use max() to improve ocfs2_dlm_seq_show()
@ 2024-08-20  2:16 Thorsten Blum
  2024-08-20 12:17 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-08-20  2:16 UTC (permalink / raw)
  To: mark, jlbec, joseph.qi; +Cc: ocfs2-devel, linux-kernel, Thorsten Blum

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

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 fs/ocfs2/dlmglue.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index da78a04d6f0b..60df52e4c1f8 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -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,
-- 
2.46.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ocfs2: Use max() to improve ocfs2_dlm_seq_show()
  2024-08-20  2:16 [PATCH] ocfs2: Use max() to improve ocfs2_dlm_seq_show() Thorsten Blum
@ 2024-08-20 12:17 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2024-08-20 12:17 UTC (permalink / raw)
  To: Thorsten Blum, mark, jlbec, akpm; +Cc: ocfs2-devel, linux-kernel



On 8/20/24 10:16 AM, Thorsten Blum wrote:
> Use the max() macro to simplify the ocfs2_dlm_seq_show() function and
> improve its readability.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/dlmglue.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index da78a04d6f0b..60df52e4c1f8 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -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,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-20 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20  2:16 [PATCH] ocfs2: Use max() to improve ocfs2_dlm_seq_show() Thorsten Blum
2024-08-20 12:17 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®