diff mbox series

btrfs: Remove total_data_size variable in btrfs_batch_insert_items()

Message ID 20210603174311.1008645-1-nathan@kernel.org (mailing list archive)
State New, archived
Headers show
Series btrfs: Remove total_data_size variable in btrfs_batch_insert_items() | expand

Commit Message

Nathan Chancellor June 3, 2021, 5:43 p.m. UTC
clang warns:

fs/btrfs/delayed-inode.c:684:6: warning: variable 'total_data_size' set
but not used [-Wunused-but-set-variable]
        int total_data_size = 0, total_size = 0;
            ^
1 warning generated.

This variable's value has been unused since commit fc0d82e103c7 ("btrfs:
sink total_data parameter in setup_items_for_insert"). Eliminate it.

Fixes: fc0d82e103c7 ("btrfs: sink total_data parameter in setup_items_for_insert")
Link: https://github.com/ClangBuiltLinux/linux/issues/1391
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 fs/btrfs/delayed-inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


base-commit: e1bde17d15921cc866d4ad10a16ce77487516bf7

Comments

Nikolay Borisov June 4, 2021, 9:13 a.m. UTC | #1
On 3.06.21 г. 20:43, Nathan Chancellor wrote:
> clang warns:
> 
> fs/btrfs/delayed-inode.c:684:6: warning: variable 'total_data_size' set
> but not used [-Wunused-but-set-variable]
>         int total_data_size = 0, total_size = 0;
>             ^
> 1 warning generated.
> 
> This variable's value has been unused since commit fc0d82e103c7 ("btrfs:
> sink total_data parameter in setup_items_for_insert"). Eliminate it.
> 
> Fixes: fc0d82e103c7 ("btrfs: sink total_data parameter in setup_items_for_insert")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1391
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
David Sterba June 4, 2021, 12:23 p.m. UTC | #2
On Thu, Jun 03, 2021 at 10:43:11AM -0700, Nathan Chancellor wrote:
> clang warns:
> 
> fs/btrfs/delayed-inode.c:684:6: warning: variable 'total_data_size' set
> but not used [-Wunused-but-set-variable]
>         int total_data_size = 0, total_size = 0;
>             ^
> 1 warning generated.
> 
> This variable's value has been unused since commit fc0d82e103c7 ("btrfs:
> sink total_data parameter in setup_items_for_insert"). Eliminate it.
> 
> Fixes: fc0d82e103c7 ("btrfs: sink total_data parameter in setup_items_for_insert")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1391
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Added to misc-next, thanks. I've removed the Fixes: tag, we've been
using this is for patches that should be backported or otherwise point
to a patch that causes a real bug.
diff mbox series

Patch

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 2c18ed23aa27..257c1e18abd4 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -681,7 +681,7 @@  static int btrfs_batch_insert_items(struct btrfs_root *root,
 {
 	struct btrfs_delayed_item *curr, *next;
 	int free_space;
-	int total_data_size = 0, total_size = 0;
+	int total_size = 0;
 	struct extent_buffer *leaf;
 	char *data_ptr;
 	struct btrfs_key *keys;
@@ -706,7 +706,6 @@  static int btrfs_batch_insert_items(struct btrfs_root *root,
 	 */
 	while (total_size + next->data_len + sizeof(struct btrfs_item) <=
 	       free_space) {
-		total_data_size += next->data_len;
 		total_size += next->data_len + sizeof(struct btrfs_item);
 		list_add_tail(&next->tree_list, &head);
 		nitems++;