Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4799709imu; Tue, 29 Jan 2019 07:43:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6RBYClM9L8cLmJne7Z+ltt/GXC4VqDp19EPhB6CO2VZIppgyw9XuCWuMnM6Ja0FpBiqx0N X-Received: by 2002:a17:902:2867:: with SMTP id e94mr26848280plb.264.1548776609622; Tue, 29 Jan 2019 07:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548776609; cv=none; d=google.com; s=arc-20160816; b=nhiFdFlnXsHENywxBlQyRExYAZTcx5b9rO+cAZOYFaZshCdT0D5+WNqsOOTfOBsifS 248ZG85pi7iHwg18Vt/QUJhgo90OkgqDGs6IGn7/JdqKBEvygc1Q0/0zDPxajavi3oo1 HwtNo4HJsFRBWRBi19YjYHRW+tsmXeVDoyqfMXdlCAryD44zdHtb3f6b+/y+jWrIPYS/ C3P4hw4/4YJMGoAqDUe6ROuZALGUxsCWo7vwcR1R8l6TdfofwPbkT64LDlr1JdeVEv8C mHU0yI09ln8Hr5KIO7eYDthb3LK8kVjpESvjg8XZHS2QQ11SWdKtu7A2RgeQgIjHIVPj B2UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:reply-to:message-id:subject:to:from :date; bh=ROazcct5R+TRvyKSgoDsTl9mARzUKn+VV2F0RRn2Pcw=; b=zjorP/u+1q5B9LP/yR5AMsmpFXDUVU2gNVoAyi9sh0lSvmOUHxqkFTuQrqgSgi6JZX UxebtkAKiJoUnA3fLKL7DBFQDVQML43qPHrF2bvL5iQeBOJEZ4HzAx/YwLA3SZpxDms5 Vz9qok57Nw8G9A/TrVHmFQAEF8zl7Aue+I+3niqPrrUyzxN00bIGLNR0By3i8Uwq3DBT U9Td/l4PvL3eOWzHf8v3wOKIr/PiC2IZ2FUjDwRFniV/2zOm1E793PZC1x7KFJ9/TqDd W96gdFNF9qc2QX8IQWhgGutUETRiBbePScXBkkydrRc/8gyEgRTnHqJfO+/BDRXyLHtO zZKw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p17si35832080pfk.275.2019.01.29.07.43.13; Tue, 29 Jan 2019 07:43:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727042AbfA2Pmv (ORCPT + 99 others); Tue, 29 Jan 2019 10:42:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:47366 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725783AbfA2Pmv (ORCPT ); Tue, 29 Jan 2019 10:42:51 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6A777B05D; Tue, 29 Jan 2019 15:42:49 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id A838ADA78C; Tue, 29 Jan 2019 16:42:13 +0100 (CET) Date: Tue, 29 Jan 2019 16:42:13 +0100 From: David Sterba To: dsterba@suse.cz, Anders Roxell , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] btrfs: relocation: fix unused variable Message-ID: <20190129154212.GO2900@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Anders Roxell , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190129130146.11934-1-anders.roxell@linaro.org> <20190129152127.GN2900@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190129152127.GN2900@twin.jikos.cz> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 04:21:27PM +0100, David Sterba wrote: > On Tue, Jan 29, 2019 at 02:01:46PM +0100, Anders Roxell wrote: > > 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. > > I've fixed the warning by avoiding the local variable but I like your > fix in general, thanks. Committed with this changelog: "btrfs: let the assertion expression compile in all configs A compiler warning (in a patch in development) pointed to a variable that was used only inside and ASSERT: u64 root_objectid = root->root_key.objectid; ASSERT(root_objectid == ...); 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; ^~~~~~~~~~~~~ When CONFIG_BRTFS_ASSERT isn't enabled, variable root_objectid isn't used. Rework the assertion helper by adding a runtime check instead of the '#ifdef CONFIG_BTRFS_ASSERT #else ...", so the compiler sees the condition being passed into an inline function after preprocessing."