Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6601030pxu; Thu, 24 Dec 2020 06:49:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhS2ctYF4J8IUhNTZpLVvkbdMBGW4ZttJt3NNraRNALRstuPgqiAuBMe4rzV5rWC3wDVIG X-Received: by 2002:a17:906:fb9b:: with SMTP id lr27mr29000083ejb.175.1608821376399; Thu, 24 Dec 2020 06:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608821376; cv=none; d=google.com; s=arc-20160816; b=aiBLd6q3bjdG+wNI00IDs1iuffMwNC+Ya/40Rd3FqUrytlQtxhtrBGcSOP2vxngGAn UpFVwvjBkkxYWG99OukvjImFDtv3QbccZCxDRKRosvQiosSGzlFK38vhRlyiHfP3ahjS J+bUiN8+MYWH69Vgqp2o2exnqMkSM82N9lSqaxPhUns79J+WOTRabt9uwya9d+VFhAnH WCIGTgv9WPFRS/EEPj9bwQR9i1uxTvm1BauxBF+ecqcYaTDYn5+KB4XuB9Shc2NrjVME ymaUnpGo4JEaKKD13rvnmVK7i2UhKcV0Ktb4Paq2Qyw9U7k+gDWItzYPJw0SjAn3jXgm SwTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=7P54UIpmBZKaUIam7STHuKR870I51IDm6vAM4KK/owk=; b=F8VOYcljdwaGGcgK7PVDTs92UNYOX2MRAXMiktHUcciKTsXfI6wDz/W/cyRxKefjLu ZvtyCDGTJC5H+DQ1V1QBbnfWRj6yeAIyIWgP/VZpnNTtaB/QIWeOR4QxEBUPp5XNAua9 afFN5EvQol++28kFSj4anxI/KQsyMcbXjZu6rfreicG7NIJCXc5tcBvBUY5ZpF1H6cId yXl1FMKZD6Cj2iKWH+D791QW1DQmIc6oIad9U85FdJ7FZP82Lrlb+yay3aL6mMdY+8rh LUoX04xKy18CZpyv/1nfEq9kH3X5/6JpF1BlZC16yK2/oCGyESA7Rc/fKAdN4od82OIr bmjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si13370283ejn.15.2020.12.24.06.49.14; Thu, 24 Dec 2020 06:49:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728439AbgLXOrr (ORCPT + 99 others); Thu, 24 Dec 2020 09:47:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:50646 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbgLXOrr (ORCPT ); Thu, 24 Dec 2020 09:47:47 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1C817ACC4; Thu, 24 Dec 2020 14:47:06 +0000 (UTC) Subject: Re: [PATCH v2 -next] md: bcache: use DEFINE_MUTEX() for mutex lock To: Zheng Yongjun , kent.overstreet@gmail.com, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org References: <20201224132431.31180-1-zhengyongjun3@huawei.com> From: Coly Li Message-ID: <2cef0ad9-b179-ece0-8787-368b21a427f1@suse.de> Date: Thu, 24 Dec 2020 22:47:00 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201224132431.31180-1-zhengyongjun3@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/24/20 9:24 PM, Zheng Yongjun wrote: > mutex lock can be initialized automatically with DEFINE_MUTEX() > rather than explicitly calling mutex_init(). > > Signed-off-by: Zheng Yongjun NACK. For this case, it is unnecessary to initialize a global variable so early in declaration, this change makes bcache.ko bigger and I don't see any benefit. Coly Li > --- > 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 46a00134a36a..963d62a15f37 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -40,7 +40,7 @@ static const char invalid_uuid[] = { > }; > > static struct kobject *bcache_kobj; > -struct mutex bch_register_lock; > +DEFINE_MUTEX(bch_register_lock); > bool bcache_is_reboot; > LIST_HEAD(bch_cache_sets); > static LIST_HEAD(uncached_devices); > @@ -2832,7 +2832,6 @@ static int __init bcache_init(void) > > check_module_parameters(); > > - mutex_init(&bch_register_lock); > init_waitqueue_head(&unregister_wait); > register_reboot_notifier(&reboot); > >