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

zhongbaisong zhongbaisong at huawei.com
Tue Mar 30 02:00:09 UTC 2021


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: Baisong Zhong <zhongbaisong at huawei.com>
---
  fs/dlm/lockspace.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index c14cf2b7faab..5bc19cdad34d 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -28,7 +28,7 @@
  static int			ls_count;
  static struct mutex		ls_lock;
  static struct list_head		lslist;
-static spinlock_t		lslist_lock;
+static DEFINE_SPINLOCK(lslist_lock);
  static struct task_struct *	scand_task;
  
  
@@ -233,7 +233,6 @@ int __init dlm_lockspace_init(void)
  	ls_count = 0;
  	mutex_init(&ls_lock);
  	INIT_LIST_HEAD(&lslist);
-	spin_lock_init(&lslist_lock);
  
  	dlm_kset = kset_create_and_add("dlm", &dlm_uevent_ops, kernel_kobj);
  	if (!dlm_kset) {



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20210330/9ed3c14f/attachment.htm>


More information about the Cluster-devel mailing list