Re: [PATCH] btrfs: Fix unused variable in load_free_space_cache()

From: David Sterba
Date: Mon Jul 25 2022 - 12:07:09 EST


On Fri, Jul 22, 2022 at 09:38:54AM -0700, Nathan Chancellor wrote:
> When CONFIG_LOCKDEP is unset, there is a warning about the mapping
> variable being unused:
>
> fs/btrfs/free-space-cache.c:929:24: warning: variable 'mapping' set but not used [-Wunused-but-set-variable]
> struct address_space *mapping;
> ^
> 1 warning generated.
>
> lockdep_set_class() does not do anything with the first parameter to the
> macro when CONFIG_LOCKDEP is not set so just eliminate the mapping
> variable and use inode instead, which is always used in the function.
>
> Fixes: 22d85ab1af7d ("btrfs: Change the lockdep class of struct inode's invalidate_lock")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1672
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>

Folded to the patch, thanks.