ocfs2: use str_yes_no() and str_no_yes() helper functions
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 17 Jan 2025 09:13:29 +0000 (10:13 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 25 Jan 2025 06:47:28 +0000 (22:47 -0800)
Remove hard-coded strings by using the str_yes_no() and str_no_yes()
helper functions.

Link: https://lkml.kernel.org/r/20250117091335.1189-2-thorsten.blum@linux.dev
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
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: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/dlm/dlmdebug.c
fs/ocfs2/dlm/dlmmaster.c
fs/ocfs2/dlm/dlmrecovery.c
fs/ocfs2/dlmglue.c

index e9ef4e2b0e7529bd403bc1c2a6884a73a7d264b8..fe4fdd09bae3984adb869979f7d5f24b8488cc03 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/spinlock.h>
 #include <linux/debugfs.h>
 #include <linux/export.h>
+#include <linux/string_choices.h>
 
 #include "../cluster/heartbeat.h"
 #include "../cluster/nodemanager.h"
@@ -90,12 +91,12 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
               buf, res->owner, res->state);
        printk("  last used: %lu, refcnt: %u, on purge list: %s\n",
               res->last_used, kref_read(&res->refs),
-              list_empty(&res->purge) ? "no" : "yes");
+              str_no_yes(list_empty(&res->purge)));
        printk("  on dirty list: %s, on reco list: %s, "
               "migrating pending: %s\n",
-              list_empty(&res->dirty) ? "no" : "yes",
-              list_empty(&res->recovering) ? "no" : "yes",
-              res->migration_pending ? "yes" : "no");
+              str_no_yes(list_empty(&res->dirty)),
+              str_no_yes(list_empty(&res->recovering)),
+              str_yes_no(res->migration_pending));
        printk("  inflight locks: %d, asts reserved: %d\n",
               res->inflight_locks, atomic_read(&res->asts_reserved));
        dlm_print_lockres_refmap(res);
index d610da8e2f247b1dd6db828734da5d5859b11eac..86bb1a03bcc115208416d9df5068463c275c6439 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/inet.h>
 #include <linux/spinlock.h>
 #include <linux/delay.h>
-
+#include <linux/string_choices.h>
 
 #include "../cluster/heartbeat.h"
 #include "../cluster/nodemanager.h"
@@ -2859,7 +2859,7 @@ static int dlm_mark_lockres_migrating(struct dlm_ctxt *dlm,
        dlm_lockres_release_ast(dlm, res);
 
        mlog(0, "about to wait on migration_wq, dirty=%s\n",
-              res->state & DLM_LOCK_RES_DIRTY ? "yes" : "no");
+              str_yes_no(res->state & DLM_LOCK_RES_DIRTY));
        /* if the extra ref we just put was the final one, this
         * will pass thru immediately.  otherwise, we need to wait
         * for the last ast to finish. */
@@ -2869,12 +2869,12 @@ again:
                   msecs_to_jiffies(1000));
        if (ret < 0) {
                mlog(0, "woken again: migrating? %s, dead? %s\n",
-                      res->state & DLM_LOCK_RES_MIGRATING ? "yes":"no",
-                      test_bit(target, dlm->domain_map) ? "no":"yes");
+                      str_yes_no(res->state & DLM_LOCK_RES_MIGRATING),
+                      str_no_yes(test_bit(target, dlm->domain_map)));
        } else {
                mlog(0, "all is well: migrating? %s, dead? %s\n",
-                      res->state & DLM_LOCK_RES_MIGRATING ? "yes":"no",
-                      test_bit(target, dlm->domain_map) ? "no":"yes");
+                      str_yes_no(res->state & DLM_LOCK_RES_MIGRATING),
+                      str_no_yes(test_bit(target, dlm->domain_map)));
        }
        if (!dlm_migration_can_proceed(dlm, res, target)) {
                mlog(0, "trying again...\n");
index 54c548ef037a3b8b09ac6de28ee0c1fb97171d98..67fc62a49a7615b9834b1bd77be00414eb009f8b 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/timer.h>
 #include <linux/kthread.h>
 #include <linux/delay.h>
-
+#include <linux/string_choices.h>
 
 #include "../cluster/heartbeat.h"
 #include "../cluster/nodemanager.h"
@@ -581,8 +581,7 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node)
                                                           msecs_to_jiffies(1000));
                                        mlog(0, "waited 1 sec for %u, "
                                             "dead? %s\n", ndata->node_num,
-                                            dlm_is_node_dead(dlm, ndata->node_num) ?
-                                            "yes" : "no");
+                                            str_yes_no(dlm_is_node_dead(dlm, ndata->node_num)));
                                } else {
                                        /* -ENOMEM on the other node */
                                        mlog(0, "%s: node %u returned "
@@ -677,7 +676,7 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node)
                spin_unlock(&dlm_reco_state_lock);
 
                mlog(0, "pass #%d, all_nodes_done?: %s\n", ++pass,
-                    all_nodes_done?"yes":"no");
+                    str_yes_no(all_nodes_done));
                if (all_nodes_done) {
                        int ret;
 
index c9b62a6d867355f1850fa7ac66280f5faaf1510d..92a6149da9c102c39227b8785c5d78c1e999fb79 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/quotaops.h>
 #include <linux/sched/signal.h>
+#include <linux/string_choices.h>
 
 #define MLOG_MASK_PREFIX ML_DLM_GLUE
 #include <cluster/masklog.h>
@@ -4337,7 +4338,7 @@ unqueue:
                ocfs2_schedule_blocked_lock(osb, lockres);
 
        mlog(ML_BASTS, "lockres %s, requeue = %s.\n", lockres->l_name,
-            ctl.requeue ? "yes" : "no");
+            str_yes_no(ctl.requeue));
        spin_unlock_irqrestore(&lockres->l_lock, flags);
 
        if (ctl.unblock_action != UNBLOCK_CONTINUE