summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKelvin Zhang <zhangxp1998@gmail.com>2026-09-03 16:56:15 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2026-09-14 15:21:46 +0000
commitd8ee1a56fe732a4a380a84c793370edc47bb501c (patch)
tree69f53491e7ba01fa67fec806a034463f5dca7545 /include/linux
parentb13241d96b16648c0e2f110efb59df9c8e573df3 (diff)
downloadlinux-next-d8ee1a56fe732a4a380a84c793370edc47bb501c.tar.gz
linux-next-d8ee1a56fe732a4a380a84c793370edc47bb501c.zip
f2fs: describe NAT block layout dynamically
A NAT block is a filesystem-block-sized array of struct f2fs_nat_entry elements. The compile-time NAT_ENTRY_PER_BLOCK definition hardcodes the NAT capacity to a 4KB block size. Replace the fixed array in struct f2fs_nat_block with a C flexible array member, and calculate sbi->nat_entries_per_block dynamically in init_sb_info(). Parameterize NAT geometry helpers (NAT_ENTRY_PER_BLOCK, NAT_BLOCK_OFFSET, f2fs_start_nid, NAT_BLK_CNT, and f2fs_nat_bitmap_size) with sbi. Update call sites across node management, checkpointing, GC, and sysfs. This is a layout-only change without behavioral differences for 4KB blocks. Signed-off-by: Kelvin Zhang <zhangxp1998@gmail.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/f2fs_fs.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index ecd6694af572..061f906a7b94 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -375,8 +375,6 @@ struct f2fs_node {
/*
* For NAT entries
*/
-#define NAT_ENTRY_PER_BLOCK (F2FS_BLKSIZE / sizeof(struct f2fs_nat_entry))
-
struct f2fs_nat_entry {
__u8 version; /* latest version of cached nat entry */
__le32 ino; /* inode number */
@@ -384,7 +382,8 @@ struct f2fs_nat_entry {
} __packed;
struct f2fs_nat_block {
- struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK];
+ /* The entry count depends on the filesystem block size. */
+ DECLARE_FLEX_ARRAY(struct f2fs_nat_entry, entries);
} __packed;
/*