ext4: use DEFINE_MUTEX() for mutex lock
authorZheng Yongjun <zhengyongjun3@huawei.com>
Thu, 24 Dec 2020 13:22:44 +0000 (21:22 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 3 Feb 2021 04:16:01 +0000 (23:16 -0500)
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201224132244.30907-1-zhengyongjun3@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index 9a6f987..f361f9f 100644 (file)
@@ -59,7 +59,7 @@
 #include <trace/events/ext4.h>
 
 static struct ext4_lazy_init *ext4_li_info;
-static struct mutex ext4_li_mtx;
+static DEFINE_MUTEX(ext4_li_mtx);
 static struct ratelimit_state ext4_mount_msg_ratelimit;
 
 static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
@@ -6667,7 +6667,6 @@ static int __init ext4_init_fs(void)
 
        ratelimit_state_init(&ext4_mount_msg_ratelimit, 30 * HZ, 64);
        ext4_li_info = NULL;
-       mutex_init(&ext4_li_mtx);
 
        /* Build-time check for flags consistency */
        ext4_check_flag_values();