From: Coly Li <colyli@suse.de>
To: Zheng Yongjun <zhengyongjun3@huawei.com>,
Kent Overstreet <kent.overstreet@gmail.com>
Cc: linux-bcache@vger.kernel.org, kernel-janitors@vger.kernel.org,
Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next] bcache: use DEFINE_MUTEX() for mutex lock
Date: Mon, 5 Apr 2021 22:02:41 +0800 [thread overview]
Message-ID: <42c3e33d-c20e-0fdd-f316-5084e33f9a3b@suse.de> (raw)
In-Reply-To: <20210405101453.15096-1-zhengyongjun3@huawei.com>
On 4/5/21 6:14 PM, Zheng Yongjun wrote:
> mutex lock can be initialized automatically with DEFINE_MUTEX()
> rather than explicitly calling mutex_init().
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
NACK. This is not the first time people try to "fix" this location...
Using DEFINE_MUTEX() does not gain anything for us, it will generate
unnecessary extra size for the bcache.ko.
ines.
> ---
> drivers/md/bcache/super.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 78c08a8aece8..c124da6e646d 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -41,7 +41,7 @@ static const char invalid_uuid[] = {
> };
>
> static struct kobject *bcache_kobj;
> -struct mutex bch_register_lock;
Hmm, maybe if you compose a patch to add comments for bch_register_lock,
for something like: Don't initialize global variable here. It might be
helpful for noticing people not to fixing this in future.
Thanks.
Coly Li
> +DEFINE_MUTEX(bch_register_lock);
> bool bcache_is_reboot;
> LIST_HEAD(bch_cache_sets);
> static LIST_HEAD(uncached_devices);
> @@ -2870,7 +2870,6 @@ static int __init bcache_init(void)
>
> check_module_parameters();
>
> - mutex_init(&bch_register_lock);
> init_waitqueue_head(&unregister_wait);
> register_reboot_notifier(&reboot);
>
>
next prev parent reply other threads:[~2021-04-05 14:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 10:14 [PATCH -next] bcache: use DEFINE_MUTEX() for mutex lock Zheng Yongjun
2021-04-05 14:02 ` Coly Li [this message]
2021-04-05 21:17 ` Muhammad Usama Anjum
2021-04-28 16:19 ` Muhammad Usama Anjum
2021-04-29 5:56 ` Dan Carpenter
2021-04-29 10:05 ` Coly Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42c3e33d-c20e-0fdd-f316-5084e33f9a3b@suse.de \
--to=colyli@suse.de \
--cc=hulkci@huawei.com \
--cc=kent.overstreet@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bcache@vger.kernel.org \
--cc=zhengyongjun3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).