[f2fs-dev] [PATCH v6] f2fs-tools: support to show fscrypt_context_v2 in print_xattr_entry

2023-07-17 Thread Weichao Guo via Linux-f2fs-devel
As the fscrypt context has two versions now, this patch adds the support of fscrypt_context_v2 for print_xattr_entry. Signed-off-by: Weichao Guo Signed-off-by: Sheng Yong --- v6: - print notice for unsupported fscrypt_context version v5: - check if e_name/e_name_len is match

[f2fs-dev] [PATCH v5] f2fs-tools: support to show fscrypt_context_v2 in print_xattr_entry

2023-07-16 Thread Weichao Guo via Linux-f2fs-devel
As the fscrypt context has two versions now, this patch adds the support of fscrypt_context_v2 for print_xattr_entry. Signed-off-by: Weichao Guo Signed-off-by: Sheng Yong --- fsck/mount.c | 53 +++--- fsck/xattr.h | 55

[f2fs-dev] [PATCH v4] f2fs-tools: support to show fscrypt_context_v2 in print_xattr_entry

2023-07-15 Thread Weichao Guo via Linux-f2fs-devel
As the fscrypt context has two versions now, this patch adds the support of fscrypt_context_v2 for print_xattr_entry. Signed-off-by: Weichao Guo Signed-off-by: Sheng Yong --- fsck/mount.c | 48 ++ fsck/xattr.h | 54

[f2fs-dev] [PATCH v3] f2fs-tools: support to show fscrypt_context_v2 in print_xattr_entry

2023-07-14 Thread Weichao Guo via Linux-f2fs-devel
As the fscrypt context has two versions now, this patch adds the support of fscrypt_context_v2 for print_xattr_entry. Signed-off-by: Weichao Guo Signed-off-by: Sheng Yong --- fsck/mount.c | 48 ++ fsck/xattr.h | 54

[f2fs-dev] [PATCH v2] f2fs-tools: support to show fscrypt_context_v2 in print_xattr_entry

2023-07-14 Thread Weichao Guo via Linux-f2fs-devel
As the fscrypt context has two versions now, this patch adds the support of fscrypt_context_v2 for print_xattr_entry. Signed-off-by: Weichao Guo Signed-off-by: Sheng Yong --- fsck/mount.c | 46 +--- fsck/xattr.h | 54

[f2fs-dev] [PATCH] f2fs-tools: support print_xattr_entry with fscrypt context v2

2023-07-12 Thread Weichao Guo via Linux-f2fs-devel
Signed-off-by: Weichao Guo Signed-off-by: Sheng Yong --- fsck/mount.c | 44 +++--- fsck/xattr.h | 54 +++- 2 files changed, 74 insertions(+), 24 deletions(-) diff --git a/fsck/mount.c b/fsck/mount.c index

[f2fs-dev] [PATCH] f2fs: let FI_OPU_WRITE override FADVISE_COLD_BIT

2022-09-06 Thread Weichao Guo via Linux-f2fs-devel
Cold files may be fragmented due to SSR, defragment is needed as sequential reads are dominant scenarios of these files. FI_OPU_WRITE should override FADVISE_COLD_BIT to avoid defragment fails. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu --- fs/f2fs/data.c | 2 +- 1 file changed, 1

[f2fs-dev] [PATCH v2] fsck.f2fs: use elapsed_time in checkpoint for period check

2022-08-31 Thread Weichao Guo via Linux-f2fs-devel
, the period check in next fsck will fail to skip or start a full scan. So, let's use the elapsed_time in checkpoint as current time for period check. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu --- fsck/mount.c | 85 ++-- 1 file changed

[f2fs-dev] [PATCH] fsck.f2fs: use elapsed_time in checkpoint for period check

2022-08-11 Thread Weichao Guo via Linux-f2fs-devel
, the period check in next fsck will fail to skip or start a full scan. So, let's use the elapsed_time in checkpoint as current time for period check. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu --- fsck/mount.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fsck

[f2fs-dev] [PATCH] f2fs: allocate consective blkaddrs for defragment

2022-08-11 Thread Weichao Guo via Linux-f2fs-devel
When we try to defrag a file, its data blocks may mess with others if there are lots of concurrent writes. This causes the file is still fragmented after defrag. So It's better to isolate defrag writes from others. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 4

[f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling

2022-05-06 Thread Weichao Guo
From: Weichao Guo If the number of unusable blocks is not larger than unusable capacity, we can skip GC when checkpoint disabling. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu --- fs/f2fs/super.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c

[f2fs-dev] [PATCH] f2fs: avoid EINVAL by SBI_NEED_FSCK when first time pinning a file

2022-01-19 Thread Weichao Guo
From: Weichao Guo When first time pinning a file with size 0, and SBI_NEED_FSCK is set, we still got EINVAL after this fix: 19bdba5 (f2fs: avoid EINVAL by SBI_NEED_FSCK when pinning a file). Let's avoid it since this new created file can do in-place-update. Signed-off-by: Weichao Guo --- fs

[f2fs-dev] [PATCH] f2fs: set SBI_NEED_FSCK flag when inconsistent node block found

2021-09-18 Thread Weichao Guo via Linux-f2fs-devel
-by: Weichao Guo --- fs/f2fs/node.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e863136..556fcd8 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1443,6 +1443,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid

[f2fs-dev] [PATCH v2] f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC

2021-03-17 Thread Weichao Guo via Linux-f2fs-devel
modes. Signed-off-by: Weichao Guo Signed-off-by: Huang Jianan Reviewed-by: Chao Yu --- fs/f2fs/gc.c | 3 ++- fs/f2fs/segment.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 86ba8ed..d96acc6 100644 --- a/fs/f2fs/gc.c +++ b/fs

[f2fs-dev] [PATCH] f2fs: do not use AT_SSR mode in FG_GC & high urgent BG_GC

2021-03-17 Thread Weichao Guo via Linux-f2fs-devel
modes. Signed-off-by: Weichao Guo Signed-off-by: Huang Jianan --- fs/f2fs/gc.c | 3 ++- fs/f2fs/segment.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 86ba8ed..0f2c34f 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1120,7

Re: [f2fs-dev] [RFC PATCH] f2fs: do not use CURSEG_ALL_DATA_ATGC in foreground or urgent GC

2021-03-17 Thread Weichao Guo via Linux-f2fs-devel
On 2021/3/17 14:41, Chao Yu wrote: On 2021/3/17 11:44, Weichao Guo wrote: On 2021/3/17 10:40, Chao Yu wrote: On 2021/3/16 21:15, Weichao Guo via Linux-f2fs-devel wrote: CURSEG_ALL_DATA_ATGC is introduced by age threshold based GC for better hot/cold data seperation and avoiding free

Re: [f2fs-dev] [RFC PATCH] f2fs: do not use CURSEG_ALL_DATA_ATGC in foreground or urgent GC

2021-03-16 Thread Weichao Guo via Linux-f2fs-devel
On 2021/3/17 10:40, Chao Yu wrote: On 2021/3/16 21:15, Weichao Guo via Linux-f2fs-devel wrote: CURSEG_ALL_DATA_ATGC is introduced by age threshold based GC for better hot/cold data seperation and avoiding free segment cost. However, LFS write mode is preferred in the scenario of foreground

Re: [f2fs-dev] [PATCH] f2fs: fix to set inode->i_mode correctly for posix_acl_update_mode

2020-12-22 Thread Weichao Guo
On 2020/12/23 12:38, Weichao Guo wrote: On 2020/12/23 9:14, Chao Yu wrote: On 2020/12/22 20:14, Weichao Guo wrote: On 2020/12/22 18:49, Chao Yu wrote: On 2020/12/22 17:32, Weichao Guo wrote: On 2020/12/22 16:24, Chao Yu wrote: On 2020/12/14 11:54, Weichao Guo wrote: We should update

Re: [f2fs-dev] [PATCH] f2fs: fix to set inode->i_mode correctly for posix_acl_update_mode

2020-12-22 Thread Weichao Guo
On 2020/12/23 9:14, Chao Yu wrote: On 2020/12/22 20:14, Weichao Guo wrote: On 2020/12/22 18:49, Chao Yu wrote: On 2020/12/22 17:32, Weichao Guo wrote: On 2020/12/22 16:24, Chao Yu wrote: On 2020/12/14 11:54, Weichao Guo wrote: We should update the ~S_IRWXUGO part of inode->i_m

Re: [f2fs-dev] [PATCH] f2fs: fix to set inode->i_mode correctly for posix_acl_update_mode

2020-12-22 Thread Weichao Guo
On 2020/12/22 18:49, Chao Yu wrote: On 2020/12/22 17:32, Weichao Guo wrote: On 2020/12/22 16:24, Chao Yu wrote: On 2020/12/14 11:54, Weichao Guo wrote: We should update the ~S_IRWXUGO part of inode->i_mode in __setattr_copy, because posix_acl_update_mode updates mode based on in

Re: [f2fs-dev] [PATCH] f2fs: fix to set inode->i_mode correctly for posix_acl_update_mode

2020-12-22 Thread Weichao Guo
On 2020/12/22 16:24, Chao Yu wrote: On 2020/12/14 11:54, Weichao Guo wrote: We should update the ~S_IRWXUGO part of inode->i_mode in __setattr_copy, because posix_acl_update_mode updates mode based on inode->i_mode, which finally overwrites the ~S_IRWXUGO part of i_acl_mode with old

[f2fs-dev] [PATCH] f2fs: fix to set inode->i_mode correctly for posix_acl_update_mode

2020-12-13 Thread Weichao Guo
unt -t f2fs /dev/sdd /mnt/f2fs 3. mkdir /mnt/f2fs/test 4. setfacl -m u:abc:r /mnt/f2fs/test 5. chmod +s /mnt/f2fs/test Signed-off-by: Weichao Guo Signed-off-by: Bin Shu --- fs/f2fs/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 16ea10f..4d355f9

[f2fs-dev] [PATCH v3] fsck.f2fs: write checkpoint out of place first

2018-07-29 Thread Weichao Guo
. Signed-off-by: Weichao Guo --- fsck/defrag.c | 2 +- fsck/fsck.c | 15 ++- fsck/fsck.h | 1 + fsck/mount.c | 17 +++-- fsck/sload.c | 2 +- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/fsck/defrag.c b/fsck/defrag.c index bea0293..9fc932f 100644

[f2fs-dev] [RFC PATCH v2] fsck.f2fs: write checkpoint out of place first

2018-07-26 Thread Weichao Guo
. Signed-off-by: Weichao Guo --- fsck/defrag.c | 2 +- fsck/fsck.c | 14 +- fsck/fsck.h | 1 + fsck/mount.c | 16 ++-- fsck/sload.c | 2 +- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/fsck/defrag.c b/fsck/defrag.c index bea0293..9fc932f 100644

[f2fs-dev] [PATCH RFC] fsck.f2fs: write checkpoint out of place first

2018-07-24 Thread Weichao Guo
. Signed-off-by: Weichao Guo --- fsck/fsck.c | 13 - fsck/mount.c | 13 - 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 91c8529..28320d5 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1954,6 +1954,7 @@ static void

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

2018-03-08 Thread Weichao Guo
Enable in-memory inode checksum to protect metadata blocks from in-memory scribbles when checking consistency, which has no performance requirements. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/inode.c | 7 +++ fs/f2fs/node.c | 10 +- 2 files chang

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

2018-03-08 Thread Weichao Guo
Only enable in-memory inode checksum to protect metadata blocks from in-memory scribbles when checking consistency, which has no performance requirements. --- fs/f2fs/inode.c | 7 +++ fs/f2fs/node.c | 10 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git

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

2018-03-07 Thread Weichao Guo
Only enable in-memory inode checksum to protect metadata blocks from in-memory scribbles when checking consistency, which has no performance requirements. --- fs/f2fs/inline.c | 18 ++ fs/f2fs/inode.c | 10 ++ fs/f2fs/node.c | 4 +++- fs/f2fs/node.h | 24

[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 <guoweic...@huawei.com> --- fs/f2fs/inode.c | 7 +++ fs/f2fs/node.c | 5 + 2 files changed, 12 inse

[f2fs-dev] [PATCH v3] f2fs: report cp block corrupted

2018-02-04 Thread Weichao Guo
issues from f2fs logical bugs in debug version. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/checkpoint.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 8b0945b..16ba96a 100644 --- a/f

[f2fs-dev] [PATCH] f2fs: no need to flush NAT bits if no enough space

2018-02-04 Thread Weichao Guo
NAT bits are saved at spare space in CP pack. Flushed NAT bits may be overwritten by the CP pack if there is no enough space for NAT bits. And NAT bits will be obsolesced at next mount time if crc|cp_ver not matched. So just skip to flush NAT bits in such needless cases. Signed-off-by: Weichao

[f2fs-dev] [PATCH v2] f2fs: report cp block corrupted

2018-02-04 Thread Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues: 1) write nodes into segment x; 2) write checkpoint A; 3) remove nodes in segment x; 4) write checkpoint B; 5) issue discard or write datas into segment x; 6) sudden

[f2fs-dev] [PATCH] f2fs: report cp block corrupted

2018-02-02 Thread Weichao Guo
issues from f2fs logical bugs in debug version. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/checkpoint.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 512dca8..15baba75 100644 --- a/f

[f2fs-dev] [PATCH RFC] f2fs: add PRE2 to mark segments free to one checkpoint but obsolete to the other

2018-01-19 Thread Weichao Guo
an inconsistent file system status. How about add an PRE2 status for prefree segments, and make sure the segments could be used safely to both checkpoints? Or any better solutions? Or this is not a problem? Look forward to your comments! Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2f

[f2fs-dev] [PATCH] f2fs: skip searching non-exist range in truncate_hole

2017-10-13 Thread Weichao Guo
Let's skip entire non-exist area to speed up truncate_hole by using get_next_page_offset. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 517e112..819c29a

[f2fs-dev] [PATCH] f2fs: no need to punch hole far beyond the file size

2017-10-13 Thread Weichao Guo
a long time. Let's fix this case by setting the hole to end after the page that contains i_size. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/file.c | 8 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 517e112..1b44d26 100644

[f2fs-dev] [PATCH v2] f2fs: make sure f2fs_gc returns consistent errno

2017-05-10 Thread Weichao Guo
By default, f2fs_gc returns -EINVAL in general error cases, e.g., no victim was selected. However, the default errno may be overwritten in two cases: gc_more and BG_GC -> FG_GC. We should return consistent errno in such cases. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/

[f2fs-dev] [PATCH] f2fs: fix BG_GC count stat

2017-05-08 Thread Weichao Guo
We should call stat_inc_bggc_count only after BG_GC has been performed successfully. Otherwise, BG_GC count may be larger than total count when f2fs_gc failed, e.g., no victim was selected. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/gc.c | 4 ++-- 1 file changed, 2 inse

[f2fs-dev] [PATCH] f2fs: fix BG_GC count stat & f2fs_gc return value

2017-05-05 Thread Weichao Guo
errno may be overwritten in the case of BG_GC -> FG_GC. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 0265221..a42cafe 100644 --- a/fs/f2fs/gc.c +++ b/fs/

[f2fs-dev] [PATCH] f2fs: skip checkpoint if having a dirty segment but no prefree at BG_GC -> FG_GC

2017-02-24 Thread Weichao Guo
. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/gc.c | 7 ++- 1 file chan

[f2fs-dev] [PATCH v2] F2FS customized migrate_page callback

2016-09-19 Thread Weichao Guo
, there is no need to write back first when migrating. For an atomic written page before committing, we can migrate the page and update the related 'inmem_pages' list at the same time. Signed-off-by: Weichao Guo <guoweic...@huawei.com> --- fs/f2fs/checkpoint.c | 3 +++ fs/f2fs/data.c

[f2fs-dev] [PATCH] F2FS customized migrate_page callback

2016-09-18 Thread Weichao Guo
This patch improves the migration of dirty pages and allows migrating atomic written pages that F2FS uses in Page Cache. Instead of the fallback releasing page path, it provides better performance for memory compaction, CMA and other users of memory page migrating. For dirty pages, there is no