Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4630905imu; Tue, 29 Jan 2019 05:02:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN7ViiXhByhTwCRcu267Nuq7d9Z0qTZBywnaNxBLez737rUHWGjoVnCYG/DGMuei9s+xBWaQ X-Received: by 2002:a17:902:ba89:: with SMTP id k9mr26238416pls.189.1548766945589; Tue, 29 Jan 2019 05:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548766945; cv=none; d=google.com; s=arc-20160816; b=AYlbxCdNuSueZPmHAV9JjaN7gw8mJmlcvvRkZL7tFH1KY9m27OuyP7Kg53wuJcWTsZ aj7nf0c87I8TIor0VfiTHjFCd3IGuGisHDgOTpNarVGlRYDRdddqB6ASuJz7lkPCKJ97 u/8rnYn7PNRhrgGZdERKIhyWxW1I+XPMTi914OEp+hAM9JvjPoMQD9r3h6TUs/4L8kMA 8qYnZ1iB+LbHRES07QDu/V32IFzqYXcSnJ3LYIEa2Aa/wGWE0b8Fk5SjXNakvDhNCSQj uXvAM7cvNg8OiQQCL+9h12UGqGnzUzQpBCLPEgCtPvw3M/H5bdTG5p+5fcHm4M3l6nGF mEkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ptpn3ooISk+hbFBLcoiG4r9S5KcxBa6gl30Hi3aaOSA=; b=XVdwuXANlW473xR+X1vUTJCAiI2ufeBKB3diSANz8+8J/ubNC2HjpdqqmIu06RFyis hG4omPZQ8VfdjRRU9MR7UZxJUsav78WeMIgSl7ZtE+0z62VcpGuMgfxH8pshSwRGDG41 3B+Q/DzMzy1pdNIlfotbcOHHdGDlU7wny32Vk8ngZ6h63JMYRBITPCBd6f/AQwAAjaxa Gh9O1QpwUK1vA1IgkWPi0xvZ1YhtZtVz0/0IRCqfpe655/MkcGU9tsyDfQk6uVtOHWbB l64knWHHIcIYLTAbS1y6Cr192AvNujm+mAUDDjN1Y3cRL94AOepV5YEYx8LTFnb2Sj9f i/mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DtzrIPdr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si3171602plt.212.2019.01.29.05.02.07; Tue, 29 Jan 2019 05:02:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DtzrIPdr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727166AbfA2NB5 (ORCPT + 99 others); Tue, 29 Jan 2019 08:01:57 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40142 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbfA2NB4 (ORCPT ); Tue, 29 Jan 2019 08:01:56 -0500 Received: by mail-lf1-f67.google.com with SMTP id v5so14530764lfe.7 for ; Tue, 29 Jan 2019 05:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ptpn3ooISk+hbFBLcoiG4r9S5KcxBa6gl30Hi3aaOSA=; b=DtzrIPdrwzNCvJTkAlDg+esBhfR6wT+6BmY7B/Dk47Ve4iJQxHsbc08iYO0fToIPei 9DXs+HO/GPR0adLGeFj634r1xIKP787DaT2NTSX1++rLXKWonQwE7lW73MEkGw1nPi3x pTeYQDY+Ts2l2/JpF+jcoAY5fJ15+fQCQGZco= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ptpn3ooISk+hbFBLcoiG4r9S5KcxBa6gl30Hi3aaOSA=; b=NhCtC2QlWHrY7E7Ch6U2T4Kk7jaABtoLl9gAZfyIVNREoATdrAU8S1ZiQFUcuwCRoJ b5ywFUbRERG0CWstlH1bmA5IrNKunPy9LFI7IXnYHIBfiCJ2MQ1ekOK8Pzto/9h8MxiG HhYi8TDKp7SaBeh1EyowCMoK0MqNlGEDGdAaL40kw8vcr1x2iplFKqo+N+mapvn9UFHp pqST6iWXRhz92yp6jjBrMz/nkGK+z8hiRe8KimD1G/KzAVhNGAryiNTmRnbg6WZ2F53t 8fxMc8ousj4xk3aIgnlLSsiDvCb6hwknDoeJt4fFbLlhTVAWxmGMKard/klZo6S6MESd WQ7A== X-Gm-Message-State: AJcUukfvnjyRAhw8JOdFjJSgCPPq8aOWoP5cUtkTAnLaEh5CZMdVGlYL Rz2h299+863iTESD1FffLM5e7A== X-Received: by 2002:a19:c995:: with SMTP id z143mr19626325lff.79.1548766914500; Tue, 29 Jan 2019 05:01:54 -0800 (PST) Received: from localhost (c-573670d5.07-21-73746f28.bbcust.telenor.se. [213.112.54.87]) by smtp.gmail.com with ESMTPSA id 15-v6sm3969541lje.18.2019.01.29.05.01.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jan 2019 05:01:53 -0800 (PST) From: Anders Roxell To: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH] btrfs: relocation: fix unused variable Date: Tue, 29 Jan 2019 14:01:46 +0100 Message-Id: <20190129130146.11934-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used. fs/btrfs/relocation.c: In function ‘insert_dirty_subv’: fs/btrfs/relocation.c:2138:6: warning: unused variable ‘root_objectid’ [-Wunused-variable] u64 root_objectid = root->root_key.objectid; ^~~~~~~~~~~~~ Reworked by adding a runtime check in the assfail function instead of the '#ifdef CONFIG_BTRFS_ASSERT #else ...", so the compiler sees the condition being passed into an inline function after preprocessing. Fixes: 7b837199c581 ("btrfs: relocation: Delay reloc tree deletion after merge_reloc_roots()") Signed-off-by: Anders Roxell --- fs/btrfs/ctree.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index de23a7ea396d..ad7d079f2cae 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3521,21 +3521,18 @@ do { \ rcu_read_unlock(); \ } while (0) -#ifdef CONFIG_BTRFS_ASSERT - __cold static inline void assfail(const char *expr, const char *file, int line) { - pr_err("assertion failed: %s, file: %s, line: %d\n", - expr, file, line); - BUG(); + if (IS_ENABLED(CONFIG_BTRFS_ASSERT)) { + pr_err("assertion failed: %s, file: %s, line: %d\n", + expr, file, line); + BUG(); + } } #define ASSERT(expr) \ (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) -#else -#define ASSERT(expr) ((void)0) -#endif /* * Use that for functions that are conditionally exported for sanity tests but -- 2.19.2