dlm: move global to static inits
authorAlexander Aring <aahringo@redhat.com>
Mon, 4 Apr 2022 20:06:36 +0000 (16:06 -0400)
committerDavid Teigland <teigland@redhat.com>
Wed, 6 Apr 2022 19:02:16 +0000 (14:02 -0500)
Instead of init global module at module loading time we can move the
initialization of those global variables at memory initialization of the
module loader.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/plock.c

index ff439d780cb1d6cd4c16d117d778081edb723e17..16241fe6ac3ce773c4511bec7e3ab390ca4a14a5 100644 (file)
 #include "dlm_internal.h"
 #include "lockspace.h"
 
-static spinlock_t ops_lock;
-static struct list_head send_list;
-static struct list_head recv_list;
-static wait_queue_head_t send_wq;
-static wait_queue_head_t recv_wq;
+static DEFINE_SPINLOCK(ops_lock);
+static LIST_HEAD(send_list);
+static LIST_HEAD(recv_list);
+static DECLARE_WAIT_QUEUE_HEAD(send_wq);
+static DECLARE_WAIT_QUEUE_HEAD(recv_wq);
 
 struct plock_async_data {
        void *fl;
@@ -480,12 +480,6 @@ int dlm_plock_init(void)
 {
        int rv;
 
-       spin_lock_init(&ops_lock);
-       INIT_LIST_HEAD(&send_list);
-       INIT_LIST_HEAD(&recv_list);
-       init_waitqueue_head(&send_wq);
-       init_waitqueue_head(&recv_wq);
-
        rv = misc_register(&plock_dev_misc);
        if (rv)
                log_print("dlm_plock_init: misc_register failed %d", rv);