[RFC PATCH v2 17/22] afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page
From: Eric Curtin
Date: Tue Dec 01 2026 - 22:17:27 EST
From: Eric Curtin <eric.curtin@xxxxxxxxxx>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so AFS_DIR_BLOCKS_PER_PAGE cannot be used as an array size.
Add AFS_DIR_BLOCKS_PER_PAGE_MAX, based on PAGE_SIZE_MAX, and use it for
the blocks[] array of struct afs_xdr_dir_page. The structure is then
large enough for the largest page size. AFS_DIR_BLOCKS_PER_PAGE keeps
using PAGE_SIZE for run-time use.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
fs/afs/xdr_fs.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/afs/xdr_fs.h b/fs/afs/xdr_fs.h
index cc5f143d21a3..02c4bfa2bc6a 100644
--- a/fs/afs/xdr_fs.h
+++ b/fs/afs/xdr_fs.h
@@ -38,6 +38,7 @@ struct afs_xdr_AFSFetchStatus {
#define AFS_DIR_SLOTS_PER_BLOCK 64
#define AFS_DIR_BLOCK_SIZE 2048
#define AFS_DIR_BLOCKS_PER_PAGE (PAGE_SIZE / AFS_DIR_BLOCK_SIZE)
+#define AFS_DIR_BLOCKS_PER_PAGE_MAX (PAGE_SIZE_MAX / AFS_DIR_BLOCK_SIZE)
#define AFS_DIR_MAX_SLOTS 65536
#define AFS_DIR_BLOCKS_WITH_CTR 128
#define AFS_DIR_MAX_BLOCKS 1023
@@ -99,7 +100,7 @@ union afs_xdr_dir_block {
* Directory layout on a linux VM page.
*/
struct afs_xdr_dir_page {
- union afs_xdr_dir_block blocks[AFS_DIR_BLOCKS_PER_PAGE];
+ union afs_xdr_dir_block blocks[AFS_DIR_BLOCKS_PER_PAGE_MAX];
};
/*