Linux EXT4 FS development
 help / color / mirror / Atom feed
* [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64
@ 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
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eric Curtin @ 2026-12-02  3:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Eric Curtin, Ryan Roberts, ceph-devel, ecryptfs, fuse-devel, gfs2,
	linux-afs, linux-arm-kernel, linux-btrfs, linux-erofs, linux-ext4,
	linux-fsdevel, linux-mm, linux-nfs

From: Eric Curtin <eric.curtin@docker.com>

This series is part of the boot-time page size selection work for arm64,
posted as RFC [1]. With CONFIG_ARM64_BOOT_TIME_PAGE_SIZE=y, PAGE_SIZE,
PAGE_SHIFT and PAGE_MASK are variables chosen at boot with arm64.pagesize=,
so code that needs a compile-time constant (array sizes, struct layouts,
static initialisers, BUILD_BUG_ON(), case labels, #if) has to use the new
PAGE_SIZE_MIN/PAGE_SIZE_MAX limits or a run-time value instead. For fixed
page sizes both limits equal PAGE_SIZE, so behaviour should not change.

The patches here convert filesystems. They apply on top of the core series
[1], whose patch 1 adds PAGE_SIZE_MIN/MAX, and are otherwise independent
of each other. Patches authored by Ryan Roberts come from his v1 [2],
updated for v7.4-rc5. The full tree is at:
  https://github.com/ericcurtin/linux/tree/boot-time-page-size-v2

Testing: allmodconfig with the option enabled builds cleanly on arm64
with all of these applied, and the defconfig kernel boots to userspace
with 4K, 16K and 64K pages under QEMU/KVM (details in [1]). The code in
this series is not otherwise exercised on hardware.

Tool use: these conversions were prepared with an LLM coding assistant
(opencode with Claude Sonnet), driven by build errors and followed by an
automated review pass. I have not hand-audited every patch, so please
review with that in mind and tell me where you would prefer a different
approach for your subsystem.

[1] https://lore.kernel.org/all/20261201015240.1017259-1-ericcurtin17@gmail.com/
[2] https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/

Eric Curtin (17):
  smb: client: Use PAGE_SIZE_MIN in the lock element build checks
  fs/resctrl: Define the kernfs_ops as page-size variables
  ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits
  ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers
  ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES
  nilfs2: Test PAGE_SIZE at run time in the rec_len conversions
  jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays
  isofs: Use PAGE_SIZE_MAX for zisofs_sink_page
  ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer
  ext2: Test PAGE_SIZE at run time in the rec_len conversions
  erofs: Make the decompressor bounce buffers flexible arrays
  ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time
  dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size build check
  cramfs: Allocate the read buffers at init time
  ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check
  btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT
  afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page

Ryan Roberts (5):
  fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN
  btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks
  NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays
  coredump: Use PAGE_SIZE_MIN for the zero-fill buffer
  fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_head arrays


^ permalink raw reply	[flat|nested] 6+ 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
@ 2026-12-02  3:15 ` Eric Curtin
  2026-12-03  3:16   ` sashiko-bot
  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-03  3:16 ` [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 sashiko-bot
  2 siblings, 1 reply; 6+ 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 related	[flat|nested] 6+ 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
  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 14:17   ` Jan Kara
  2026-12-03  3:16 ` [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 sashiko-bot
  2 siblings, 1 reply; 6+ 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 related	[flat|nested] 6+ messages in thread

* Re: [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 10/22] ext2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
@ 2026-12-02 14:17   ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2026-12-02 14:17 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-kernel, Eric Curtin, Jan Kara, linux-ext4

On Wed 02-12-26 03:15:13, Eric Curtin wrote:
> 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>

Looks good. Feel free to add:

Acked-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  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);
>  }
>  
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [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 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer Eric Curtin
@ 2026-12-03  3:16   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-03  3:16 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-ext4, tytso

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ext4: undeclared PAGE_SIZE_MAX used for data_block_buf in
  inline_test_ctx
--

commit 3889ead9026685ea2b83434fbf57427b453dee72
Author: Eric Curtin <eric.curtin@docker.com>

ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer

This commit changes the size of data_block_buf in struct inline_test_ctx
from PAGE_SIZE to PAGE_SIZE_MAX to support boot-time page size selection.

> diff --git a/fs/ext4/inline-test.c b/fs/ext4/inline-test.c
> index b3d7c51ad216b..5d9302e2a5725 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];

[Severity: Medium]
Should data_block_buf be sized with TEST_BLOCK_SIZE instead of
PAGE_SIZE_MAX?

PAGE_SIZE_MAX is not defined in the kernel tree, so compiling
fs/ext4/inline-test.c with CONFIG_EXT4_KUNIT_TESTS enabled fails with an
undeclared identifier error.  In addition, data_block_buf backs the mock
filesystem block buffer data_bh of size TEST_BLOCK_SIZE, just like
raw_inode_buf above it:

fs/ext4/inline-test.c:inline_test_init() {
	...
	ctx->data_bh.b_data = (char *)ctx->data_block_buf;
	ctx->data_bh.b_size = TEST_BLOCK_SIZE;
	...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031533.1665444-1-ericcurtin17@gmail.com?part=9

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64
  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 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer 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
@ 2026-12-03  3:16 ` sashiko-bot
  2 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-03  3:16 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-ext4, tytso

Sashiko has finished reviewing this 22-patch series:

- Patches 6, 10, 12, and 14: no issues found.
- Patch 1 ("smb: client: Use PAGE_SIZE_MIN in the lock element b..."): 1
  potential issue (1 High)
- Patch 2 ("fs/resctrl: Define the kernfs_ops as page-size varia..."): 1
  potential issue (1 High)
- Patch 3 ("ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits"): 1
  potential issue (1 High)
- Patch 4 ("ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs..."): 2
  potential issues (1 High, 1 Medium)
- Patch 5 ("ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES"): 1 potential
  issue (1 High)
- Patch 7 ("jfs: Use PAGE_SIZE_MAX to size the metapage anchor a..."): 1
  potential issue (1 High)
- Patch 8 ("isofs: Use PAGE_SIZE_MAX for zisofs_sink_page"): 1 potential
  issue (1 High)
- Patch 9 ("ext4: Use PAGE_SIZE_MAX for the inline KUnit test da..."): 1
  potential issue (1 Medium)
- Patch 11 ("erofs: Make the decompressor bounce buffers flexible..."):
  1 potential issue (1 High)
- Patch 13 ("dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size b..."):
  1 potential issue (1 High)
- Patch 15 ("ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks(..."):
  1 potential issue (1 High)
- Patch 16 ("btrfs: Use PAGE_SIZE_MAX in a static_assert and min_..."):
  1 potential issue (1 High)
- Patch 17 ("afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page"): 2
  potential issues (1 High, 1 Low)
- Patch 18 ("fuse: Check CUSE and ioctl buffer sizes against PAGE..."):
  1 potential issue (1 High)
- Patch 19 ("btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compi..."):
  1 potential issue (1 High)
- Patch 20 ("NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page..."): 1
  potential issue (1 High)
- Patch 21 ("coredump: Use PAGE_SIZE_MIN for the zero-fill buffer"): 1
  potential issue (1 High)
- Patch 22 ("fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_he..."):
  2 potential issues (1 High, 1 Medium)

Detailed reviews have been sent as separate replies to patches 1-5, 7-9,
11, 13, and 15-22.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031533.1665444-1-ericcurtin17@gmail.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-03  3:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer Eric Curtin
2026-12-03  3:16   ` sashiko-bot
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 14:17   ` Jan Kara
2026-12-03  3:16 ` [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox