[f2fs-dev] [PATCH] fsck.f2fs: do not check segment type of empty curseg

2018-10-08 Thread Sheng Yong
If a curseg is not used, its SIT entry may have an inconsistent type. This will be fixed during recover. Fixes: df8065e52928be ("fsck.f2fs: introduce fsck_chk_curseg_info") Signed-off-by: Sheng Yong --- fsck/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/f

[f2fs-dev] [PATCH] f2fs: cleanup dirty pages if recover failed

2018-09-27 Thread Sheng Yong
546495] do_syscall_64+0x65/0x130 [ 53.546503] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 53.547639] ---[ end trace b804d1ea2fec893e ]--- So if recover fails, we need to drop all recovered data. Signed-off-by: Sheng Yong --- fs/f2fs/recovery.c | 19 --- fs/f2fs/super.c| 15

Re: [f2fs-dev] [PATCH] fsck.f2fs: detect and recover corrupted quota file

2018-09-18 Thread Sheng Yong
Hi, Chao On 2018/9/19 9:28, Chao Yu wrote: Once quota file is corrupted, kernel will set CP_QUOTA_NEED_FSCK_FLAG into checkpoint pack, this patch makes fsck supporting to detect the flag and try to rebuild corrupted quota file. Signed-off-by: Chao Yu --- fsck/fsck.c | 3 ++-

Re: [f2fs-dev] [PATCH] fsck.f2fs: detect and recover corrupted quota file

2018-08-29 Thread Sheng Yong
Hi, Chao On 2018/8/29 20:09, Chao Yu wrote: Once quota file is corrupted, kernel will set CP_QUOTA_NEED_FSCK_FLAG into checkpoint pack, this patch makes fsck supporting to detect the flag and try to rebuild corrupted quota file. Do we need to drop recovery data? Recovery data is never checked

[f2fs-dev] [PATCH] f2fs: wake up gc thread immediately when gc_urgent is set

2018-08-04 Thread Sheng Yong
Fixes: 5b0e95398e2b ("f2fs: introduce sbi->gc_mode to determine the policy") Signed-off-by: Sheng Yong --- fs/f2fs/sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index f22782a0defe..cd2e030e47b8 100644 --- a/fs/f2fs/sysfs.c +++ b/fs

Re: [f2fs-dev] [PATCH] f2fs: check total CP pack block count correctly

2018-08-01 Thread Sheng Yong
On 2018/8/1 18:26, Chao Yu wrote: On 2018/8/1 15:36, Sheng Yong wrote: On 2018/8/1 14:56, Chao Yu wrote: Hi Sheng, On 2018/8/1 11:46, Sheng Yong wrote: Fixes: 652d19558a347 ('f2fs: fix to do sanity check with block address in main area') Reported-by: Zhang Xiaobo Signed-off-by: Sheng

Re: [f2fs-dev] [PATCH] f2fs: check total CP pack block count correctly

2018-08-01 Thread Sheng Yong
On 2018/8/1 14:56, Chao Yu wrote: Hi Sheng, On 2018/8/1 11:46, Sheng Yong wrote: Fixes: 652d19558a347 ('f2fs: fix to do sanity check with block address in main area') Reported-by: Zhang Xiaobo Signed-off-by: Sheng Yong That's my bad, and thanks for the fix. Do you mind merge

[f2fs-dev] [PATCH] f2fs: check total CP pack block count correctly

2018-07-31 Thread Sheng Yong
Fixes: 652d19558a347 ('f2fs: fix to do sanity check with block address in main area') Reported-by: Zhang Xiaobo Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 3587aa53dc90

Re: [f2fs-dev] [PATCH] fsck.f2fs: rebuild qf_ino if quota node is corrupted

2018-07-27 Thread Sheng Yong
On 2018/7/27 17:23, Jaegeuk Kim wrote: On 07/24, Sheng Yong wrote: Hi, Jaegeuk On 2018/7/23 20:49, Jaegeuk Kim wrote: On 07/23, Sheng Yong wrote: If a quota node is corrupted, it may be removed. But its qf_ino in super blocks is not cleared. To keep quota feature available, let's try

[f2fs-dev] [RFC PATCH v2] fsck.f2fs: rebuild qf_ino if quota node is unreachable

2018-07-26 Thread Sheng Yong
quota structures later. Signed-off-by: Sheng Yong --- v2->v1: calculate inode checksum when write quota inode, update commit msg --- fsck/fsck.c | 82 +--- fsck/fsck.h | 1 + fsck/mount.c | 7 +++-- 3 files changed, 84 insertions(+), 6 deleti

Re: [f2fs-dev] [PATCH] f2fs: quota: remove journalled project quota

2018-07-26 Thread Sheng Yong
Hi, Chao On 2018/7/26 19:38, Chao Yu wrote: On 2018/7/26 19:25, Sheng Yong wrote: Quota sysfiles are already using journalled method to save quota value. And non-journalled project quota is not supported by userspace tools. So there is no need to implement journalled project quota. Well

[f2fs-dev] [PATCH] f2fs: quota: remove journalled project quota

2018-07-26 Thread Sheng Yong
Quota sysfiles are already using journalled method to save quota value. And non-journalled project quota is not supported by userspace tools. So there is no need to implement journalled project quota. Signed-off-by: Sheng Yong --- Documentation/filesystems/f2fs.txt | 2 -- fs/f2fs/super.c

[f2fs-dev] [PATCH v2] f2fs: quota: fix incorrect comments

2018-07-26 Thread Sheng Yong
Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 5 - fs/f2fs/super.c | 5 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 04841f32d4d9..581710760ba6 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c

Re: [f2fs-dev] [PATCH 3/3] f2fs: quota: fix incorrect error message and comments

2018-07-25 Thread Sheng Yong
On 2018/7/25 23:44, Chao Yu wrote: On 2018/7/24 20:17, Sheng Yong wrote: Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 5 - fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs

Re: [f2fs-dev] [PATCH RESEND] f2fs: fix to restrict mount condition when without CONFIG_QUOTA

2018-07-25 Thread Sheng Yong
Hi, Chao On 2018/7/26 7:19, Chao Yu wrote: From: Chao Yu Like quota_ino feature, we need to reject mounting RDWR with image which enables project_quota feature when there is no CONFIG_QUOTA be set in kernel. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 6 ++ 1 file changed, 6

[f2fs-dev] [PATCH 2/3] f2fs: quota: decrease the lock granularity of statfs_project

2018-07-24 Thread Sheng Yong
According to fs/quota/dquot.c, `dq_data_lock' protects mem_dqinfo structures and modifications of dquot pointers in the inode, and `dquot->dq_dqb_lock' protects data from dq_dqb. We should use dquot->dq_dqb_lock in statfs_project instead of dq_dat_lock. Signed-off-by: Sheng Yong --- f

[f2fs-dev] [PATCH 1/3] f2fs: quota: do not mount as RDWR without QUOTA if quota feature enabled

2018-07-24 Thread Sheng Yong
If quota feature is enabled, quota is on by default. However, if CONFIG_QUOTA is not built in kernel, dquot entries will not get updated, which leads to quota inconsistency. Signed-off-by: Sheng Yong --- fs/f2fs/super.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff

[f2fs-dev] [PATCH 3/3] f2fs: quota: fix incorrect error message and comments

2018-07-24 Thread Sheng Yong
Signed-off-by: Sheng Yong --- fs/f2fs/checkpoint.c | 5 - fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 9c29526a7633..9a0222d9e28c 100644 --- a/fs/f2fs/checkpoint.c

Re: [f2fs-dev] [PATCH] fsck.f2fs: rebuild qf_ino if quota node is corrupted

2018-07-23 Thread Sheng Yong
Hi, Jaegeuk On 2018/7/23 20:49, Jaegeuk Kim wrote: On 07/23, Sheng Yong wrote: If a quota node is corrupted, it may be removed. But its qf_ino in super blocks is not cleared. To keep quota feature available, let's try to rebuild a new quota node. Hi Sheng, IIRC, we need to rebuild whole

[f2fs-dev] [PATCH] fsck.f2fs: rebuild qf_ino if quota node is corrupted

2018-07-22 Thread Sheng Yong
If a quota node is corrupted, it may be removed. But its qf_ino in super blocks is not cleared. To keep quota feature available, let's try to rebuild a new quota node. Signed-off-by: Sheng Yong --- fsck/fsck.c | 82 +--- fsck/fsck.h | 1 + fsck

[f2fs-dev] [PATCH] fsck.f2fs: init quota_file before re-create quota file

2018-07-11 Thread Sheng Yong
`quota_handle->qh_qf->filesize' is not initialized by quota_create_file(). It contains random value, which is updated to quota file's i_size in quota_file_close(). Since quota file is re-created, `filesize' can be initialized as 0. Signed-off-by: Sheng Yong --- fsck/quotaio.c | 1 +

[f2fs-dev] [PATCH] f2fs-tools: set namelen parameter of convert_encrypted_name as unsigned

2018-07-10 Thread Sheng Yong
To avoid overflow, set namelen parameter of convert_encrypted_name as unsigned int. convert_encrypted_name() will check if namelen exceeds the limitation. Signed-off-by: Sheng Yong --- fsck/fsck.c | 6 +++--- fsck/fsck.h | 2 +- fsck/mount.c | 2 +- 3 files changed, 5 insertions(+), 5

Re: [f2fs-dev] [PATCH v2] fsck.f2fs: fix to do sanity check with extra_attr feature

2018-07-09 Thread Sheng Yong
Hi, Chao, On 2018/7/9 23:25, Chao Yu wrote: From: Chao Yu This patch tries to fix incorrect extra_attr bit or i_extra_isize value in fsck. Signed-off-by: Chao Yu --- v2: - fix to replace F2FS_INLINE_DATA with F2FS_EXTRA_ATTR. fsck/fsck.c | 18 +- 1 file changed, 17

Re: [f2fs-dev] [PATCH] f2fs-tools: avoid mounting f2fs if tools already open the device

2018-07-09 Thread Sheng Yong
Hi, Chao, On 2018/7/9 23:14, Chao Yu wrote: On 2018/7/4 17:50, Sheng Yong wrote: If the block device is opened by tools, F2FS should not be mounted. Especially when fsck is running, errors unexpected may happen. So if tools open a block device, we give it the O_EXCL flag to make sure the block

Re: [f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-08 Thread Sheng Yong
On 2018/7/9 10:15, Chao Yu wrote: Hi Sheng, On 2018/7/3 18:10, Sheng Yong wrote: Check extra_attr feature for inode. If it is corrupted, remove the inode. Could you check the patch: [PATCH] fsck.f2fs: fix to do sanity check with extra_attr feature Would it better to do sanity check

[f2fs-dev] [PATCH] f2fs-tools: avoid mounting f2fs if tools already open the device

2018-07-04 Thread Sheng Yong
If the block device is opened by tools, F2FS should not be mounted. Especially when fsck is running, errors unexpected may happen. So if tools open a block device, we give it the O_EXCL flag to make sure the block device is opened exclusivly. Signed-off-by: Sheng Yong --- lib/libf2fs.c | 27

[f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-03 Thread Sheng Yong
Check extra_attr feature for inode. If it is corrupted, remove the inode. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200219 Reported-by: Wen Xu Signed-off-by: Sheng Yong --- fsck/fsck.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fsck/fsck.c b/fsck/fsck.c index 15264b2

[f2fs-dev] [PATCH 1/2] fsck.f2fs: check extent of inline data/dentry inode

2018-07-03 Thread Sheng Yong
Check extent for inline data/dentry inode. If an inode contains inline data/dentry, it should have no extent. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200175 Reported-by: Wen Xu Signed-off-by: Sheng Yong --- fsck/fsck.c | 16 +++- fsck/fsck.h | 1 + 2 files changed, 12

[f2fs-dev] [PATCH] fsck.f2fs: clear qf_ino if quota node is removed

2018-06-21 Thread Sheng Yong
If a quota node is corrupted, it may be removed. Then its qf_ino should also be removed. Signed-off-by: Sheng Yong --- fsck/fsck.c | 19 +-- fsck/fsck.h | 1 + fsck/mount.c | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c

[f2fs-dev] [PATCH v2] fsck.f2fs: introduce fsck_chk_curseg_info

2018-06-20 Thread Sheng Yong
If curseg is an empty segment, it will not be checked. This patch introduces fsck_chk_curseg_info() to check SIT/SSA type of cursegs to avoid curseg corruption. Signed-off-by: Sheng Yong --- v2: check c.fix_on and c.preen_mode before updating se->type fsck/fsck.c |

[f2fs-dev] [PATCH] f2fs-tools: do not count free_segs in flush_sit_entries

2018-06-13 Thread Sheng Yong
flush_sit_entries() is always called before write_checkpoint(). Since free_segs is counted in write_checkpoint, there is no need to do that in flush_sit_entries. Besides, the value of free_segs may be not correct if we skip uptodate seg_entries. Signed-off-by: Sheng Yong --- fsck/mount.c | 7

[f2fs-dev] [PATCH 1/2] sload.f2fs: update sit entries of cursegs

2018-06-12 Thread Sheng Yong
move_curseg_info->reset_curseg changes cursegs, however, new segment entries are not set as dirty. As a result, flush_sit_entries will not update entries in SIT, especially when an empty segment is selected as the new curseg, its seg_entry->type is lost. Signed-off-by: Sheng Yong ---

[f2fs-dev] [RFC PATCH 2/2] fsck.f2fs: introduce fsck_chk_curseg_info

2018-06-12 Thread Sheng Yong
If curseg is an empty segment, it will not be checked. This patch introduces fsck_chk_curseg_info() to check SIT/SSA type of cursegs to avoid curseg corruption. Signed-off-by: Sheng Yong --- fsck/fsck.c | 34 ++ fsck/fsck.h | 1 + fsck/main.c | 2 ++ 3 files

Re: [f2fs-dev] [PATCH] resize.f2fs: skip cursegs when finding next free block

2018-06-04 Thread Sheng Yong
Hi, Jaegeuk On 2018/6/5 4:55, Jaegeuk Kim wrote: On 06/04, Sheng Yong wrote: resize.f2fs (f2fs_defragment) tries to migrate blocks to new positions. However, if a curseg is selected, and f2fs_defragment is broken by any error, curseg->next_blkoff is left not updated. To avoid this, we s

[f2fs-dev] [PATCH] resize.f2fs: skip cursegs when finding next free block

2018-06-04 Thread Sheng Yong
resize.f2fs (f2fs_defragment) tries to migrate blocks to new positions. However, if a curseg is selected, and f2fs_defragment is broken by any error, curseg->next_blkoff is left not updated. To avoid this, we skip cursegs when finding next free block. Signed-off-by: Sheng Yong --- fsck/f2f

[f2fs-dev] [PATCH] f2fs: clear discard_wake earlier

2018-05-08 Thread Sheng Yong
If SBI_NEED_FSCK is set, discard_wake will never be cleared. As a result, the condition of wait_event_interruptible_timeout() is always true, which gets discard thread run too frequently. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/segment.c | 7 --- 1 file chan

[f2fs-dev] [PATCH] f2fs: do not check F2FS_INLINE_DOTS in recover

2018-04-22 Thread Sheng Yong
Only dir may have F2FS_INLINE_DOTS flag, so there is no need to check the flag in recover flow. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/recovery.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 1b23d3febe4c..709dd4

[f2fs-dev] [PATCH] f2fs: remove duplicated dquot_initialize and fix error handling

2018-04-21 Thread Sheng Yong
This patch removes duplicated dquot_initialize in recover_orphan_inode(), and fix the error handling if dquot_initialize fails. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/checkpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/checkp

[f2fs-dev] [PATCH] f2fs: check if inmem_pages list is empty correctly

2018-04-17 Thread Sheng Yong
`cur' will never be NULL, we should check inmem_pages list instead. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5854cc4e1d67..bf9dab55b370 100644 --

[f2fs-dev] [PATCH 2/2] f2fs-tools: remove duplicated declaration of f2fs_configuration c

2018-04-09 Thread Sheng Yong
The variable `c' is declared twice in f2fs_fs.h. This patch removes the second declaration. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- include/f2fs_fs.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 2b0be2d..cbfdab5

[f2fs-dev] [PATCH v2 1/2] f2fs-tools: introduce new option V to show version

2018-04-09 Thread Sheng Yong
This patch introduces a new option -V to show the version of f2fs tools and exit after that. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v2->v1: add -V for all f2fs tools fsck/main.c | 30 +- include/f2fs_fs.h | 6 +++

Re: [f2fs-dev] [PATCH] mkfs.f2fs: introduce new option V to show version

2018-04-09 Thread Sheng Yong
On 2018/4/10 1:55, Jaegeuk Kim wrote: On 04/08, Chao Yu wrote: On 2018/4/8 10:15, Sheng Yong wrote: This patch introduces a new option -V to show the version of mkfs.f2fs and exit after that. BTW, should we add -V for other misc tools? Yes, could you please add this for others? OK

[f2fs-dev] [PATCH] mkfs.f2fs: introduce new option V to show version

2018-04-07 Thread Sheng Yong
This patch introduces a new option -V to show the version of mkfs.f2fs and exit after that. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- mkfs/f2fs_format_main.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_

[f2fs-dev] [PATCH] resize.f2fs: clear CP_COMPACT_SUM_FLAG when rebuilding checkpoint

2018-04-07 Thread Sheng Yong
Resize rebuilds checkpoint with 6 summary blocks, so if CP_COMPACT_SUM_FLAG is set in the old checkpoint, clear it. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/resize.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsck/resize.c b/fsck/resize.c index 7643511..0

Re: [f2fs-dev] [PATCH 1/2] f2fs-tools: improve loggings

2018-03-18 Thread Sheng Yong
Hi, Ju Hyung and list, On 2018/3/17 23:04, Park Ju Hyung wrote: - Print errors and warnings to stderr - Print errors and warnings regardless of debugging level - Make info/error/warning logs consistent - Print POSIX errors when possible - Use more consistent terms and grammar Shall

[f2fs-dev] [RFC PATCH v5 3/3] ext4: do not allow mount with test_dummy_encryption if encrypt not set

2018-03-15 Thread Sheng Yong
When mounting with test_dummy_encryption option, if encrypt feature is not set, return fail instead of setting encrypt feature forcely. Cc: linux-e...@vger.kernel.org Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/ext4/super.c | 7 +++ 1 file changed, 3 insertions(+), 4 del

[f2fs-dev] [RFC PATCH v5 2/3] f2fs: introduce a new mount option test_dummy_encryption

2018-03-15 Thread Sheng Yong
This patch introduces a new mount option `test_dummy_encryption' to allow fscrypt to create a fake fscrypt context. This is used by xfstests. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- Documentation/filesystems/f2fs.txt | 2 ++ fs/f2fs/dir.c | 4 +++- f

[f2fs-dev] [RFC PATCH v5 0/3] f2fs: introduce F2FS_FEATURE_LOST_FOUND feature

2018-03-15 Thread Sheng Yong
* add sysfs entry for LOST_FOUND feature ---8<--- This patchset introduces LOST_FOUND feature in f2fs. If the feature is enabled, f2fs should avoid to encrypt root directory. A new mount option "test_dummy_encryption" is introduced, this is used by xfstests. Thanks, Sheng Sheng Yo

[f2fs-dev] [RFC PATCH v5 1/3] f2fs: introduce F2FS_FEATURE_LOST_FOUND feature

2018-03-15 Thread Sheng Yong
. lost+found directory could not be encrypted. As a result, the root directory cannot be encrypted too. So if LOST_FOUND feature is enabled, let's avoid to encrypt root directory. Signed-off-by: Sheng Yong <shengyo...@huawei.com> Reviewed-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/f2fs.h

Re: [f2fs-dev] [RFC PATCH v4 2/3] f2fs: introduce a new mount option test_dummy_encryption

2018-03-11 Thread Sheng Yong
Hi, Chao On 2018/3/9 20:32, Chao Yu wrote: On 2018/3/9 15:53, Sheng Yong wrote: This patch introduces a new mount option `test_dummy_encryption' to allow fscrypt to create a fake fscrypt context. This is used by xfstests. It needs to add doc for this new mount option. Oh. Right, I'll

[f2fs-dev] [RFC PATCH v4 0/3] f2fs: introduce F2FS_FEATURE_LOST_FOUND feature

2018-03-08 Thread Sheng Yong
is is used by xfstests. Thanks, Sheng Sheng Yong (3): f2fs: introduce F2FS_FEATURE_LOST_FOUND feature f2fs: introduce a new mount option test_dummy_encryption ext4: do not allow mount with test_dummy_encryption if encrypt not set fs/ext4/super.c | 5 +++-- fs/f2fs/dir.c | 4 +++-

[f2fs-dev] [RFC PATCH 3/3] ext4: do not allow mount with test_dummy_encryption if encrypt not set

2018-03-08 Thread Sheng Yong
When mounting with test_dummy_encryption option, if encrypt feature is not set, return fail instead of setting encrypt feature forcely. CC: linux-e...@vger.kernel.org Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/ext4/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 del

[f2fs-dev] [RFC PATCH v4 2/3] f2fs: introduce a new mount option test_dummy_encryption

2018-03-08 Thread Sheng Yong
This patch introduces a new mount option `test_dummy_encryption' to allow fscrypt to create a fake fscrypt context. This is used by xfstests. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/dir.c | 4 +++- fs/f2fs/f2fs.h | 11 +++ fs/f2fs/namei.c | 9 ++--- f

Re: [f2fs-dev] [PATCH] dump.f2fs: fix a wrong report for dump an {d, id, did}node

2018-03-06 Thread Sheng Yong
On 2018/3/7 11:30, heyunlei wrote: -Original Message- From: shengyong (A) Sent: Wednesday, March 07, 2018 11:21 AM To: heyunlei; jaeg...@kernel.org; Yuchao (T); linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH] dump.f2fs: fix a wrong report for dump an {d, id,

Re: [f2fs-dev] [PATCH] dump.f2fs: fix a wrong report for dump an {d, id, did}node

2018-03-06 Thread Sheng Yong
Hi, Yunlei, On 2018/3/7 10:41, Yunlei He wrote: fix a wrong report for dump an {d,id,did}node like this: [print_node_info: 283] Node ID [0x6820:26656] is direct node or indirect node. [0] [0x 16b6684 : 23815812] [1] [0x 16b6685 : 23815813] [2]

[f2fs-dev] [RFC PATCH v3 0/2] f2fs-tools: introduce F2FS_FEATURE_LOST_FOUND feature

2018-03-05 Thread Sheng Yong
Testcases: 1) corrupt nat_entry->blk_addr of dir [PASS] 2) corrupt nat_entry->blk_addr of encrypt-dir [PASS] 3) remove lost+found, then corrupt nat_entry->blk_addr of dir [PASS] Any comments and tests are appreciated. Thanks, Sheng Sheng Yong (2): mkfs.f2fs: create lost+found dir

[f2fs-dev] [RFC PATCH v3 1/2] mkfs.f2fs: create lost+found directory

2018-03-05 Thread Sheng Yong
have no parent directory or their parent directory is removed by fsck. Encrypted files are also allowed to be saved here. Signed-off-by: Sheng Yong <shengyo...@huawei.com> Reviewed-by: Chao Yu <yuch...@huawei.com> --- fsck/mount.c| 3 + include/f2fs_fs.h |

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

2018-03-05 Thread Sheng Yong
. This is used by xfstests. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v3->v2: * fix test_dummy_encryption v2->v1: * introduce new mount option test_dummy_encryption * add sysfs entry for LOST_FOUND feature fs/f2fs/dir.c | 6 -- fs/f2fs/f2fs.h | 17 ++

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

2018-03-05 Thread Sheng Yong
. If reconnect fails drop the node and restore filesystem metadata. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/dir.c | 19 ++- fsck/fsck.c | 389 ++- fsck/fsck.h | 3 + fsck/mount.c | 2 + 4 files change

[f2fs-dev] [PATCH] fibmap: include f2fs_fs.h before other header files

2018-02-27 Thread Sheng Yong
This is because config.h is not included first, as a result, macros defined in config.h is not recognized. So let's include f2fs_fs.h before other header files. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- tools/fibmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -

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

2018-02-22 Thread Sheng Yong
. This is used by xfstests. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v2->v1: * introduce new mount option test_dummy_context * add sysfs entry for LOST_FOUND feature fs/f2fs/f2fs.h | 6 ++ fs/f2fs/super.c | 37 + fs/f2fs/sysfs.c | 7 +++

[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 <shengyo...@huawei.com> --- fsck/fsck.c | 33 +++-- 1 file changed, 11 insertions(

[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 <shengyo...@huawei.com> --- fsck/mount

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

2018-02-22 Thread Sheng Yong
. And discard obsolete dnodes after all inodes are created. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- include/f2fs_fs.h | 5 mkfs/f2fs_format.c | 85 ++ 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/include/f2fs_

[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 <shengyo...@huawei.com> Reviewed-by: Chao Yu <yuch...@huawei.com> --- 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/l

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

2018-02-22 Thread Sheng Yong
have no parent directory or their parent directory is removed by fsck. Encrypted files are also allowed to be saved here. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/mount.c| 3 + include/f2fs_fs.h | 6 ++ mkfs/f2fs_format.c

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

2018-02-22 Thread Sheng Yong
. If reconnect fails drop the node and restore filesystem metadata. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/dir.c | 19 ++- fsck/fsck.c | 388 ++- fsck/fsck.h | 3 + fsck/mount.c | 2 + 4 files change

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

2018-02-22 Thread Sheng Yong
rupt nat_entry->blk_addr of dir [PASS] Any comments and tests are appreciated. Thanks, Sheng Sheng Yong (7): fsck.f2fs: fix typo mkfs.f2fs: introduce mkfs parameters in f2fs_configuration f2fs-tools: init f2fs_configuration as 0 fsck.f2fs: integrate sanity_check_inode to __check_inode_mode m

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

2018-02-22 Thread Sheng Yong
Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- 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)

Re: [f2fs-dev] [RFC PATCH 0/2] f2fs: introduce lost+found feature

2018-02-10 Thread Sheng Yong
Hi, Jaegeuk On 2018/2/10 10:50, Jaegeuk Kim wrote: On 02/06, Sheng Yong wrote: This patchset introduces lost+found feature in f2fs. If the feature is enabled, f2fs should avoid to encrypting root directory. In that case, we need to add test_dummy_encryption likewise ext4

Re: [f2fs-dev] [RFC PATCH 2/2] f2fs: introduce lost+found feature

2018-02-08 Thread Sheng Yong
Hi, Chao On 2018/2/8 21:29, Chao Yu wrote: On 2018/2/6 12:31, Sheng Yong wrote: Introduce lost+found feature. The lost+found is a directory which saves Nitpick, lost_found feature... Needs to add /sys/fs/f2fs/features/lost_found sysfs entry, and show 'lost_found' in /sys/fs/f2fs//features

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

2018-02-08 Thread Sheng Yong
Hi, Chao On 2018/2/8 23:08, Chao Yu wrote: On 2018/2/6 12:31, Sheng Yong wrote: This patch introduces a new feature F2FS_FEATURE_LOST_FOUND. It can be switched on by indicating a new option `lost+found' with -O. If Not sure, do we need to change this option to 'lost_found' to follow other

Re: [f2fs-dev] [RFC PATCH 1/5] mkfs.f2fs: introduce mkfs parameters in f2fs_configuration

2018-02-08 Thread Sheng Yong
Hi, Chao Add Hyojun. On 2018/2/8 21:30, Chao Yu wrote: On 2018/2/6 12:31, Sheng Yong wrote: /* only root inode was written before truncating dnodes */ last_inode_pos = start_inode_pos + - c.cur_seg[CURSEG_HOT_NODE] * c.blks_per_seg + quota_inum

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

2018-02-07 Thread Sheng Yong
On 2018/2/7 18:01, Sheng Yong wrote: [...] + +/* lookup lost+found in root directory */ +lpf_ino = f2fs_lookup(sbi, node, (u8 *) LPF, strlen(LPF)); The 4th parameter should be namelen but not strlen(LPF). Sorry for the noise. The comment here is wrong :( [...] + +static int

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

2018-02-07 Thread Sheng Yong
On 2018/2/6 12:31, Sheng Yong wrote: 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

[f2fs-dev] [RFC PATCH 0/2] f2fs: introduce lost+found feature

2018-02-05 Thread Sheng Yong
This patchset introduces lost+found feature in f2fs. If the feature is enabled, f2fs should avoid to encrypting root directory. For more information, please check the mail "f2fs-tools: introduce lost+ found feature". Thanks, Sheng Sheng Yong (2): f2fs: clean up f2fs_sb_has_xxx

[f2fs-dev] [RFC PATCH 1/2] f2fs: clean up f2fs_sb_has_xxx functions

2018-02-05 Thread Sheng Yong
This patch introduces F2FS_FEATURE_FUNCS to clean up the definitions of different f2fs_sb_has_xxx functions. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/data.c| 2 +- fs/f2fs/f2fs.h| 51 +-- fs/f2fs/file.c

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

2018-02-05 Thread Sheng Yong
to save unreachable files, which have no parent directory or their parent directory is removed by fsck. Encrypted files are also allowed to be saved here. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/mount.c| 3 + include/f2fs_fs.h | 6 ++ mkfs/f2fs_fo

[f2fs-dev] [RFC PATCH 2/5] f2fs-tools: init f2fs_configuration as 0

2018-02-05 Thread Sheng Yong
Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- 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 @@ -586,24 +586,17 @

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

2018-02-05 Thread Sheng Yong
. If reconnect fails drop the node and restore filesystem metadata. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/dir.c | 19 ++- fsck/fsck.c | 376 ++- fsck/fsck.h | 3 + fsck/mount.c | 2 + 4 files change

[f2fs-dev] [RFC PATCH 2/2] f2fs: introduce lost+found feature

2018-02-05 Thread Sheng Yong
, the root directory cannot be encrypted. So if lost+found feature is enabled, let's avoid to encrypt root directory. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/super.c | 12 2 files changed, 14 insertions(+) diff --git a/fs/f2fs/f2fs.

[f2fs-dev] [RFC PATCH 0/5] f2fs-tools: introduce lost+found feature

2018-02-05 Thread Sheng Yong
[Fail] [FIX] (nullify_nat_entry:2064) --> Remove nid [0xb] in NAT [FIX] (nullify_nat_entry:2064) --> Remove nid [0xf] in NAT Info: Write valid nat_bits in checkpoint Done. $ tree /data /data/ └── lost+found ├── 12 ├── 14 ├── 16 └── 6 Any comments and tests are app

[f2fs-dev] [RFC PATCH 1/5] mkfs.f2fs: introduce mkfs parameters in f2fs_configuration

2018-02-05 Thread Sheng Yong
. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- include/f2fs_fs.h | 5 + mkfs/f2fs_format.c | 46 +- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 548a3e8..ca4522d

[f2fs-dev] [RFC PATCH 3/5] fsck.f2fs: integrate sanity_check_inode to __check_inode_mode

2018-02-05 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 <shengyo...@huawei.com> --- fsck/fsck.c | 26 +- 1 file changed, 5 insertions(

Re: [f2fs-dev] [PATCH] f2fs: fix potential corruption in area before F2FS_SUPER_OFFSET

2018-01-29 Thread Sheng Yong
On 2018/1/29 16:58, Chao Yu wrote: Hi Sheng Yong, On 2018/1/29 16:39, Sheng Yong wrote: Hi, Chao On 2018/1/29 16:27, Chao Yu wrote: On 2018/1/29 16:04, Sheng Yong wrote: sb_getblk does not guarantee the buffer head is uptodate. If bh is not uptodate, the data (may be used as boot code

Re: [f2fs-dev] [PATCH] f2fs: fix potential corruption in area before F2FS_SUPER_OFFSET

2018-01-29 Thread Sheng Yong
Hi, Chao On 2018/1/29 16:27, Chao Yu wrote: On 2018/1/29 16:04, Sheng Yong wrote: sb_getblk does not guarantee the buffer head is uptodate. If bh is not uptodate, the data (may be used as boot code) in area before Why boot code can be stored into the position f2fs superblock locates

[f2fs-dev] [PATCH] f2fs: fix potential corruption in area before F2FS_SUPER_OFFSET

2018-01-29 Thread Sheng Yong
sb_getblk does not guarantee the buffer head is uptodate. If bh is not uptodate, the data (may be used as boot code) in area before F2FS_SUPER_OFFSET may get corrupted when super block is committed. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/super.c | 4 ++-- 1 file chan

[f2fs-dev] [PATCH v2] f2fs: avoid hungtask when GC encrypted block if io_bits is set

2018-01-16 Thread Sheng Yong
0 Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v2->v1: do not change the index in meta inode make move_data_block aware EAGAIN error --- fs/f2fs/gc.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 33e79697e41c..aa720c

[f2fs-dev] [PATCH] f2fs: avoid hungtask when gc encrypted block if io_bits is set

2018-01-10 Thread Sheng Yong
k+0x3a7/0x6f0 [ 246.756533] worker_thread+0x82/0x750 [ 246.756537] kthread+0x16f/0x1c0 [ 246.756541] ? trace_event_raw_event_workqueue_work+0x110/0x110 [ 246.756544] ? kthread_create_worker_on_cpu+0xb0/0xb0 [ 246.756548] ret_from_fork+0x1f/0x30 Signed-off-by: Sheng Yong <shengyo...@huawei.com>

Re: [f2fs-dev] [RFC PATCH 1/3] f2fs: introduce sysfs readdir_ra to readahead inode block in readdir

2018-01-01 Thread Sheng Yong
an option for user to decide if the readahead is needed. thanks, Sheng On Thu, Nov 23, 2017 at 10:11 PM, Chao Yu <c...@kernel.org> wrote: On 2017/11/22 18:23, Sheng Yong wrote: This patch introduces a sysfs interface readdir_ra to enable/disable readaheading inode block in f2fs_readdir.

Re: [f2fs-dev] [PATCH] fsck.f2fs: check nid range before use to avoid segmentation fault

2017-12-15 Thread Sheng Yong
On 2017/12/15 14:26, Yunlong Song wrote: Signed-off-by: Yunlong Song --- fsck/fsck.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 11b8b0b..2212aa3 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -14,6

Re: [f2fs-dev] [PATCH] fsck.f2fs: check and fix i_namelen to avoid double free

2017-12-15 Thread Sheng Yong
On 2017/12/15 14:25, Yunlong Song wrote: Signed-off-by: Yunlong Song --- fsck/fsck.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 2212aa3..8ff4e4b 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c

[f2fs-dev] [PATCH 3/3] f2fs: remove unused parameter

2017-11-22 Thread Sheng Yong
Commit d260081ccf37 ("f2fs: change recovery policy of xattr node block") removes the use of blkaddr, which is no longer used. So remove the parameter. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fs/f2fs/f2fs.h | 3 +-- fs/f2fs/node.c | 2 +- fs/f2fs/recovery

[f2fs-dev] [PATCH 2/3] f2fs: still write data if preallocate only partial blocks

2017-11-22 Thread Sheng Yong
If there is not enough space left, f2fs_preallocate_blocks may only preallocte partial blocks. As a result, the write operation fails but i_blocks is not 0. To avoid this, f2fs should write data in non-preallocation way and write as many data as the size of i_blocks. Signed-off-by: Sheng Yong

[f2fs-dev] [RFC PATCH 1/3] f2fs: introduce sysfs readdir_ra to readahead inode block in readdir

2017-11-22 Thread Sheng Yong
0m01.94s user 0m50.80s system enable readdir_ra: 0m18.55s real 0m00.44s user 0m15.39s system Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++ fs/f2fs/dir.c | 4 fs/f2fs/f2fs.h

[f2fs-dev] [PATCH v5] dump/fsck: introduce print_xattr_entry

2017-11-02 Thread Sheng Yong
This patch exports read_all_xattrs to allow dump/fsck to get all xattrs, and introduces print_xattr_entry which tries to parse an xattr entry accroding to its xattr index. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v3->v5: Please ignore the previous [PATCH v3/v4] because o

[f2fs-dev] [PATCH v4] dump/fsck: introduce print_xattr_entry

2017-11-02 Thread Sheng Yong
This patch exports read_all_xattrs to allow dump/fsck to get all xattrs, and introduces print_xattr_entry which tries to parse an xattr entry accroding to its xattr index. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v3->v4: Please ignore the previous [PATCH v3] because o

[f2fs-dev] [PATCH v3] dump/fsck: introduce print_xattr_entry

2017-11-02 Thread Sheng Yong
This patch exports read_all_xattrs to allow dump/fsck to get all xattrs, and introduces print_xattr_entry which tries to parse an xattr entry accroding to its xattr index. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- v2->v3: check if is supported. If it is not, print ACL val

[f2fs-dev] [RFC PATCH v2 9/9] fsck.f2fs: format output message of FIX_MSG

2017-11-01 Thread Sheng Yong
This patch removes an extra '\n' at the end of the string in FIX_MSG. Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/fsck.c | 4 ++-- fsck/mount.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 77490d8..1905319

[f2fs-dev] [RFC PATCH v2 6/9] fsck.f2fs: introduce new option --dry-run

2017-11-01 Thread Sheng Yong
With --dry-run enabled, fsck.f2fs will do all checks and "fixes" except that all fixes will not be written to storage at last. Signed-off-by: Sheng Yong <shengyo...@huawei.com> Reviewed-by: Chao Yu <yuch...@huawei.com> --- fsck/main.c | 14 +- include

<    1   2   3   >