[RFC PATCH v2 07/22] jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays
From: Eric Curtin
Date: Tue Dec 01 2026 - 22:16:22 EST
From: Eric Curtin <eric.curtin@xxxxxxxxxx>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so MPS_PER_PAGE cannot be used in #if or as an array size.
Add MPS_PER_PAGE_MAX, based on PAGE_SIZE_MAX, and use it for the #if
that selects the multi-metapage-per-page code, for struct meta_anchor's
mp[] array and for the mps[] array in __metapage_migrate_folio().
MPS_PER_PAGE continues to be used for run-time indexing and loops.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
fs/jfs/jfs_metapage.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 41fe12e641ce..29266de09132 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -71,14 +71,15 @@ static struct kmem_cache *metapage_cache;
static mempool_t *metapage_mempool;
#define MPS_PER_PAGE (PAGE_SIZE >> L2PSIZE)
+#define MPS_PER_PAGE_MAX (PAGE_SIZE_MAX >> L2PSIZE)
-#if MPS_PER_PAGE > 1
+#if MPS_PER_PAGE_MAX > 1
struct meta_anchor {
int mp_count;
atomic_t io_count;
blk_status_t status;
- struct metapage *mp[MPS_PER_PAGE];
+ struct metapage *mp[MPS_PER_PAGE_MAX];
};
static inline struct metapage *folio_to_mp(struct folio *folio, int offset)
@@ -158,7 +159,7 @@ static int __metapage_migrate_folio(struct address_space *mapping,
enum migrate_mode mode)
{
struct meta_anchor *src_anchor = src->private;
- struct metapage *mps[MPS_PER_PAGE] = {0};
+ struct metapage *mps[MPS_PER_PAGE_MAX] = {0};
struct metapage *mp;
int i, rc;