[Cluster-devel] [PATCH -next] dlm: use DEFINE_SPINLOCK() for spinlock

Huang Guobin huangguobin4 at huawei.com
Tue Apr 6 11:54:07 UTC 2021


From: Guobin Huang <huangguobin4 at huawei.com>

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: Guobin Huang <huangguobin4 at huawei.com>
---
 fs/dlm/plock.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index c38b2b8ffd1d..5a24a2271fdd 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -13,7 +13,7 @@
 #include "dlm_internal.h"
 #include "lockspace.h"
 
-static spinlock_t ops_lock;
+static DEFINE_SPINLOCK(ops_lock);
 static struct list_head send_list;
 static struct list_head recv_list;
 static wait_queue_head_t send_wq;
@@ -492,7 +492,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);




More information about the Cluster-devel mailing list