Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2712883pxu; Sat, 10 Oct 2020 05:00:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu4S+HnO42xgVCVtUYDnM7HGh1i4YKUltDcwcjaY4Ovb+BuwA9MBErkjUaIgdBL/r44U7J X-Received: by 2002:a17:907:435e:: with SMTP id oc22mr19860943ejb.485.1602331239567; Sat, 10 Oct 2020 05:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602331239; cv=none; d=google.com; s=arc-20160816; b=Oz7sPffo2GbdLYWSwzV4qDzIYo5CFxEx2pulpbbk3IQVHQLbaS7KRmAP5HGusjt+r2 2hdjMPnxOqOIExzoPhnbigq1ydD6AehL+GpeqEiTS9C4DO3R1yqcud2vzierjQEFRpIg H3qkgcKb3o4H7rP9Ax58Mi95Od6pxJJHEzvqkg4/g1gvxNasH59SEV7Yg7EqkwVzfFql NQazfRXRdRXlaPnKzgMIBQqcdw3jHGDW0k6g22iCbtKA+ybIPQG/ku6ib3vwvFPC9Z1A o4hRz78/AQti/o118H7AUXjqEe9+18s/BlCuSJEsdryNesU0W0OYxE4t8G0hLYAu8Xmr dSOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=Pm44PCTO8oGoL3yU9zyPNHExVf6NxFX1yCHLRcJUSSg=; b=EcC3ZnBQr++E6CTHsB0/o66zICdZIa6iLizAUTiQA0ZMqjG5cB4mKpAyRl0qFdsKjN OhVNeuKGdLI0uGh0sIXxayOGvAN2RYH6av7eXM7qL+ltkcqNNoV737/lbtWT4Vinv1ED fTpCl75O3d1Sivcua8ZylMJM+LggoHXdTERPcNd6FQr7PnZHOn0OEoAYJJwNp/a4cE5m v5uDFM2XnfqfqVKk0IOAHDOrW6Ej80JMT3JhqdRQo96guXTF/bzadWpR67/bU0mvTyRS y276tE7BTyqpJCd8bHMZT2PrC18SHxSiilLJHZyTV/FbxTz4mo5FcpvEu4+yIxp/6qcL dy/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SwxwY0eN; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f2si11518029edl.147.2020.10.10.04.59.59; Sat, 10 Oct 2020 05:00:39 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SwxwY0eN; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730127AbgJJLq7 (ORCPT + 99 others); Sat, 10 Oct 2020 07:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728935AbgJJKUC (ORCPT ); Sat, 10 Oct 2020 06:20:02 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9876AC0613CF; Sat, 10 Oct 2020 01:23:59 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id t9so12582025wrq.11; Sat, 10 Oct 2020 01:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Pm44PCTO8oGoL3yU9zyPNHExVf6NxFX1yCHLRcJUSSg=; b=SwxwY0eNC5rjMOaZfJtWyRZT5e5YZW5Yh5jEC4eeLrwkbkIS/UW9Y2KBZSviO18pe6 0I+sEpAPwFRq6PvaXPm0Unjks64D1zl164R9eFInRXXVZo0BKWagCQurDrlilfVcyzLH 7ZBWcJ11tDXx5Ai40gdqAlhAC8aHyaEzio04Dn4Xg/SjCgHUdSM07jIhVEVXP/VWG/X3 okPOB8Ojg8kwMLo1+haMo01B4ezuUdXPbXEabKQhY90oWB6z7BM6arxTLpG3lzIeJcCO 0n5jB9pgqaYXEqrIFd3YzQWvG3D/oTEzlPVbSXp8RtLk9gWDiLcovcTv6EM41H60I7sV mjyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Pm44PCTO8oGoL3yU9zyPNHExVf6NxFX1yCHLRcJUSSg=; b=if32q1AVvjQzRGkaRWWQ1RGCtzlM9K0bzp+V6Tu1Lui46iBnsw6ni/dF+UjGCgG/mq CNSsBgwk0uOQUvSu5POyIiOGuARo+oDd3cPzIkPn/knHJeKB9pj7aElGF7iqVsu7y+wU 6ObSdWXU9ddwgHsxcaclJ/Pd8ohaOgltbReVYoM+kS1yFixOp75lO1vkLCh3tLwkyN71 oQIwnfO+dbbphqqI8DHdIHlG4OPgPLR7oFl1S+7O7E1bpWAhplePtUoIFI2cRLN08vzK vn+xszHOzxm83TJh0aBEWXMr8AvKwmumr+RkucFnL1DxUaRWKeNAqqTMNFeQga+2Ng4d PeXg== X-Gm-Message-State: AOAM532zZx15rejh4+Xij0LDx+NrGu6tzRml1Pqn/oMMuLqXhgWP/6ij TLnZmT7U1cvpXsBNTnF4V/nozcBrfarsOQ== X-Received: by 2002:adf:e407:: with SMTP id g7mr18880403wrm.349.1602318238127; Sat, 10 Oct 2020 01:23:58 -0700 (PDT) Received: from medion (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id d2sm5153034wrq.34.2020.10.10.01.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Oct 2020 01:23:57 -0700 (PDT) From: Alex Dewar X-Google-Original-From: Alex Dewar Date: Sat, 10 Oct 2020 09:23:36 +0100 To: Coly Li Cc: Rasmus Villemoes , Alex Dewar , Kent Overstreet , linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bcache: Use #ifdef instead of boolean variable Message-ID: <20201010082336.4435mnsxxmzqxq5y@medion> References: <20201009183447.1611204-1-alex.dewar90@gmail.com> <64db3f27-5904-8857-349e-e50d612932fb@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64db3f27-5904-8857-349e-e50d612932fb@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 10, 2020 at 10:05:22AM +0800, Coly Li wrote: > 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 Hi Coly, That sounds sensible. There's not much point in introducing needless churn. Best, Alex