[PATCH 2/2] f2fs: remove some stale and unused codes

From: Zhiguo Niu

Date: Wed Sep 23 2026 - 21:54:40 EST


- drop the extern declaration of f2fs_compress_aops which is only
used by inode->i_mapping->a_ops = &f2fs_compress_aops, was removed
by commit 6a78d0488116 ("f2fs: cache: use compress cache").

- folio_get_f2fs_data() and folio_set_f2fs_data() in f2fs.h belong to
the old compress cache inode mechanism; neither is referenced anywhere.

- iostat_set_post_read_ctx() in iostat.h (both the CONFIG_F2FS_IOSTAT
and the stub branches) is never called: the post-read context is
assigned directly at both call sites, bio->bi_private = ctx in
data.c and iostat_ctx->post_read_ctx = ctx in iostat.c.

Signed-off-by: Zhiguo Niu <zhiguo.niu@xxxxxxxxxx>
---
fs/f2fs/f2fs.h | 19 -------------------
fs/f2fs/inode.c | 4 ----
fs/f2fs/iostat.h | 11 -----------
3 files changed, 34 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 089a62c054ea..991deeb9ee1b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2821,25 +2821,6 @@ PAGE_PRIVATE_CLEAR_FUNC(reference, REF_RESOURCE);
PAGE_PRIVATE_CLEAR_FUNC(gcing, ONGOING_MIGRATION);
PAGE_PRIVATE_CLEAR_FUNC(atomic, ATOMIC_WRITE);

-static inline unsigned long folio_get_f2fs_data(struct folio *folio)
-{
- unsigned long data = (unsigned long)folio->private;
-
- if (!test_bit(PAGE_PRIVATE_NOT_POINTER, &data))
- return 0;
- return data >> PAGE_PRIVATE_MAX;
-}
-
-static inline void folio_set_f2fs_data(struct folio *folio, unsigned long data)
-{
- data = (1UL << PAGE_PRIVATE_NOT_POINTER) | (data << PAGE_PRIVATE_MAX);
-
- if (!folio_test_private(folio))
- folio_attach_private(folio, (void *)data);
- else
- folio->private = (void *)((unsigned long)folio->private | data);
-}
-
static inline void dec_valid_block_count(struct f2fs_sb_info *sbi,
struct inode *inode,
block_t count)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 9164a2b5d9f0..5627259295fa 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -21,10 +21,6 @@

#include <trace/events/f2fs.h>

-#ifdef CONFIG_F2FS_FS_COMPRESSION
-extern const struct address_space_operations f2fs_compress_aops;
-#endif
-
#define NUM_PREALLOC_EVICT_INODE_WORK 8

static struct kmem_cache *evict_inode_work_cache;
diff --git a/fs/f2fs/iostat.h b/fs/f2fs/iostat.h
index 61c6bc8e3119..2025225b5bed 100644
--- a/fs/f2fs/iostat.h
+++ b/fs/f2fs/iostat.h
@@ -60,13 +60,6 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio)
return iostat_ctx->post_read_ctx;
}

-static inline void iostat_set_post_read_ctx(struct bio *bio, void *ctx)
-{
- struct bio_iostat_ctx *iostat_ctx = bio->bi_private;
-
- iostat_ctx->post_read_ctx = ctx;
-}
-
extern void iostat_update_and_unbind_ctx(struct bio *bio);
extern void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi,
struct bio *bio, struct bio_post_read_ctx *ctx);
@@ -88,10 +81,6 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio)
{
return bio->bi_private;
}
-static inline void iostat_set_post_read_ctx(struct bio *bio, void *ctx)
-{
- bio->bi_private = ctx;
-}
static inline int f2fs_init_iostat_processing(void) { return 0; }
static inline void f2fs_destroy_iostat_processing(void) {}
static inline int f2fs_init_iostat(struct f2fs_sb_info *sbi) { return 0; }
--
2.43.0