All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Rosenberg via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
	kernel-team@android.com, Daniel Rosenberg <drosen@google.com>
Subject: [f2fs-dev] [PATCH v2 0/7] Add 16K Support for f2fs-tools
Date: Fri, 25 Aug 2023 15:43:53 -0700	[thread overview]
Message-ID: <20230825224400.2206278-1-drosen@google.com> (raw)

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 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             |  93 ++++++++------
 fsck/node.c              |  12 +-
 fsck/node.h              |  20 +--
 fsck/resize.c            |   2 +-
 include/f2fs_fs.h        | 271 ++++++++++++++++++++++++++++-----------
 lib/libf2fs.c            |   4 +-
 man/sload.f2fs.8         |   2 +-
 mkfs/f2fs_format.c       |  90 ++++++-------
 mkfs/f2fs_format_main.c  |  14 +-
 mkfs/f2fs_format_utils.c |   2 +-
 16 files changed, 405 insertions(+), 263 deletions(-)


base-commit: b15b6cc56ac7764be17acbdbf96448f388992adc
-- 
2.42.0.rc2.253.gd59a3bf2b4-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

             reply	other threads:[~2023-08-25 22:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 22:43 Daniel Rosenberg via Linux-f2fs-devel [this message]
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 1/7] f2fs-tools: Define constants in terms of BLKSIZE Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 2/7] f2fs-tools: Refactor Orphan Block struct Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 3/7] f2fs-tools: Refactor f2fs_node struct and friends Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 4/7] f2fs-tools: Refactor SIT/NAT block structs Daniel Rosenberg via Linux-f2fs-devel
2023-08-28 20:22   ` Jaegeuk Kim
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 5/7] f2fs-tools: Refactor Summary block struct and friends Daniel Rosenberg via Linux-f2fs-devel
2023-08-28 18:07   ` Jaegeuk Kim
2023-08-28 23:14     ` Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 6/7] f2fs-tools: Refactor f2fs_dentry_block struct Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:44 ` [f2fs-dev] [PATCH v2 7/7] f2fs-tools: Support different block sizes Daniel Rosenberg via Linux-f2fs-devel
2023-08-28 20:27   ` Jaegeuk Kim
2023-08-28 23:18     ` Daniel Rosenberg via Linux-f2fs-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230825224400.2206278-1-drosen@google.com \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=drosen@google.com \
    --cc=jaegeuk@kernel.org \
    --cc=kernel-team@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.