Skip to contentSkip to conversation

btrfs: remove unused variable pages_processed

PATCH In review Tom Rix 2 participants 2 messages May 30, 2023 – Jun 1, 2023 Btrfs file system

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 btrfs: remove unused variable pages_processed

clang with W=1 reports
fs/btrfs/extent_io.c:230:16: error: variable
'pages_processed' set but not used [-Werror,-Wunused-but-set-variable]

        unsigned long pages_processed = 0;
                      ^

This variable is not used so remove it.

---
 fs/btrfs/extent_io.c | 2 --
 1 file changed, 2 deletions(-)
fs/btrfs/extent_io.c +0 -2
index 89e093ae1c33..6919409c1183 100644
@@ -227,7 +227,6 @@ static void __process_pages_contig(struct address_space *mapping,
 	pgoff_t start_index = start >> PAGE_SHIFT;
 	pgoff_t end_index = end >> PAGE_SHIFT;
 	pgoff_t index = start_index;
-	unsigned long pages_processed = 0;
 	struct folio_batch fbatch;
 	int i;
 
@@ -242,7 +241,6 @@ static void __process_pages_contig(struct address_space *mapping,
 
 			process_one_page(fs_info, &folio->page, locked_page,
 					 page_ops, start, end);
-			pages_processed += folio_nr_pages(folio);
 		}
 		folio_batch_release(&fbatch);
 		cond_resched();
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Tom Rix

clang with W=1 reports
fs/btrfs/extent_io.c:230:16: error: variable
'pages_processed' set but not used [-Werror,-Wunused-but-set-variable]

        unsigned long pages_processed = 0;
                      ^

This variable is not used so remove it.

Caused by commit 6d6a31e7fc99 ("btrfs: split page locking out of __process_pages_contig").

It is worth noting that while -Wunused-but-set-variable is normally under W=1, btrfs explicitly enables it in their Makefile, so this warning is visible during a normal build, which breaks the build with CONFIG_WERROR.

Quoted 27 lines
---
 fs/btrfs/extent_io.c | 2 --
 1 file changed, 2 deletions(-)
fs/btrfs/extent_io.c +0 -2
index 89e093ae1c33..6919409c1183 100644
@@ -227,7 +227,6 @@ static void __process_pages_contig(struct address_space *mapping,
 	pgoff_t start_index = start >> PAGE_SHIFT;
 	pgoff_t end_index = end >> PAGE_SHIFT;
 	pgoff_t index = start_index;
-	unsigned long pages_processed = 0;
 	struct folio_batch fbatch;
 	int i;
 
@@ -242,7 +241,6 @@ static void __process_pages_contig(struct address_space *mapping,
 
 			process_one_page(fs_info, &folio->page, locked_page,
 					 page_ops, start, end);
-			pages_processed += folio_nr_pages(folio);
 		}
 		folio_batch_release(&fbatch);
 		cond_resched();
Signature · 1 line
2.27.0