* [PATCH] btrfs: Remove unused variable in btrfs_{start,write}_dirty_block_groups()
@ 2022-03-24 15:36 Nathan Chancellor
2022-03-24 18:49 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2022-03-24 15:36 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba
Cc: Nick Desaulniers, linux-btrfs, linux-kernel, llvm, patches,
Nathan Chancellor, stable
Clang's version of -Wunused-but-set-variable recently gained support for
unary operations, which reveals two unused variables:
fs/btrfs/block-group.c:2949:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
int num_started = 0;
^
fs/btrfs/block-group.c:3116:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
int num_started = 0;
^
2 errors generated.
These variables appear to be unused from their introduction, so just
remove them to silence the warnings.
Cc: stable@vger.kernel.org
Fixes: c9dc4c657850 ("Btrfs: two stage dirty block group writeout")
Fixes: 1bbc621ef284 ("Btrfs: allow block group cache writeout outside critical section in commit")
Link: https://github.com/ClangBuiltLinux/linux/issues/1614
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I am requesting a stable backport because this is visible with
allmodconfig, which enables CONFIG_WERROR, breaking the build.
To quote Linus:
"EVERYBODY should have CONFIG_WERROR=y on at least x86-64 and other
serious architectures, unless you have some completely random
experimental (and broken) compiler."
https://lore.kernel.org/r/CAHk-=wifoM9VOp-55OZCRcO9MnqQ109UTuCiXeZ-eyX_JcNVGg@mail.gmail.com/
fs/btrfs/block-group.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index c22d287e020b..9ad265066225 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -2946,7 +2946,6 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans)
struct btrfs_path *path = NULL;
LIST_HEAD(dirty);
struct list_head *io = &cur_trans->io_bgs;
- int num_started = 0;
int loops = 0;
spin_lock(&cur_trans->dirty_bgs_lock);
@@ -3012,7 +3011,6 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans)
cache->io_ctl.inode = NULL;
ret = btrfs_write_out_cache(trans, cache, path);
if (ret == 0 && cache->io_ctl.inode) {
- num_started++;
should_put = 0;
/*
@@ -3113,7 +3111,6 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans)
int should_put;
struct btrfs_path *path;
struct list_head *io = &cur_trans->io_bgs;
- int num_started = 0;
path = btrfs_alloc_path();
if (!path)
@@ -3171,7 +3168,6 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans)
cache->io_ctl.inode = NULL;
ret = btrfs_write_out_cache(trans, cache, path);
if (ret == 0 && cache->io_ctl.inode) {
- num_started++;
should_put = 0;
list_add_tail(&cache->io_list, io);
} else {
base-commit: d3e29967079c522ce1c5cab0e9fab2c280b977eb
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: Remove unused variable in btrfs_{start,write}_dirty_block_groups()
2022-03-24 15:36 [PATCH] btrfs: Remove unused variable in btrfs_{start,write}_dirty_block_groups() Nathan Chancellor
@ 2022-03-24 18:49 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-03-24 18:49 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Chris Mason, Josef Bacik, David Sterba, Nick Desaulniers,
linux-btrfs, linux-kernel, llvm, patches, stable
On Thu, Mar 24, 2022 at 08:36:45AM -0700, Nathan Chancellor wrote:
> Clang's version of -Wunused-but-set-variable recently gained support for
> unary operations, which reveals two unused variables:
>
> fs/btrfs/block-group.c:2949:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
> int num_started = 0;
> ^
> fs/btrfs/block-group.c:3116:6: error: variable 'num_started' set but not used [-Werror,-Wunused-but-set-variable]
> int num_started = 0;
> ^
> 2 errors generated.
>
> These variables appear to be unused from their introduction, so just
> remove them to silence the warnings.
>
> Cc: stable@vger.kernel.org
> Fixes: c9dc4c657850 ("Btrfs: two stage dirty block group writeout")
> Fixes: 1bbc621ef284 ("Btrfs: allow block group cache writeout outside critical section in commit")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1614
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Added to misc-next, thanks.
> I am requesting a stable backport because this is visible with
> allmodconfig, which enables CONFIG_WERROR, breaking the build.
Yeah warning fixes are accepted in stable trees and we care about
warning-free builds. My gcc 11.1 does not produce any warning with
-Wunused-but-set-variable and we have extended the set of warnings in
the directory fs/btrfs/ that also includes that one.
> To quote Linus:
>
> "EVERYBODY should have CONFIG_WERROR=y on at least x86-64 and other
> serious architectures, unless you have some completely random
> experimental (and broken) compiler."
I have CONFIG_WERROR disabled, for own development it's quite annoying
when build fails outside of the code I care about, while I apply visual
checks of warning-free builds.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-24 18:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 15:36 [PATCH] btrfs: Remove unused variable in btrfs_{start,write}_dirty_block_groups() Nathan Chancellor
2022-03-24 18:49 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).