f2fs: retain inconsistency information to initiate fsck.f2fs
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 2 Sep 2014 22:43:52 +0000 (15:43 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 9 Sep 2014 20:14:25 +0000 (13:14 -0700)
This patch adds sbi->need_fsck to conduct fsck.f2fs later.
This flag can only be removed by fsck.f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c
fs/f2fs/f2fs.h
fs/f2fs/super.c
include/linux/f2fs_fs.h

index cb5cb4ca1814f838274830914f9b6d3b286bd5c2..5af97d99106e04d931736891261688c3b9409bf5 100644 (file)
@@ -882,6 +882,9 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
        else
                clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);
 
+       if (sbi->need_fsck)
+               set_ckpt_flags(ckpt, CP_FSCK_FLAG);
+
        /* update SIT/NAT bitmap */
        get_sit_bitmap(sbi, __bitmap_ptr(sbi, SIT_BITMAP));
        get_nat_bitmap(sbi, __bitmap_ptr(sbi, NAT_BITMAP));
index 222ff5b4d1e11b58ad3d3ea7e7f82abd52093e8d..210c62df08c3ebb63c01b6b2be6e21b987fefc35 100644 (file)
@@ -434,6 +434,7 @@ struct f2fs_sb_info {
        struct buffer_head *raw_super_buf;      /* buffer head of raw sb */
        struct f2fs_super_block *raw_super;     /* raw super block pointer */
        int s_dirty;                            /* dirty flag for checkpoint */
+       bool need_fsck;                         /* need fsck.f2fs to fix */
 
        /* for node-related operations */
        struct f2fs_nm_info *nm_info;           /* node manager */
index 41bdf511003deb6978cf852203906840167f90b6..a6923041f41a93cf5181eef2bf2497ff75296583 100644 (file)
@@ -849,6 +849,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
                atomic_set(&sbi->nr_pages[i], 0);
 
        sbi->dir_level = DEF_DIR_LEVEL;
+       sbi->need_fsck = false;
 }
 
 /*
index 08ed2b0a96e6aef0ada70da633322f36a8acfe7e..9ca1ff3d46623e0e8499ea97863886e8272a61e9 100644 (file)
@@ -85,6 +85,7 @@ struct f2fs_super_block {
 /*
  * For checkpoint
  */
+#define CP_FSCK_FLAG           0x00000010
 #define CP_ERROR_FLAG          0x00000008
 #define CP_COMPACT_SUM_FLAG    0x00000004
 #define CP_ORPHAN_PRESENT_FLAG 0x00000002