From patchwork Tue Jan 29 13:01:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 156985 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4633212jaa; Tue, 29 Jan 2019 05:01:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN7QRSuemBcXcMW1o/S2KxpsCDWE5krCTgb3NhlFh8FEbEQ4df3IQktkmDlvRyeZ2k3tGEaV X-Received: by 2002:a17:902:24d:: with SMTP id 71mr17597936plc.225.1548766919411; Tue, 29 Jan 2019 05:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548766919; cv=none; d=google.com; s=arc-20160816; b=otcV6SPkmId3aRuwvrIHVM3NWUSTK01mb4zVusqLeFj9WwMiR8w3I7aKhRIHGVyXKm W6d1paExVm4GLLA8f/nRHlGSh2oaPP0E/bHHheulNiB3trOnX64S7m11KFp33Rovnac1 ZsD8gWz21p2MNSmz14BRVW96ufhYm67+T5ynzzdFPpY77Obl1IS763gctKm4Yuo7bGkn 7ZjGrPov1kkQFHm57HeqZWGrFK1/4n8vC3kACC/1PD1YTYXeKLH9W9prBzl54oDKFTFa YSqRXH/lywGRJ0e+oIIM4xNEc3lh5SwhfUrpomJsXVWNvV8ufLXj4+jFj0NWYX/rBVRC lyPA== 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 e11si13169653pgf.450.2019.01.29.05.01.59; Tue, 29 Jan 2019 05:01:59 -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 S1727318AbfA2NB5 (ORCPT + 31 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 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(-) -- 2.19.2 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