ocfs2: use max() to improve ocfs2_dlm_seq_show()
authorThorsten Blum <thorsten.blum@toblux.com>
Tue, 20 Aug 2024 02:16:07 +0000 (04:16 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 2 Sep 2024 03:43:38 +0000 (20:43 -0700)
Use the max() macro to simplify the ocfs2_dlm_seq_show() function and
improve its readability.

Link: https://lkml.kernel.org/r/20240820021605.97887-3-thorsten.blum@toblux.com
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/dlmglue.c

index da78a04d6f0b0eabd1fc159b309a58e46c7366ff..60df52e4c1f878f013db628588253e02af929d3e 100644 (file)
@@ -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,