Skip to content

Add 16K Support for f2fs-tools

Daniel Rosenberg via Linux-f2fs-devel linux-f2fs-devel 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 0 repliesNew
  2. v27 patches 5 repliesSuperseded
  3. v17 patches 2 repliesSuperseded

Changes in v3 from the cover letter

Fixed runtime asserts in check_block_struct_sizes
Now calls check_block_struct_sizes in mkfs
Fixed stack corruption in move_one_curseg_info

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7f2fs-tools: Define constants in terms of BLKSIZEfsck/dir.c fsck/dump.c fsck/fsck.h +6 more+61 -520 replies
2/7f2fs-tools: Refactor Orphan Block structfsck/fsck.c fsck/main.c include/f2fs_fs.h +1 more+24 -50 replies
3/7f2fs-tools: Refactor f2fs_node struct and friendsfsck/dir.c fsck/dump.c fsck/f2fs.h +7 more+121 -970 replies
4/7f2fs-tools: Refactor SIT/NAT block structsinclude/f2fs_fs.h+14 -60 replies
5/7f2fs-tools: Refactor Summary block struct and friendsfsck/f2fs.h fsck/fsck.c fsck/mount.c +3 more+107 -670 replies
6/7f2fs-tools: Refactor f2fs_dentry_block structfsck/dir.c fsck/fsck.c include/f2fs_fs.h +1 more+65 -470 replies
7/7f2fs-tools: Support different block sizesfsck/fsck.h fsck/mount.c include/f2fs_fs.h +2 more+40 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [f2fs-dev] [PATCH v3 0/7] Add 16K Support for f2fs-tools

This adds support for different block sizes to f2fs-tools.

The first patch redefines all block size based constants to be based on the block size. After this patch, you should be able to compile a version of f2fs-tools that works for a given blocksize by just setting F2FS_BLKSIZE_BITS in f2fs_fs.h. Running fsck on an f2fs filesystem of a different block size will fail early, and should leave the fs untouched.

I was unsure how to handle things under tools/, so I've left them as is.

The rest of the patches refactor the code to allow it to handle different block sizes with the same binary. The final patch puts this under a block size argument in make_f2fs.

The refactor splits apart structs that have components with sizes derived from the blocksize in the middle. If the component is at the end, it's treated as a variable length array. This means that sizeof on affected structs will not work as expected, and should be replaced with F2FS_BLKSIZE where appropriate. The affected static_asserts are replaced with runtime asserts.

It touches a lot of places, but I think it's probably with it to be able to use a single binary, particularly if we're ever going to be able to mount different blocksize f2fs filesystems using the same kernel.

I was unable to get xfstests running on my 16k arm setup, so I wasn't able to test it as thoroughly as I'd like to have, but it behaved the same on a 4k x86_64 system, and fsck/mounted successfully on an arm64 system.

---
changes in v3:
Fixed runtime asserts in check_block_struct_sizes
Now calls check_block_struct_sizes in mkfs
Fixed stack corruption in move_one_curseg_info

changes in v2:
Moved some 4096=>Block Size changes up to initial patch Fixed build error in initial patch

Daniel Rosenberg (7):
f2fs-tools: Define constants in terms of BLKSIZE
f2fs-tools: Refactor Orphan Block struct
f2fs-tools: Refactor f2fs_node struct and friends
f2fs-tools: Refactor SIT/NAT block structs
f2fs-tools: Refactor Summary block struct and friends
f2fs-tools: Refactor f2fs_dentry_block struct
f2fs-tools: Support different block sizes

 fsck/dir.c               |  46 +++----
 fsck/dump.c              |  28 ++--
 fsck/f2fs.h              |   6 +-
 fsck/fsck.c              |  72 +++++-----
 fsck/fsck.h              |   5 +-
 fsck/main.c              |   1 +
 fsck/mount.c             |  99 ++++++++------
 fsck/node.c              |  12 +-
 fsck/node.h              |  20 +--
 fsck/resize.c            |   2 +-
 include/f2fs_fs.h        | 274 ++++++++++++++++++++++++++++-----------
 lib/libf2fs.c            |   4 +-
 man/sload.f2fs.8         |   2 +-
 mkfs/f2fs_format.c       |  90 ++++++-------
 mkfs/f2fs_format_main.c  |  15 ++-
 mkfs/f2fs_format_utils.c |   2 +-
 16 files changed, 412 insertions(+), 266 deletions(-)

base-commit: b15b6cc56ac7764be17acbdbf96448f388992adc

Signature · 8 lines
2.42.0.rc2.253.gd59a3bf2b4-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel