Skip to content

Commit

Permalink
btrfs: remove unused variable in btrfs_{start,write}_dirty_block_grou…
Browse files Browse the repository at this point in the history
…ps()

commit 6d4a6b5 upstream.

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.

Fixes: c9dc4c6 ("Btrfs: two stage dirty block group writeout")
Fixes: 1bbc621 ("Btrfs: allow block group cache writeout outside critical section in commit")
CC: [email protected] # 5.4+
Link: ClangBuiltLinux/linux#1614
Signed-off-by: Nathan Chancellor <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
nathanchance authored and Sasha Levin committed Apr 20, 2022
1 parent 2889a89 commit 582e611
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fs/btrfs/block-group.c
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,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);
Expand Down Expand Up @@ -2948,7 +2947,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;

/*
Expand Down Expand Up @@ -3049,7 +3047,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)
Expand Down Expand Up @@ -3107,7 +3104,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 {
Expand Down

0 comments on commit 582e611

Please sign in to comment.