diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-02 18:07:35 -0700 |
---|---|---|
committer | JP Abgrall <jpa@google.com> | 2014-09-08 14:55:01 -0700 |
commit | de6c1c7ce25841547813c71ca3b6d067300f0530 (patch) | |
tree | d2ac4c7a6ec55ed13ae4f414df657b8a6b0c4665 /fsck/mount.c | |
parent | bc6a70006baab16bf51e9cc7a7b042f734d4ccd2 (diff) | |
download | android_external_f2fs-tools-de6c1c7ce25841547813c71ca3b6d067300f0530.tar.gz android_external_f2fs-tools-de6c1c7ce25841547813c71ca3b6d067300f0530.tar.bz2 android_external_f2fs-tools-de6c1c7ce25841547813c71ca3b6d067300f0530.zip |
fsck.f2fs: add auto_fix feature
This patch adds an auto_fix feature which fixes inconsistency of f2fs images.
E.g.,
With this option, -a, fsck.f2fs tries to fix inconsistency only if its valid
checkpoint has CP_FSCK_FLAG, written by previous bug_on cases.
So, normally it does fix nothing, so that there is no performance regression.
But, if a sort of corruption was reported by the f2fs module, this tries to
fix potential corrupted partition.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fsck/mount.c')
-rw-r--r-- | fsck/mount.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fsck/mount.c b/fsck/mount.c index 2bbd3c5..5a12bb1 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -1183,6 +1183,7 @@ void build_nat_area_bitmap(struct f2fs_sb_info *sbi) int f2fs_do_mount(struct f2fs_sb_info *sbi) { int ret; + sbi->active_logs = NR_CURSEG_TYPE; ret = validate_super_block(sbi, 0); if (ret) { @@ -1208,6 +1209,17 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi) print_ckpt_info(sbi); + if (config.auto_fix) { + u32 flag = le32_to_cpu(sbi->ckpt->ckpt_flags); + + if (flag & CP_FSCK_FLAG) + config.fix_cnt = 1; + else + return 1; + } + + config.bug_on = 0; + sbi->total_valid_node_count = le32_to_cpu(sbi->ckpt->valid_node_count); sbi->total_valid_inode_count = le32_to_cpu(sbi->ckpt->valid_inode_count); @@ -1227,7 +1239,7 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi) return -1; } - return ret; + return 0; } void f2fs_do_umount(struct f2fs_sb_info *sbi) |