Re: [PATCH] btrfs: relocation: fix unused variable
From: David Sterba
Date: Tue Jan 29 2019 - 10:22:09 EST
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.