* [RFC PATCH v2 01/22] smb: client: Use PAGE_SIZE_MIN in the lock element build checks
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 02/22] fs/resctrl: Define the kernfs_ops as page-size variables Eric Curtin
` (20 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Paulo Alcantara, Namjae Jeon, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, linux-cifs,
samba-technical
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in BUILD_BUG_ON().
Compare the size of the LOCKING_ANDX_RANGE and smb2_lock_element lock
buffers against PAGE_SIZE_MIN in cifs_push_mandatory_locks(),
cifs_unlock_range(), smb2_unlock_range() and
smb2_push_mandatory_locks(), so that the checks hold for every supported
page size. The run-time clamps that use PAGE_SIZE are unchanged.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/smb/client/file.c | 4 ++--
fs/smb/client/smb2file.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index d272320436b3..dd572b3c2a65 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -2417,7 +2417,7 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
}
BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
- PAGE_SIZE);
+ PAGE_SIZE_MIN);
max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
PAGE_SIZE);
max_num = (max_buf - sizeof(struct smb_hdr)) /
@@ -2793,7 +2793,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
return -EINVAL;
BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
- PAGE_SIZE);
+ PAGE_SIZE_MIN);
max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
PAGE_SIZE);
max_num = (max_buf - sizeof(struct smb_hdr)) /
diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c
index 764cfd894ad0..7640e35d44d1 100644
--- a/fs/smb/client/smb2file.c
+++ b/fs/smb/client/smb2file.c
@@ -314,7 +314,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
if (max_buf < sizeof(struct smb2_lock_element))
return -EINVAL;
- BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
+ BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE_MIN);
max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
max_num = max_buf / sizeof(struct smb2_lock_element);
buf = kzalloc_objs(struct smb2_lock_element, max_num);
@@ -457,7 +457,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
return -EINVAL;
}
- BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
+ BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE_MIN);
max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
max_num = max_buf / sizeof(struct smb2_lock_element);
buf = kzalloc_objs(struct smb2_lock_element, max_num);
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 02/22] fs/resctrl: Define the kernfs_ops as page-size variables
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 01/22] smb: client: Use PAGE_SIZE_MIN in the lock element build checks Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 03/22] ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits Eric Curtin
` (19 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Tony Luck, Reinette Chatre, x86, Ben Horgan,
Dave Martin, James Morse, Babu Moger, Drew Fustini
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot initialise .atomic_write_len in a static const
struct kernfs_ops.
Define rdtgroup_kf_single_ops and kf_mondata_ops with
DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), which keeps them const for fixed
page sizes and initialises them from the run-time PAGE_SIZE before any
initcall otherwise.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/resctrl/rdtgroup.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 57ab090072c2..68f45ee82ff8 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -329,16 +329,17 @@ static ssize_t rdtgroup_file_write(struct kernfs_open_file *of, char *buf,
return -EINVAL;
}
-static const struct kernfs_ops rdtgroup_kf_single_ops = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct kernfs_ops,
+ rdtgroup_kf_single_ops, {
.atomic_write_len = PAGE_SIZE,
.write = rdtgroup_file_write,
.seq_show = rdtgroup_seqfile_show,
-};
+});
-static const struct kernfs_ops kf_mondata_ops = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct kernfs_ops, kf_mondata_ops, {
.atomic_write_len = PAGE_SIZE,
.seq_show = rdtgroup_mondata_show,
-};
+});
static bool is_cpu_list(struct kernfs_open_file *of)
{
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 03/22] ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 01/22] smb: client: Use PAGE_SIZE_MIN in the lock element build checks Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 02/22] fs/resctrl: Define the kernfs_ops as page-size variables Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 04/22] ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers Eric Curtin
` (18 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Mark Fasheh, Joel Becker, Joseph Qi, Heming Zhao,
ocfs2-devel
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in #if or in the macros that size arrays
in struct ocfs2_write_ctxt.
In aops.c, use PAGE_SIZE_MIN for OCFS2_MAX_CTXT_PAGES, since the
smallest page needs the most pages per cluster, and PAGE_SIZE_MAX for
OCFS2_MAX_CLUSTERS_PER_PAGE, since the largest page holds the most
clusters. In dlmcommon.h, replace the #if that selected DLM_HASH_PAGES
with a conditional expression, since the value is only used at run time.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ocfs2/aops.c | 6 +++---
fs/ocfs2/dlm/dlmcommon.h | 8 +++-----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 4acdbb70882c..8c549de9035e 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -663,13 +663,13 @@ int ocfs2_map_folio_blocks(struct folio *folio, u64 *p_blkno,
return ret;
}
-#if (PAGE_SIZE >= OCFS2_MAX_CLUSTERSIZE)
+#if (PAGE_SIZE_MIN >= OCFS2_MAX_CLUSTERSIZE)
#define OCFS2_MAX_CTXT_PAGES 1
#else
-#define OCFS2_MAX_CTXT_PAGES (OCFS2_MAX_CLUSTERSIZE / PAGE_SIZE)
+#define OCFS2_MAX_CTXT_PAGES (OCFS2_MAX_CLUSTERSIZE / PAGE_SIZE_MIN)
#endif
-#define OCFS2_MAX_CLUSTERS_PER_PAGE (PAGE_SIZE / OCFS2_MIN_CLUSTERSIZE)
+#define OCFS2_MAX_CLUSTERS_PER_PAGE (PAGE_SIZE_MAX / OCFS2_MIN_CLUSTERSIZE)
struct ocfs2_unwritten_extent {
struct list_head ue_node;
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 58b28dfa8d34..6e16291586b5 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -18,11 +18,9 @@
#define DLM_LOCK_RES_OWNER_UNKNOWN O2NM_MAX_NODES
#define DLM_HASH_SIZE_DEFAULT (1 << 17)
-#if DLM_HASH_SIZE_DEFAULT < PAGE_SIZE
-# define DLM_HASH_PAGES 1
-#else
-# define DLM_HASH_PAGES (DLM_HASH_SIZE_DEFAULT / PAGE_SIZE)
-#endif
+#define DLM_HASH_PAGES \
+ (DLM_HASH_SIZE_DEFAULT < PAGE_SIZE ? 1 : \
+ DLM_HASH_SIZE_DEFAULT / PAGE_SIZE)
#define DLM_BUCKETS_PER_PAGE (PAGE_SIZE / sizeof(struct hlist_head))
#define DLM_HASH_BUCKETS (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE)
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 04/22] ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (2 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 03/22] ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 05/22] ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES Eric Curtin
` (17 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Konstantin Komarov, ntfs3
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so PAGE_SIZE >> SECTOR_SHIFT cannot size the bh[] array in
struct ntfs_buffers.
Use MAX_BUF_PER_PAGE_SIZE_MAX, the number of 512-byte buffers in the
largest supported page, which is what the old expression evaluated to
for a fixed page size.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ntfs3/ntfs_fs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 16e7eab3e16d..c742a2b9525b 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -130,7 +130,7 @@ struct runs_tree {
struct ntfs_buffers {
/* Biggest MFT / smallest cluster = 4096 / 512 = 8 */
/* Biggest index / smallest cluster = 4096 / 512 = 8 */
- struct buffer_head *bh[PAGE_SIZE >> SECTOR_SHIFT];
+ struct buffer_head *bh[MAX_BUF_PER_PAGE_SIZE_MAX];
u32 bytes;
u32 nbufs;
u32 off;
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 05/22] ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (3 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 04/22] ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
` (16 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Namjae Jeon, Hyunchul Lee, ntfs
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, but NTFS_WOF_MAX_PAGES sizes the folios[] and pages[] arrays.
Compute NTFS_WOF_MAX_PAGES with PAGE_SIZE_MIN, since the smallest page
size needs the most pages to hold a compression unit.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ntfs/wof.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs/wof.c b/fs/ntfs/wof.c
index 294dbe5d711f..708a0b71895d 100644
--- a/fs/ntfs/wof.c
+++ b/fs/ntfs/wof.c
@@ -33,7 +33,7 @@ static const __le16 WOF_NAME[] = {
#define NTFS_WOF_MAX_COMP_UNIT (1U << 15)
#define NTFS_WOF_MAX_PAGES \
- DIV_ROUND_UP(NTFS_WOF_MAX_COMP_UNIT + PAGE_SIZE - 1, PAGE_SIZE)
+ DIV_ROUND_UP(NTFS_WOF_MAX_COMP_UNIT + PAGE_SIZE_MIN - 1, PAGE_SIZE_MIN)
struct ntfs_wof_workspace {
struct mutex *lock;
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (4 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 05/22] ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 07/22] jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays Eric Curtin
` (15 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Ryusuke Konishi, Viacheslav Dubeyko, linux-nilfs
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in #if.
Replace the #if (PAGE_SIZE >= 65536) blocks in nilfs_rec_len_from_disk()
and nilfs_rec_len_to_disk() with ordinary C conditions. The compiler
still removes the dead code when PAGE_SIZE is constant.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/nilfs2/dir.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 7686ca9228fc..afc05387f946 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -38,21 +38,19 @@ static inline unsigned int nilfs_rec_len_from_disk(__le16 dlen)
{
unsigned int len = le16_to_cpu(dlen);
-#if (PAGE_SIZE >= 65536)
- if (len == NILFS_MAX_REC_LEN)
+ if (PAGE_SIZE >= 65536 && len == NILFS_MAX_REC_LEN)
return 1 << 16;
-#endif
return len;
}
static inline __le16 nilfs_rec_len_to_disk(unsigned int len)
{
-#if (PAGE_SIZE >= 65536)
- if (len == (1 << 16))
- return cpu_to_le16(NILFS_MAX_REC_LEN);
+ if (PAGE_SIZE >= 65536) {
+ if (len == (1 << 16))
+ return cpu_to_le16(NILFS_MAX_REC_LEN);
- BUG_ON(len > (1 << 16));
-#endif
+ BUG_ON(len > (1 << 16));
+ }
return cpu_to_le16(len);
}
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 07/22] jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (5 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 08/22] isofs: Use PAGE_SIZE_MAX for zisofs_sink_page Eric Curtin
` (14 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Dave Kleikamp, jfs-discussion
From: Eric Curtin <eric.curtin@docker.com>
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@docker.com>
---
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;
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 08/22] isofs: Use PAGE_SIZE_MAX for zisofs_sink_page
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (6 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 07/22] jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer Eric Curtin
` (13 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Jan Kara, linux-fsdevel
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot size the static zisofs_sink_page[] array.
Size the array with PAGE_SIZE_MAX so that it can absorb a full page for
any supported page size.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/isofs/compress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 2d23abaeb874..66cc6e36526c 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -23,7 +23,7 @@
#include "zisofs.h"
/* This should probably be global. */
-static char zisofs_sink_page[PAGE_SIZE];
+static char zisofs_sink_page[PAGE_SIZE_MAX];
/*
* This contains the zlib memory allocation and the mutex for the
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (7 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 08/22] isofs: Use PAGE_SIZE_MAX for zisofs_sink_page Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 10/22] ext2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
` (12 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Theodore Ts'o, Andreas Dilger, Baokun Li,
Jan Kara, Ojaswin Mujoo, Ritesh Harjani (IBM),
Zhang Yi, linux-ext4
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot size the data_block_buf[] member of struct
inline_test_ctx.
Size data_block_buf[] with PAGE_SIZE_MAX so that the buffer is large
enough for every supported page size.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ext4/inline-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inline-test.c b/fs/ext4/inline-test.c
index b3d7c51ad216..5d9302e2a572 100644
--- a/fs/ext4/inline-test.c
+++ b/fs/ext4/inline-test.c
@@ -52,7 +52,7 @@ struct inline_test_ctx {
struct buffer_head iloc_bh;
u8 raw_inode_buf[TEST_BLOCK_SIZE];
struct buffer_head data_bh;
- u8 data_block_buf[PAGE_SIZE];
+ u8 data_block_buf[PAGE_SIZE_MAX];
int get_inode_loc_err;
int map_blocks_ret;
ext4_fsblk_t map_pblk;
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 10/22] ext2: Test PAGE_SIZE at run time in the rec_len conversions
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (8 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 11/22] erofs: Make the decompressor bounce buffers flexible arrays Eric Curtin
` (11 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Jan Kara, linux-ext4
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in #if.
Replace the #if (PAGE_SIZE >= 65536) blocks in ext2_rec_len_from_disk()
and ext2_rec_len_to_disk() with ordinary C conditions. The compiler
still removes the dead code when PAGE_SIZE is constant.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ext2/dir.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 5de32c221a83..267f071188b4 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -40,21 +40,19 @@ static inline unsigned ext2_rec_len_from_disk(__le16 dlen)
{
unsigned len = le16_to_cpu(dlen);
-#if (PAGE_SIZE >= 65536)
- if (len == EXT2_MAX_REC_LEN)
+ if (PAGE_SIZE >= 65536 && len == EXT2_MAX_REC_LEN)
return 1 << 16;
-#endif
return len;
}
static inline __le16 ext2_rec_len_to_disk(unsigned len)
{
-#if (PAGE_SIZE >= 65536)
- if (len == (1 << 16))
- return cpu_to_le16(EXT2_MAX_REC_LEN);
- else
- BUG_ON(len > (1 << 16));
-#endif
+ if (PAGE_SIZE >= 65536) {
+ if (len == (1 << 16))
+ return cpu_to_le16(EXT2_MAX_REC_LEN);
+ else
+ BUG_ON(len > (1 << 16));
+ }
return cpu_to_le16(len);
}
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 11/22] erofs: Make the decompressor bounce buffers flexible arrays
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (9 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 10/22] ext2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 12/22] ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time Eric Curtin
` (10 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Gao Xiang, Chao Yu, Yue Hu, Jingbo Xu,
Sandeep Dhavale, Hongbo Li, Chunhai Guo, Nick Terrell,
David Sterba, linux-erofs
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used as the size of the bounce[] member in the
deflate, lzma and zstd stream structures.
Turn bounce[] into a flexible array member in struct z_erofs_deflate,
z_erofs_lzma and z_erofs_zstd, move it to the end of struct
z_erofs_zstd, and allocate the structures with kzalloc_flex(*strm,
bounce, PAGE_SIZE) so that the run-time page size sets the buffer size.
In zdata.c, compute Z_EROFS_PCLUSTER_MAX_PAGES with PAGE_SIZE_MIN. It is
used as an upper bound and must be constant.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/erofs/decompressor_deflate.c | 4 ++--
fs/erofs/decompressor_lzma.c | 4 ++--
fs/erofs/decompressor_zstd.c | 4 ++--
fs/erofs/zdata.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/erofs/decompressor_deflate.c b/fs/erofs/decompressor_deflate.c
index 6167af1ffeb9..4cd441cb9070 100644
--- a/fs/erofs/decompressor_deflate.c
+++ b/fs/erofs/decompressor_deflate.c
@@ -5,7 +5,7 @@
struct z_erofs_deflate {
struct z_erofs_deflate *next;
struct z_stream_s z;
- u8 bounce[PAGE_SIZE];
+ u8 bounce[];
};
static DEFINE_SPINLOCK(z_erofs_deflate_lock);
@@ -71,7 +71,7 @@ static int z_erofs_load_deflate_config(struct super_block *sb,
++z_erofs_deflate_avail_strms) {
struct z_erofs_deflate *strm;
- strm = kzalloc_obj(*strm);
+ strm = kzalloc_flex(*strm, bounce, PAGE_SIZE);
if (!strm)
goto failed;
/* XXX: in-kernel zlib cannot customize windowbits */
diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 9d15f94cbee1..5a5897b12f83 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -6,7 +6,7 @@ struct z_erofs_lzma {
struct z_erofs_lzma *next;
struct xz_dec_microlzma *state;
unsigned int dict_size;
- u8 bounce[PAGE_SIZE];
+ u8 bounce[];
};
/* considering the LZMA performance, no need to use a lockless list for now */
@@ -56,7 +56,7 @@ static int __init z_erofs_lzma_init(void)
CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS);
for (i = 0; i < z_erofs_lzma_nstrms; ++i) {
- struct z_erofs_lzma *strm = kzalloc_obj(*strm);
+ struct z_erofs_lzma *strm = kzalloc_flex(*strm, bounce, PAGE_SIZE);
if (!strm) {
z_erofs_lzma_exit();
diff --git a/fs/erofs/decompressor_zstd.c b/fs/erofs/decompressor_zstd.c
index ab318a2400f9..e9dc6eb67561 100644
--- a/fs/erofs/decompressor_zstd.c
+++ b/fs/erofs/decompressor_zstd.c
@@ -4,9 +4,9 @@
struct z_erofs_zstd {
struct z_erofs_zstd *next;
- u8 bounce[PAGE_SIZE];
void *wksp;
unsigned int wkspsz;
+ u8 bounce[];
};
static DEFINE_SPINLOCK(z_erofs_zstd_lock);
@@ -59,7 +59,7 @@ static int __init z_erofs_zstd_init(void)
++z_erofs_zstd_avail_strms) {
struct z_erofs_zstd *strm;
- strm = kzalloc_obj(*strm);
+ strm = kzalloc_flex(*strm, bounce, PAGE_SIZE);
if (!strm) {
z_erofs_zstd_exit();
return -ENOMEM;
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index e981e371d6c2..bc4a7133a097 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -10,7 +10,7 @@
#include <trace/events/erofs.h>
#define Z_EROFS_MAX_SYNC_DECOMPRESS_BYTES 12288
-#define Z_EROFS_PCLUSTER_MAX_PAGES (Z_EROFS_PCLUSTER_MAX_SIZE / PAGE_SIZE)
+#define Z_EROFS_PCLUSTER_MAX_PAGES (Z_EROFS_PCLUSTER_MAX_SIZE / PAGE_SIZE_MIN)
#define Z_EROFS_INLINE_BVECS 2
struct z_erofs_bvec {
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 12/22] ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (10 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 11/22] erofs: Make the decompressor bounce buffers flexible arrays Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 13/22] dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size build check Eric Curtin
` (9 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Tyler Hicks, ecryptfs
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot initialise the static ecryptfs_cache_infos[]
table.
Drop the PAGE_SIZE sizes of the ecryptfs_headers and
ecryptfs_xattr_cache entries, and treat a size of 0 as PAGE_SIZE in
ecryptfs_init_kmem_caches(), where the value is known at run time.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ecryptfs/main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 5f37cddb956f..bce3250047e3 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -655,7 +655,7 @@ inode_info_init_once(void *vptr)
static struct ecryptfs_cache_info {
struct kmem_cache **cache;
const char *name;
- size_t size;
+ size_t size; /* 0 means PAGE_SIZE */
slab_flags_t flags;
void (*ctor)(void *obj);
} ecryptfs_cache_infos[] = {
@@ -684,12 +684,10 @@ static struct ecryptfs_cache_info {
{
.cache = &ecryptfs_header_cache,
.name = "ecryptfs_headers",
- .size = PAGE_SIZE,
},
{
.cache = &ecryptfs_xattr_cache,
.name = "ecryptfs_xattr_cache",
- .size = PAGE_SIZE,
},
{
.cache = &ecryptfs_key_record_cache,
@@ -744,7 +742,7 @@ static int ecryptfs_init_kmem_caches(void)
struct ecryptfs_cache_info *info;
info = &ecryptfs_cache_infos[i];
- *(info->cache) = kmem_cache_create(info->name, info->size, 0,
+ *(info->cache) = kmem_cache_create(info->name, info->size ?: PAGE_SIZE, 0,
SLAB_HWCACHE_ALIGN | info->flags, info->ctor);
if (!*(info->cache)) {
ecryptfs_free_kmem_caches();
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 13/22] dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size build check
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (11 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 12/22] ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 14/22] cramfs: Allocate the read buffers at init time Eric Curtin
` (8 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Alexander Aring, David Teigland, gfs2
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in BUILD_BUG_ON().
Check DLM_MAX_SOCKET_BUFSIZE against PAGE_SIZE_MIN in
dlm_lowcomms_new_msg() so that the message buffer fits in a page for
every supported page size.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/dlm/lowcomms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 3929b164dc0d..d991a47d8392 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1266,7 +1266,7 @@ struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, char **ppc,
if (len > DLM_MAX_SOCKET_BUFSIZE ||
len < sizeof(struct dlm_header)) {
- BUILD_BUG_ON(PAGE_SIZE < DLM_MAX_SOCKET_BUFSIZE);
+ BUILD_BUG_ON(PAGE_SIZE_MIN < DLM_MAX_SOCKET_BUFSIZE);
log_print("failed to allocate a buffer of size %d", len);
WARN_ON_ONCE(1);
return NULL;
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 14/22] cramfs: Allocate the read buffers at init time
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (12 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 13/22] dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size build check Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 15/22] ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check Eric Curtin
` (7 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, Nicolas Pitre
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so the statically sized read_buffers[] array, whose size is
BLKS_PER_BUF * PAGE_SIZE, cannot be declared as before.
Make read_buffers[] an array of pointers and allocate each buffer with
kmalloc() in cramfs_alloc_read_buffers(), called from init_cramfs_fs().
The buffers are only needed when CONFIG_CRAMFS_BLOCKDEV is enabled, so
nothing is allocated otherwise. Free them on the init error paths and on
module exit.
The buffers are now allocated from the slab instead of living in .bss.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/cramfs/inode.c | 41 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index d4cd03f4f60d..49acb5afd6a4 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -181,7 +181,7 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
#define BLKS_PER_BUF (1 << BLKS_PER_BUF_SHIFT)
#define BUFFER_SIZE (BLKS_PER_BUF*PAGE_SIZE)
-static unsigned char read_buffers[READ_BUFFERS][BUFFER_SIZE];
+static unsigned char *read_buffers[READ_BUFFERS];
static unsigned buffer_blocknr[READ_BUFFERS];
static struct super_block *buffer_dev[READ_BUFFERS];
static int next_buffer;
@@ -987,16 +987,50 @@ static struct file_system_type cramfs_fs_type = {
};
MODULE_ALIAS_FS("cramfs");
+static void cramfs_free_read_buffers(void)
+{
+ int i;
+
+ for (i = 0; i < READ_BUFFERS; i++)
+ kfree(read_buffers[i]);
+}
+
+static int __init cramfs_alloc_read_buffers(void)
+{
+ int i;
+
+ if (!IS_ENABLED(CONFIG_CRAMFS_BLOCKDEV))
+ return 0;
+
+ for (i = 0; i < READ_BUFFERS; i++) {
+ read_buffers[i] = kmalloc(BUFFER_SIZE, GFP_KERNEL);
+ if (!read_buffers[i]) {
+ cramfs_free_read_buffers();
+ return -ENOMEM;
+ }
+ }
+ return 0;
+}
+
static int __init init_cramfs_fs(void)
{
int rv;
- rv = cramfs_uncompress_init();
+ rv = cramfs_alloc_read_buffers();
if (rv < 0)
return rv;
+ rv = cramfs_uncompress_init();
+ if (rv < 0)
+ goto err_buffers;
rv = register_filesystem(&cramfs_fs_type);
if (rv < 0)
- cramfs_uncompress_exit();
+ goto err_uncompress;
+ return 0;
+
+err_uncompress:
+ cramfs_uncompress_exit();
+err_buffers:
+ cramfs_free_read_buffers();
return rv;
}
@@ -1004,6 +1038,7 @@ static void __exit exit_cramfs_fs(void)
{
cramfs_uncompress_exit();
unregister_filesystem(&cramfs_fs_type);
+ cramfs_free_read_buffers();
}
module_init(init_cramfs_fs)
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 15/22] ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (13 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 14/22] cramfs: Allocate the read buffers at init time Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 16/22] btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT Eric Curtin
` (6 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Ilya Dryomov, Alex Markuze, Xiubo Li,
Viacheslav Dubeyko, ceph-devel
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SHIFT is not a compile-
time constant, so it cannot be used in BUILD_BUG_ON().
ceph_fscrypt_blocks() asserts that a crypto block does not span more
than one page. Compare CEPH_FSCRYPT_BLOCK_SHIFT against PAGE_SHIFT_MIN
so that the assertion holds for every supported page size.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/ceph/crypto.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h
index d199dc8410fe..612f477e5164 100644
--- a/fs/ceph/crypto.h
+++ b/fs/ceph/crypto.h
@@ -122,7 +122,7 @@ int ceph_fscrypt_prepare_readdir(struct inode *dir);
static inline unsigned int ceph_fscrypt_blocks(u64 off, u64 len)
{
/* crypto blocks cannot span more than one page */
- BUILD_BUG_ON(CEPH_FSCRYPT_BLOCK_SHIFT > PAGE_SHIFT);
+ BUILD_BUG_ON(CEPH_FSCRYPT_BLOCK_SHIFT > PAGE_SHIFT_MIN);
return ((off+len+CEPH_FSCRYPT_BLOCK_SIZE-1) >> CEPH_FSCRYPT_BLOCK_SHIFT) -
(off >> CEPH_FSCRYPT_BLOCK_SHIFT);
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 16/22] btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (14 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 15/22] ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 17/22] afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page Eric Curtin
` (5 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, David Sterba, Chris Mason, linux-btrfs
From: Eric Curtin <eric.curtin@docker.com>
With arm64 boot-time page size selection PAGE_SIZE and PAGE_SHIFT are
not compile-time constants.
Check BTRFS_MAX_FOLIO_SIZE against PAGE_SIZE_MAX in the static_assert so
that it holds for every supported page size. In index_one_bio(), use
min_t(u32, ...) to compare sectorsize_bits with PAGE_SHIFT, because
PAGE_SHIFT is a variable of a different type and min() would not accept
the mix.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/btrfs/fs.h | 2 +-
fs/btrfs/raid56.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
index 2dd167c32d61..892626ab6d0f 100644
--- a/fs/btrfs/fs.h
+++ b/fs/btrfs/fs.h
@@ -56,7 +56,7 @@ struct btrfs_space_info;
/* The maximum folio size btrfs supports. */
#define BTRFS_MAX_FOLIO_SIZE (SZ_2M)
-static_assert(BTRFS_MAX_FOLIO_SIZE > PAGE_SIZE);
+static_assert(BTRFS_MAX_FOLIO_SIZE > PAGE_SIZE_MAX);
/*
* The maximum number of blocks a huge folio can support.
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 5ec31299f1c3..f614877316fb 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1289,7 +1289,7 @@ static void index_one_bio(struct btrfs_raid_bio *rbio, struct bio *bio)
{
struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
const u32 step = min(fs_info->sectorsize, PAGE_SIZE);
- const u32 step_bits = min(fs_info->sectorsize_bits, PAGE_SHIFT);
+ const u32 step_bits = min_t(u32, fs_info->sectorsize_bits, PAGE_SHIFT);
struct bvec_iter iter = bio->bi_iter;
phys_addr_t paddr;
u32 offset = (bio->bi_iter.bi_sector << SECTOR_SHIFT) -
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 17/22] afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (15 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 16/22] btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 18/22] fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN Eric Curtin
` (4 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric Curtin, David Howells, Marc Dionne, linux-afs
From: Eric Curtin <eric.curtin@docker.com>
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@docker.com>
---
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];
};
/*
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 18/22] fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (16 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 17/22] afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 19/22] btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks Eric Curtin
` (3 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Ryan Roberts, Miklos Szeredi, fuse-devel
From: Ryan Roberts <ryan.roberts@arm.com>
The BUILD_BUG_ON() checks that CUSE_INIT_INFO_MAX in cuse_send_init()
and the ioctl iovec array in fuse_do_ioctl() fit in a page cannot use
PAGE_SIZE, which is not a compile-time constant with arm64 boot-time
page size selection. Compare against PAGE_SIZE_MIN, the smallest page
size that can be in use, so the assumptions hold for every page size.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/fuse/cuse.c | 2 +-
fs/fuse/ioctl.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 2538db153991..607b74731f76 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -438,7 +438,7 @@ static int cuse_send_init(struct cuse_conn *cc)
struct cuse_init_args *ia;
struct fuse_args_pages *ap;
- BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE);
+ BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE_MIN);
rc = -ENOMEM;
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index ce1807704da6..3d57c7c75055 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -246,7 +246,8 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
#endif
/* assume all the iovs returned by client always fits in a page */
- BUILD_BUG_ON(sizeof(struct fuse_ioctl_iovec) * FUSE_IOCTL_MAX_IOV > PAGE_SIZE);
+ BUILD_BUG_ON(sizeof(struct fuse_ioctl_iovec) * FUSE_IOCTL_MAX_IOV >
+ PAGE_SIZE_MIN);
err = -ENOMEM;
ap.folios = fuse_folios_alloc(fm->fc->max_pages, GFP_KERNEL, &ap.descs);
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 19/22] btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (17 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 18/22] fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 20/22] NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays Eric Curtin
` (2 subsequent siblings)
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ryan Roberts, Petr Tesarik, David Sterba, Chris Mason, linux-btrfs
From: Ryan Roberts <ryan.roberts@arm.com>
With boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in static assertions or to size arrays.
Check alignment against PAGE_SIZE_MAX in the static_assert()s for
BTRFS_MAX_COMPRESSED, the defrag CLUSTER_SIZE, and BTRFS_STRIPE_LEN in
scrub. A size aligned to PAGE_SIZE_MAX is also aligned to any smaller
page size.
Compute INLINE_EXTENT_BUFFER_PAGES with PAGE_SIZE_MIN, which gives the
largest number of pages per extent buffer and so is the worst case for
the inline pages[] array.
No functional change for compile-time page sizes.
Co-developed-by: Petr Tesarik <ptesarik@suse.com>
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/btrfs/compression.h | 2 +-
fs/btrfs/defrag.c | 2 +-
fs/btrfs/extent_io.h | 2 +-
fs/btrfs/scrub.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index 1022dc53ec51..7b3506d4202f 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -34,7 +34,7 @@ struct btrfs_ordered_extent;
/* Maximum length of compressed data stored on disk */
#define BTRFS_MAX_COMPRESSED (SZ_128K)
#define BTRFS_MAX_COMPRESSED_PAGES (BTRFS_MAX_COMPRESSED / PAGE_SIZE)
-static_assert((BTRFS_MAX_COMPRESSED % PAGE_SIZE) == 0);
+static_assert((BTRFS_MAX_COMPRESSED % PAGE_SIZE_MAX) == 0);
/* The max size for a single worker to compress. */
#define BTRFS_COMPRESSION_CHUNK_SIZE (SZ_512K)
diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
index cbc532b49c67..9795a612e3c9 100644
--- a/fs/btrfs/defrag.c
+++ b/fs/btrfs/defrag.c
@@ -1117,7 +1117,7 @@ static int defrag_collect_targets(struct btrfs_inode *inode,
}
#define CLUSTER_SIZE (SZ_256K)
-static_assert(PAGE_ALIGNED(CLUSTER_SIZE));
+static_assert(IS_ALIGNED(CLUSTER_SIZE, PAGE_SIZE_MAX));
/*
* Defrag one contiguous target range.
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index c55b37cb24b7..ca86d619dfaa 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -81,7 +81,7 @@ enum {
int __init extent_buffer_init_cachep(void);
void __cold extent_buffer_free_cachep(void);
-#define INLINE_EXTENT_BUFFER_PAGES (BTRFS_MAX_METADATA_BLOCKSIZE / PAGE_SIZE)
+#define INLINE_EXTENT_BUFFER_PAGES (BTRFS_MAX_METADATA_BLOCKSIZE / PAGE_SIZE_MIN)
struct extent_buffer {
u64 start;
u32 len;
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index bbe74af3506c..426e00c1d59e 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -219,8 +219,8 @@ struct scrub_ctx {
refcount_t refs;
};
-static_assert(BTRFS_STRIPE_LEN >= PAGE_SIZE);
-static_assert(IS_ALIGNED(BTRFS_STRIPE_LEN, PAGE_SIZE));
+static_assert(BTRFS_STRIPE_LEN >= PAGE_SIZE_MAX);
+static_assert(IS_ALIGNED(BTRFS_STRIPE_LEN, PAGE_SIZE_MAX));
#define scrub_calc_start_bit(stripe, name, block_nr) \
({ \
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 20/22] NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (18 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 19/22] btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 22/22] fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_head arrays Eric Curtin
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Ryan Roberts, Trond Myklebust, Anna Schumaker, linux-nfs
From: Ryan Roberts <ryan.roberts@arm.com>
With boot-time page size selection PAGE_SIZE is not a compile-time
constant, but NFS4ACL_MAXPAGES and NFS4XATTR_MAXPAGES are used to size
on-stack page pointer arrays.
Compute both from PAGE_SIZE_MIN, which gives the largest possible page
count. Likewise, make the BUILD_BUG_ON() in nfs4_xattr_alloc_entry()
compare against PAGE_SIZE_MIN; if it holds for the smallest page size it
holds for all of them.
No functional change for compile-time page sizes.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/nfs/nfs42proc.c | 2 +-
fs/nfs/nfs42xattr.c | 2 +-
fs/nfs/nfs4proc.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 09b4a6ecad88..c22b76034c9b 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -1388,7 +1388,7 @@ int nfs42_proc_clone(struct file *src_f, struct file *dst_f,
return err;
}
-#define NFS4XATTR_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE)
+#define NFS4XATTR_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE_MIN)
static int _nfs42_proc_removexattr(struct inode *inode, const char *name)
{
diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
index 37d79400e5f4..4eb6870dd618 100644
--- a/fs/nfs/nfs42xattr.c
+++ b/fs/nfs/nfs42xattr.c
@@ -183,7 +183,7 @@ nfs4_xattr_alloc_entry(const char *name, const void *value,
uint32_t flags;
BUILD_BUG_ON(sizeof(struct nfs4_xattr_entry) +
- XATTR_NAME_MAX + 1 > PAGE_SIZE);
+ XATTR_NAME_MAX + 1 > PAGE_SIZE_MIN);
alloclen = sizeof(struct nfs4_xattr_entry);
if (name != NULL) {
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6759fa61b9b4..5cc547a1d9b9 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6003,7 +6003,7 @@ static bool nfs4_server_supports_acls(const struct nfs_server *server,
* it's OK to put sizeof(void) * (XATTR_SIZE_MAX/PAGE_SIZE) bytes on
* the stack.
*/
-#define NFS4ACL_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE)
+#define NFS4ACL_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE_MIN)
int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen,
struct page **pages)
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (19 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 20/22] NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
2026-12-02 3:15 ` [RFC PATCH v2 22/22] fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_head arrays Eric Curtin
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ryan Roberts, Alexander Viro, Christian Brauner, Jan Kara,
Kees Cook, linux-fsdevel, linux-mm
From: Ryan Roberts <ryan.roberts@arm.com>
With boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot size the static zeroes[] buffer in
__dump_skip(), and some fs code must be reworked as well.
In __dump_skip(), size zeroes[] and the chunk length with
PAGE_SIZE_MIN. This is the old PAGE_SIZE when the page size is fixed;
PAGE_SIZE_MIN is preferred over PAGE_SIZE_MAX to save memory.
In binfmt_elf, turn the #if choosing ELF_MIN_ALIGN into a ternary
expression that evaluates at run time, and define elf_format with
DEFINE_GLOBAL_PAGE_SIZE_VAR() so that its ELF_EXEC_PAGESIZE based
initialiser can be deferred to boot.
No functional change for compile-time page sizes.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/binfmt_elf.c | 11 ++++-------
fs/coredump.c | 4 ++--
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bf7f8f47548d..9adec104a211 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -79,11 +79,8 @@ static bool elf_core_dump(struct coredump_params *cprm);
#define elf_core_dump NULL
#endif
-#if ELF_EXEC_PAGESIZE > PAGE_SIZE
-#define ELF_MIN_ALIGN ELF_EXEC_PAGESIZE
-#else
-#define ELF_MIN_ALIGN PAGE_SIZE
-#endif
+#define ELF_MIN_ALIGN \
+ (ELF_EXEC_PAGESIZE > PAGE_SIZE ? ELF_EXEC_PAGESIZE : PAGE_SIZE)
#ifndef ELF_CORE_EFLAGS
#define ELF_CORE_EFLAGS 0
@@ -93,14 +90,14 @@ static bool elf_core_dump(struct coredump_params *cprm);
#define ELF_PAGEOFFSET(_v) ((_v) & (ELF_MIN_ALIGN-1))
#define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
-static struct linux_binfmt elf_format = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct linux_binfmt, elf_format, {
.module = THIS_MODULE,
.load_binary = load_elf_binary,
#ifdef CONFIG_COREDUMP
.core_dump = elf_core_dump,
.min_coredump = ELF_EXEC_PAGESIZE,
#endif
-};
+});
#define BAD_ADDR(x) (unlikely((unsigned long)(x) >= TASK_SIZE))
diff --git a/fs/coredump.c b/fs/coredump.c
index 82ef9d115999..e9658771c217 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1442,7 +1442,7 @@ static void dump_end_record(struct coredump_params *cprm)
static bool __dump_skip(struct coredump_params *cprm, size_t nr)
{
- static char zeroes[PAGE_SIZE];
+ static char zeroes[PAGE_SIZE_MIN];
struct file *file = cprm->file;
if (dump_sparse(cprm)) {
@@ -1460,7 +1460,7 @@ static bool __dump_skip(struct coredump_params *cprm, size_t nr)
}
while (nr) {
- size_t chunk = min_t(size_t, nr, PAGE_SIZE);
+ size_t chunk = min_t(size_t, nr, PAGE_SIZE_MIN);
if (!__dump_emit(cprm, zeroes, chunk))
return false;
^ permalink raw reply [flat|nested] 23+ messages in thread* [RFC PATCH v2 22/22] fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_head arrays
2026-12-02 3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
` (20 preceding siblings ...)
2026-12-02 3:15 ` [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer Eric Curtin
@ 2026-12-02 3:15 ` Eric Curtin
21 siblings, 0 replies; 23+ messages in thread
From: Eric Curtin @ 2026-12-02 3:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Ryan Roberts, OGAWA Hirofumi
From: Ryan Roberts <ryan.roberts@arm.com>
MAX_BUF_PER_PAGE is derived from PAGE_SIZE, so with boot-time page size
selection it cannot be used to size an on-stack array.
Add MAX_BUF_PER_PAGE_SIZE_MAX, the value of MAX_BUF_PER_PAGE at
PAGE_SIZE_MAX, and use it for the bhs[] arrays in fat_alloc_new_dir(),
fat_add_new_entries(), __fat_alloc_clusters() and fat_free_clusters().
No functional change for compile-time page sizes.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
fs/fat/dir.c | 4 ++--
fs/fat/fatent.c | 4 ++--
include/linux/buffer_head.h | 1 +
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 0cebcaf82426..3923d68153dd 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -1184,7 +1184,7 @@ int fat_alloc_new_dir(struct inode *dir, struct timespec64 *ts)
{
struct super_block *sb = dir->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb);
- struct buffer_head *bhs[MAX_BUF_PER_PAGE];
+ struct buffer_head *bhs[MAX_BUF_PER_PAGE_SIZE_MAX];
struct msdos_dir_entry *de;
sector_t blknr;
__le16 date, time;
@@ -1251,7 +1251,7 @@ static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots,
{
struct super_block *sb = dir->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb);
- struct buffer_head *bhs[MAX_BUF_PER_PAGE];
+ struct buffer_head *bhs[MAX_BUF_PER_PAGE_SIZE_MAX];
sector_t blknr, start_blknr, last_blknr;
unsigned long size, copy;
int err, i, n, offset, cluster[2];
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 2d10a815a579..1b2d925656fb 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -510,7 +510,7 @@ static int __fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluste
struct msdos_sb_info *sbi = MSDOS_SB(sb);
const struct fatent_operations *ops = sbi->fatent_ops;
struct fat_entry fatent, prev_ent;
- struct buffer_head *bhs[MAX_BUF_PER_PAGE];
+ struct buffer_head *bhs[MAX_BUF_PER_PAGE_SIZE_MAX];
int i, count, err, nr_bhs, idx_clus;
lock_fat(sbi);
@@ -616,7 +616,7 @@ int fat_free_clusters(struct inode *inode, int cluster)
struct msdos_sb_info *sbi = MSDOS_SB(sb);
const struct fatent_operations *ops = sbi->fatent_ops;
struct fat_entry fatent;
- struct buffer_head *bhs[MAX_BUF_PER_PAGE];
+ struct buffer_head *bhs[MAX_BUF_PER_PAGE_SIZE_MAX];
int i, err, nr_bhs;
int first_cl = cluster, dirty_fsinfo = 0;
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index f8782b719026..dbf1948950af 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -42,6 +42,7 @@ enum bh_state_bits {
};
#define MAX_BUF_PER_PAGE (PAGE_SIZE / 512)
+#define MAX_BUF_PER_PAGE_SIZE_MAX (PAGE_SIZE_MAX / 512)
struct page;
struct buffer_head;
^ permalink raw reply [flat|nested] 23+ messages in thread