[f2fs-dev] [RFC PATCH v2] f2fs: introduce F2FS_FEATURE_LOST_FOUND feature

2018-02-22 Thread Sheng Yong
This patch introduces a new feature, F2FS_FEATURE_LOST_FOUND, which is set by mkfs. It creates a directory named lost+found, which saves unreachable files. If fsck finds a file which has no parent, or its parent is removed by fsck, the file will be placed under lost+found directory by fsck.

[f2fs-dev] [RFC PATCH v2 4/7] fsck.f2fs: integrate sanity_check_inode to __check_inode_mode

2018-02-22 Thread Sheng Yong
In sanity_check_nid, __check_inode_mode will check i_mode value of an inode. So integrate sanity_check_inode to __check_inode_mode to clean up the code. Signed-off-by: Sheng Yong --- fsck/fsck.c | 33 +++-- 1 file changed, 11 insertions(+), 22

[f2fs-dev] [RFC PATCH v2 6/7] fsck.f2fs: read nat block if nat entry is invalid

2018-02-22 Thread Sheng Yong
fsck will cache all valid nat entries in memory. But when we try to get a nat entry which is not cached, for example allocate a new nid during reconnecting files, we need to read the uncached nat entry from nat block again. Signed-off-by: Sheng Yong --- fsck/mount.c | 4

[f2fs-dev] [RFC PATCH v2 2/7] mkfs.f2fs: introduce mkfs parameters in f2fs_configuration

2018-02-22 Thread Sheng Yong
Introduce new parameters in f2fs_configuration for mkfs: * next_free_nid: save the next free nid * quota_inum: save how many blocks are used for quota inodes * quota_dnum: save how many blocks are used for quota data Use these parameters to avoid duplicated count of these values. And

[f2fs-dev] [RFC PATCH v2 3/7] f2fs-tools: init f2fs_configuration as 0

2018-02-22 Thread Sheng Yong
Signed-off-by: Sheng Yong Reviewed-by: Chao Yu --- lib/libf2fs.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/libf2fs.c b/lib/libf2fs.c index e8b1842..0c684d5 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c

[f2fs-dev] [RFC PATCH v2 5/7] mkfs.f2fs: create lost+found directory

2018-02-22 Thread Sheng Yong
This patch introduces a new feature F2FS_FEATURE_LOST_FOUND. It can be switched on by indicating `-O lost_found'. If LOST_FOUND feature is enabled, an empty directory lost+found is created by mkfs. This is a preparation for fsck. During fsck, the directory is used to save unreachable files, which

[f2fs-dev] [RFC PATCH v2 7/7] fsck.f2fs: reconnect unreachable files to lost+found

2018-02-22 Thread Sheng Yong
This patch introduces lost_found feature to fsck. If a file is found unreachable by fsck. Fsck tries to reconnect the file to lost+found directory: 1. Scan all unreachable file inodes, ignore non-inodes ones and directories. 2. Check them and fix incorrupted data to make sure filesystem

[f2fs-dev] [RFC PATCH v2 0/7] f2fs-tools: introduce F2FS_FEATURE_LOST_FOUND feature

2018-02-22 Thread Sheng Yong
v2->v1: * discard obsolete dnodes after all inodes are created. * add new error message if file type (i_mode) is totally wrong. * change "-O lost+found" to "-O lost_found". * only set filename and bitmap in the second slot of lost+found dentry. * handle inode_crtime when creating

[f2fs-dev] [RFC PATCH v2 1/7] fsck.f2fs: fix typo

2018-02-22 Thread Sheng Yong
Signed-off-by: Sheng Yong --- fsck/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsck/main.c b/fsck/main.c index 804f71a..bbf82c3 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -137,7 +137,7 @@ static void error_out(char *prog) else if

[f2fs-dev] [PATCH] f2fs: in-memory inode checksum when checking consistency

2018-02-22 Thread Weichao Guo
Enable in-memory inode checksum to protect metadata blocks from in-memory scribbles only when checking consistency with no performance requirements. Signed-off-by: Weichao Guo --- fs/f2fs/inode.c | 7 +++ fs/f2fs/node.c | 5 + 2 files changed, 12 insertions(+)