mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 01:59:54 +00:00
fsck.f2fs: add --{no-}kernel-check to bypass kernel version diff or not
Given this option, fsck.f2fs does not run fsck forcefully, even if kernel is updated. Android devices will do --kernel-check by default, while others will not. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
f0f29da924
commit
1126e38155
12
fsck/main.c
12
fsck/main.c
@ -66,6 +66,8 @@ 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");
|
||||
MSG(0, " --kernel-check checks kernel change\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -192,6 +194,8 @@ 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},
|
||||
{"kernel-check", no_argument, 0, 3},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@ -203,6 +207,14 @@ 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 3:
|
||||
c.no_kernel_check = 0;
|
||||
MSG(0, "Info: Do Kernel Check\n");
|
||||
break;
|
||||
case 'a':
|
||||
c.auto_fix = 1;
|
||||
MSG(0, "Info: Fix the reported corruption.\n");
|
||||
|
@ -872,7 +872,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));
|
||||
|
@ -375,6 +375,7 @@ struct f2fs_configuration {
|
||||
int func;
|
||||
void *private;
|
||||
int dry_run;
|
||||
int no_kernel_check;
|
||||
int fix_on;
|
||||
int force;
|
||||
int defset;
|
||||
|
@ -655,6 +655,9 @@ void f2fs_init_configuration(void)
|
||||
c.wanted_sector_size = -1;
|
||||
#ifndef WITH_ANDROID
|
||||
c.preserve_limits = 1;
|
||||
c.no_kernel_check = 1;
|
||||
#else
|
||||
c.no_kernel_check = 0;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < MAX_DEVICES; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user