diff mbox series

[f2fs-dev] f2fs: Fix not used variable 'index'

Message ID 20241023094850.1680709-1-zengheng4@huawei.com (mailing list archive)
State New
Headers show
Series [f2fs-dev] f2fs: Fix not used variable 'index' | expand

Commit Message

Zeng Heng Oct. 23, 2024, 9:48 a.m. UTC
Fix the following compilation warning:
fs/f2fs/data.c:2391:10: warning: variable ‘index’ set but not used
[-Wunused-but-set-variable]
 2391 |  pgoff_t index;

Only define and set the variable index when the CONFIG_F2FS_FS_COMPRESSION
is enabled.

Fixes: db92e6c729d8 ("f2fs: convert f2fs_mpage_readpages() to use folio")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 fs/f2fs/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chao Yu Oct. 24, 2024, 10:27 a.m. UTC | #1
On 2024/10/23 17:48, Zeng Heng wrote:
> Fix the following compilation warning:
> fs/f2fs/data.c:2391:10: warning: variable ‘index’ set but not used
> [-Wunused-but-set-variable]
>   2391 |  pgoff_t index;
> 
> Only define and set the variable index when the CONFIG_F2FS_FS_COMPRESSION
> is enabled.
> 
> Fixes: db92e6c729d8 ("f2fs: convert f2fs_mpage_readpages() to use folio")
> Signed-off-by: Zeng Heng <zengheng4@huawei.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,
diff mbox series

Patch

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 94f7b084f601..9202082a3902 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2385,10 +2385,10 @@  static int f2fs_mpage_readpages(struct inode *inode,
 		.nr_cpages = 0,
 	};
 	pgoff_t nc_cluster_idx = NULL_CLUSTER;
+	pgoff_t index;
 #endif
 	unsigned nr_pages = rac ? readahead_count(rac) : 1;
 	unsigned max_nr_pages = nr_pages;
-	pgoff_t index;
 	int ret = 0;
 
 	map.m_pblk = 0;
@@ -2406,9 +2406,9 @@  static int f2fs_mpage_readpages(struct inode *inode,
 			prefetchw(&folio->flags);
 		}
 
+#ifdef CONFIG_F2FS_FS_COMPRESSION
 		index = folio_index(folio);
 
-#ifdef CONFIG_F2FS_FS_COMPRESSION
 		if (!f2fs_compressed_file(inode))
 			goto read_single_page;