- Package:
- f2fs-tools
- Source:
- f2fs-tools
- Description:
- Tools for Flash-Friendly File System
- Submitter:
- Kyuma Ohta
- Date:
- 2019-10-14 21:24:14 UTC
- Severity:
- wishlist
Dear Maintainer, When boot with changing kernel version, force starting FSCK for F2FS partitions. So, spend a lot of time (some minutes or longer) at boot time. This is upstream's feature issue still not fixed. See https://bbs.archlinux.org/viewtopic.php?id=245702 . Regards, Ohta
Hi Chao, Jaeguk, Could you take a look at this complaint and let me know if I should close the bug as Working As Intended or not? The concern seems to be that for desktop distros (which I know was not f2fs's original target), some users update their kernels frequently, and for them, they are finding the overhead running fsck.f2fs on every kernel upgrade to be overly burdensome. Thanks, - Ted
We can bypass kernel check by adding an option "--no-kernel-check".
Like this?
From 0fd26684d7e6d279a6a5553c7b82856cb6068ec3 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Mon, 14 Oct 2019 10:10:31 -0700
Subject: [PATCH] fsck.f2fs: add --no-kernel-check to bypass kernel version
diff
Given this option, fsck.f2fs does not run fsck forcefully, even if kernel
is updated.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/main.c | 6 ++++++
fsck/mount.c | 3 ++-
include/f2fs_fs.h | 1 +
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/fsck/main.c b/fsck/main.c
index 8c62a14..a402ffb 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -66,6 +66,7 @@ void fsck_usage()
MSG(0, " -y fix all the time\n");
MSG(0, " -V print the version number and exit\n");
MSG(0, " --dry-run do not really fix corruptions\n");
+ MSG(0, " --no-kernel-check skips detecting kernel change\n");
exit(1);
}
@@ -192,6 +193,7 @@ void f2fs_parse_options(int argc, char *argv[])
char *token;
struct option long_opt[] = {
{"dry-run", no_argument, 0, 1},
+ {"no-kernel-check", no_argument, 0, 2},
{0, 0, 0, 0}
};
@@ -203,6 +205,10 @@ void f2fs_parse_options(int argc, char *argv[])
c.dry_run = 1;
MSG(0, "Info: Dry run\n");
break;
+ case 2:
+ c.no_kernel_check = 1;
+ MSG(0, "Info: No Kernel Check\n");
+ break;
case 'a':
c.auto_fix = 1;
MSG(0, "Info: Fix the reported corruption.\n");
diff --git a/fsck/mount.c b/fsck/mount.c
index 2d01c2f..98227e7 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -883,7 +883,8 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum SB_ADDR sb_addr)
MSG(0, "Info: MKFS version\n \"%s\"\n", c.init_version);
MSG(0, "Info: FSCK version\n from \"%s\"\n to \"%s\"\n",
c.sb_version, c.version);
- if (memcmp(c.sb_version, c.version, VERSION_LEN)) {
+ if (!c.no_kernel_check &&
+ memcmp(c.sb_version, c.version, VERSION_LEN)) {
memcpy(sbi->raw_super->version,
c.version, VERSION_LEN);
update_superblock(sbi->raw_super, SB_MASK(sb_addr));
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index a722be4..eb178ea 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -372,6 +372,7 @@ struct f2fs_configuration {
int func;
void *private;
int dry_run;
+ int no_kernel_check;
int fix_on;
int force;
int defset;
The challenge is that for desktop and server installations of Linux, in general some program like /sbin/fsck parses /etc/fstab, and then runs the appropriate file-system specific fsck driver, e.g., /sbin/fsck.ext4, or /sbin/fsck.f2fs, etc. for each particular file system. On more modern-day systems systemd will run the /sbin/fsck.<FSTYPE> for each file system, but the issue remains the same: there in general isn't a good way to configure the OS to pass in file system-specific options, such as --no-kernel-check, to the /sbin/fsck.<FSTYPE> program. The solution that I have for this is to create a config file. See "man e2fsck.conf" for the documentation for it. Code to parse this WIN.INI-style "profile" is quite small; it was originally written for Kerberos, and then imported into e2fsprogs. There is a single C file[1] and a single header file[2], licensed under a MIT-style permissive free software license, so feel free to take and use it if it's helpful. [1] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/lib/support/profile.c [2] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/lib/support/profile.h Cheers, - Ted P.S. In case it isn't obvious, this is the same library code used to parse /etc/mke2fs.conf. See the man page for mke2fs.conf to see why we find it very useful to have a configuration file for mkfs.ext4. P.P.S. I also notice that f2fstools seem to bump the major version number of its shared libraries at every single release. There are ways this can be avoided; in fact, I haven't needed to bump the shared libraries for e2fsprogs in over a decade. Because new shared libraries require new debian packages, my upload of Debian package for f2fstools version 1.12.0 has been hung up in the NEW queue[1] for manual Debian ftpmaster review for over two months. So there some advantage in trying to avoid needing to bump the shared library version unnecessarily (although it does require more care to consider API/ABI backwards compatibility in your design and development). [1] https://ftp-master.debian.org/new.html