Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2601553pxu; Sat, 10 Oct 2020 00:50:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDPVJmesQYQ5N0n+i5ElxdSORrNzL89//x79G53aF6vWWFCadjJS4KdLPMAspKG5MQnzkf X-Received: by 2002:a50:d4dc:: with SMTP id e28mr3346415edj.137.1602316247796; Sat, 10 Oct 2020 00:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602316247; cv=none; d=google.com; s=arc-20160816; b=RDSF0zOJfQPRaVsksEi0BthCaKuKTLF+ksIEk9wMX/W98t1PpUX6XBuQ1gz/dkvi95 7iRuRGyl0HjYIiqaOWIGzDSELlwzLUZ03l0gCFhAyuhjJQAcuJW5CYFp8OV947p4he4A osluMSmK3DsdKXwxE2Hm7JN1kqxxKfsdCPqBl0bb9kqF4p+fFnzWvCbYiSuhIS+EuCo/ ZpaCZ37jZEAN3UF2G19jEvT7VDYWcKj02ftaG0pooaDzItkgOCyu1YEUe/sCRorpAj1y K8ZaWNw0bZGQZwZtATZYqJ1MWj/IzY4aycA/aQU0TSEf7gqWBl1UVTGdjWihtgHjNC4h jSqg== 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:autocrypt:from :references:cc:to:subject; bh=lVDBOdaKnpe7GgKID6rzja4na8oX81ElD93vVpTZlvI=; b=S884V5nQke9PKTYRtvEmvos5m7oV1WQQhzFhSnjFea8GS884PT+YQSyngpbQJljo/d een421zBy6ksmCrsi/os/7CMIGXT4nUBieYe2VPpIlvTYB5zwgMPmciDHmw3r/Wugt6u XFnMUTjsJph5IRM2GcZ5kU8l5OBUlhquni48oqrkHOq8TP4bNgdJdDukhmZINYRLvqk3 9a6vX1Z4Zmt2JDbzDS5vGJOYpqyfsrfDHhK0wa6W76+zdQEQWTLn1qUC+T6TREpfodRd eYY50pGET81Hn6uzNQBYcvkam1MYEJEUqhETf5/MydkYcPHJEegEg7UJ4+DDQWTk1k3F sOnw== 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 cd12si7073019ejb.745.2020.10.10.00.50.24; Sat, 10 Oct 2020 00:50:47 -0700 (PDT) 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 S1730293AbgJJCWj (ORCPT + 99 others); Fri, 9 Oct 2020 22:22:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:40112 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730025AbgJJCGu (ORCPT ); Fri, 9 Oct 2020 22:06:50 -0400 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 22CD3AD71; Sat, 10 Oct 2020 02:05:28 +0000 (UTC) Subject: Re: [PATCH] bcache: Use #ifdef instead of boolean variable To: Rasmus Villemoes , Alex Dewar Cc: Kent Overstreet , linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org References: <20201009183447.1611204-1-alex.dewar90@gmail.com> From: Coly Li Autocrypt: addr=colyli@suse.de; keydata= mQINBFYX6S8BEAC9VSamb2aiMTQREFXK4K/W7nGnAinca7MRuFUD4JqWMJ9FakNRd/E0v30F qvZ2YWpidPjaIxHwu3u9tmLKqS+2vnP0k7PRHXBYbtZEMpy3kCzseNfdrNqwJ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L/T5SGCN6PrQxzkHk2t9+PwFAlxHziAFCRj7 5/EACgkQxzkHk2t9+PxgfA//cH5R1DvpJPwraTAl24SUcG9EWe+NXyqveApe05nk15zEuxxd e4zFEjo+xYZilSveLqYHrm/amvQhsQ6JLU+8N60DZHVcXbw1Eb8CEjM5oXdbcJpXh1/1BEwl 4phsQMkxOTns51bGDhTQkv4lsZKvNByB9NiiMkT43EOx14rjkhHw3rnqoI7ogu8OO7XWfKcL CbchjJ8t3c2XK1MUe056yPpNAT2XPNF2EEBPG2Y2F4vLgEbPv1EtpGUS1+JvmK3APxjXUl5z 6xrxCQDWM5AAtGfM/IswVjbZYSJYyH4BQKrShzMb0rWUjkpXvvjsjt8rEXpZEYJgX9jvCoxt oqjCKiVLpwje9WkEe9O9VxljmPvxAhVqJjX62S+TGp93iD+mvpCoHo3+CcvyRcilz+Ko8lfO hS9tYT0HDUiDLvpUyH1AR2xW9RGDevGfwGTpF0K6cLouqyZNdhlmNciX48tFUGjakRFsxRmX K0Jx4CEZubakJe+894sX6pvNFiI7qUUdB882i5GR3v9ijVPhaMr8oGuJ3kvwBIA8lvRBGVGn 9xvzkQ8Prpbqh30I4NMp8MjFdkwCN6znBKPHdjNTwE5PRZH0S9J0o67IEIvHfH0eAWAsgpTz +jwc7VKH7vkvgscUhq/v1/PEWCAqh9UHy7R/jiUxwzw/288OpgO+i+2l11Y= Message-ID: <64db3f27-5904-8857-349e-e50d612932fb@suse.de> Date: Sat, 10 Oct 2020 10:05:22 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/10/10 07:00, Rasmus Villemoes wrote: > On 09/10/2020 20.34, Alex Dewar wrote: >> The variable async_registration is used to indicate whether or not >> CONFIG_BCACHE_ASYNC_REGISTRATION is enabled, triggering a (false) >> warning in Coverity about unreachable code. However, it seems clearer in >> this case just to use an #ifdef, so let's do that instead. >> >> Addresses-Coverity-ID: 1497746: Control flow issues (DEADCODE) > > I think that coverity check needs to be ignored. The kernel is full of > things that are supposed to be eliminated by the compiler, but still > checked for valid syntax etc. Often it's even more hidden than this, > something like > > // some header > #ifdef CONFIG_FOO > int foo(void); > #else > static inline int foo(void) { return 0; } > #endif > > // code > > if (foo()) { ... // this goes away for CONFIG_FOO=n } > >> Signed-off-by: Alex Dewar >> --- >> drivers/md/bcache/super.c | 40 +++++++++++++++++---------------------- >> 1 file changed, 17 insertions(+), 23 deletions(-) >> >> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c >> index 46a00134a36a..6d4127881c6a 100644 >> --- a/drivers/md/bcache/super.c >> +++ b/drivers/md/bcache/super.c >> @@ -2504,11 +2504,6 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, >> struct cache_sb_disk *sb_disk; >> struct block_device *bdev; >> ssize_t ret; >> - bool async_registration = false; >> - >> -#ifdef CONFIG_BCACHE_ASYNC_REGISTRATION >> - async_registration = true; >> -#endif > > If anything, this should simply be changed to > > bool async_registration = IS_ENABLED(CONFIG_BCACHE_ASYNC_REGISTRATION); > > Rasmus Hi Rasmus, Yes, the above change might be better. But I don't suggest to spent effort on this. Hi Alex, Indeed the code in v5.9 is quite similar to what your patch makes, and I change it in this shape in v5.10 series. This piece of code may stay in kernel for 2 or 3 versions at most, the purpose is to make it convenient for people to test the async registration in production environment. Once the new async registration behavior is verified to not break any existing thing (which we don't know) it will be the (only) default behavior and the CONFIG_BCACHE_ASYNC_REGISTRATION check will be removed. Thank you all for looking at this. Coly Li