[f2fs-dev] [PATCH v3 1/2] f2fs: avoid redundant clean nat entry move in lru list

2025-07-27 Thread wangzijie
__lookup_nat_cache follows LRU manner to move clean nat entry, when nat entries are going to be dirty, no need to move them to tail of lru list. Introduce a parameter 'for_dirty' to avoid it. Signed-off-by: wangzijie --- v3: - followed by Chao's suggestion to update comments v2

[f2fs-dev] [PATCH v3 2/2] f2fs: directly add newly allocated pre-dirty nat entry to dirty set list

2025-07-27 Thread wangzijie
When we need to alloc nat entry and set it dirty, we can directly add it to dirty set list(or initialize its list_head for new_ne) instead of adding it to clean list and make a move. Introduce init_dirty flag to do it. Signed-off-by: wangzijie --- v3: - followed by Chao's suggestion to cle

Re: [f2fs-dev] [PATCH v2 2/2] f2fs: directly add newly allocated pre-dirty nat entry to dirty set list

2025-07-24 Thread wangzijie
> On 7/22/25 22:36, wangzijie wrote: > > When we need to alloc nat entry and set it dirty, we can directly add it to > > dirty set list(or initialize its list_head for new_ne) instead of adding it > > to clean list and make a move. Introduce init_dirty flag to do it. &

Re: [f2fs-dev] [PATCH v2 1/2] f2fs: avoid redundant clean nat entry move in lru list

2025-07-23 Thread wangzijie
> On 7/22/25 22:36, wangzijie wrote: > > __lookup_nat_cache follows LRU manner to move clean nat entry, when nat > > entries are going to be dirty, no need to move them to tail of lru list. > > Introduce a parameter 'for_dirty' to avoid it. > > > &g

[f2fs-dev] [PATCH v2 1/2] f2fs: avoid redundant clean nat entry move in lru list

2025-07-22 Thread wangzijie
__lookup_nat_cache follows LRU manner to move clean nat entry, when nat entries are going to be dirty, no need to move them to tail of lru list. Introduce a parameter 'for_dirty' to avoid it. Signed-off-by: wangzijie --- v2: - followed by Jaegeuk's suggestion to add

[f2fs-dev] [PATCH v2 2/2] f2fs: directly add newly allocated pre-dirty nat entry to dirty set list

2025-07-22 Thread wangzijie
When we need to alloc nat entry and set it dirty, we can directly add it to dirty set list(or initialize its list_head for new_ne) instead of adding it to clean list and make a move. Introduce init_dirty flag to do it. Signed-off-by: wangzijie --- fs/f2fs/node.c | 37

[f2fs-dev] [PATCH 2/2] f2fs: directly add newly allocated pre-dirty nat entry to dirty set list

2025-07-18 Thread wangzijie
When we need to alloc nat entry and set it dirty, we can directly add it to dirty set list(or initialize its list_head for new_ne) instead of adding it to clean list and make a move. Introduce init_dirty flag to do it. Signed-off-by: wangzijie --- fs/f2fs/node.c | 37

[f2fs-dev] [PATCH 1/2] f2fs: avoid redundant clean nat entry move in lru list

2025-07-18 Thread wangzijie
__lookup_nat_cache follows LRU manner to move clean nat entry, when nat entries are going to be dirty, no need to move them to tail of lru list. Signed-off-by: wangzijie --- fs/f2fs/node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c

Re: [f2fs-dev] [PATCH v5 2/2] f2fs: don't allow unaligned truncation to smaller/equal size on pinned file

2025-06-30 Thread wangzijie
1-wangzij...@honor.com/ https://lore.kernel.org/linux-f2fs-devel/20250624035938.3176350-2-wangzij...@honor.com/ >On 06/30, wangzijie wrote: >> To prevent scattered pin block generation, don't allow non-section aligned >> truncation >> to smaller or equal size on pinned

[f2fs-dev] [PATCH v5 2/2] f2fs: don't allow unaligned truncation to smaller/equal size on pinned file

2025-06-30 Thread wangzijie
to pinned file, so we don't need to consider attr->ia_size > i_size case. In addition, xfstests #494 assumes truncation on active swapfile(pinned) will return ETXTBSY by setattr_prepare() -> inode_newsize_ok(), so we relocate this check after setattr_prepare(). Signed-off-by: wang

[f2fs-dev] [PATCH v5 1/2] f2fs: convert F2FS_I_SB to sbi in f2fs_setattr()

2025-06-30 Thread wangzijie
Introduce sbi in f2fs_setattr() and convert F2FS_I_SB to it. No logic change, just cleanup and prepare to get CAP_BLKS_PER_SEC(sbi). Signed-off-by: wangzijie --- fs/f2fs/file.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c

Re: [f2fs-dev] [PATCH v4 2/2] f2fs: don't allow unaligned truncation to smaller/equal size on pinned file

2025-06-29 Thread wangzijie
>On 6/24/25 11:59, wangzijie wrote: >> To prevent scattered pin block generation, don't allow non-section aligned >> truncation >> to smaller or equal size on pinned file. But for truncation to larger size, >> after >> commit 3fdd89b452c2("f2fs: pre

[f2fs-dev] [PATCH v4 1/2] f2fs: convert F2FS_I_SB to sbi in f2fs_setattr()

2025-06-23 Thread wangzijie
Introduce sbi in f2fs_setattr() and convert F2FS_I_SB to it. No logic change, just cleanup and prepare to get CAP_BLKS_PER_SEC(sbi). Signed-off-by: wangzijie --- fs/f2fs/file.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c

[f2fs-dev] [PATCH v4 2/2] f2fs: don't allow unaligned truncation to smaller/equal size on pinned file

2025-06-23 Thread wangzijie
to pinned file, so we don't need to consider attr->ia_size > i_size case. Signed-off-by: wangzijie --- v4: - convert sbi first and apply change --- fs/f2fs/file.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 209f43653..4809

[f2fs-dev] [PATCH v3 2/2] f2fs: cleanup F2FS_I_SB in f2fs_setattr()

2025-06-18 Thread wangzijie
After introduce sbi in f2fs_setattr(), cleanup F2FS_I_SB. No logic change. Signed-off-by: wangzijie --- fs/f2fs/file.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 9e0f1c98f..4809f0fd6 100644 --- a/fs/f2fs/file.c +++ b

[f2fs-dev] [PATCH v3 1/2] f2fs: don't allow unaligned truncation to smaller/equal size on pinned file

2025-06-17 Thread wangzijie
to pinned file, so we don't need to consider attr->ia_size > i_size case. Signed-off-by: wangzijie --- v3: - cover attr->ia_size == i_size case v2: - add comments and change a proper subject --- fs/f2fs/file.c | 12 1 file changed, 12 insertions(+) diff --git a/fs

[f2fs-dev] [PATCH v2 1/2] f2fs: don't allow unaligned truncation to smaller size on pinned file

2025-06-17 Thread wangzijie
ly support overwrite IO to pinned file, so we don't need to consider > attr->ia_size > i_size case. > > Signed-off-by: wangzijie > --- > v2: > - add comments and change a proper subject > --- > fs/f2fs/file.c | 12 > 1 file changed, 12 insertions

[f2fs-dev] [PATCH v2 2/2] f2fs: cleanup F2FS_I_SB in f2fs_setattr()

2025-06-17 Thread wangzijie
After introduce sbi in f2fs_setattr(), cleanup F2FS_I_SB. No logic change. Signed-off-by: wangzijie --- fs/f2fs/file.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 09be6e849..3e610db59 100644 --- a/fs/f2fs/file.c +++ b

[f2fs-dev] [PATCH v2 1/2] f2fs: don't allow unaligned truncation to smaller size on pinned file

2025-06-17 Thread wangzijie
ned file, so we don't need to consider attr->ia_size > i_size case. Signed-off-by: wangzijie --- v2: - add comments and change a proper subject --- fs/f2fs/file.c | 12 1 file changed, 12 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 6bd3de64f..09be6e849 1

Re: [f2fs-dev] [PATCH 1/2] f2fs: avoid non-section-aligned size pinned file generation

2025-06-17 Thread wangzijie
>On 6/17/25 15:36, wangzijie wrote: >>> On 6/17/25 11:57, wangzijie wrote: >>>> To prevent non-section-aligned size pinned file generated from truncation, >>>> add check condition in setattr. >>>> >>>> Signed-off-by: wangzijie >

Re: [f2fs-dev] [PATCH 1/2] f2fs: avoid non-section-aligned size pinned file generation

2025-06-17 Thread wangzijie
> On 6/17/25 11:57, wangzijie wrote: > > To prevent non-section-aligned size pinned file generated from truncation, > > add check condition in setattr. > > > > Signed-off-by: wangzijie > > --- > > fs/f2fs/file.c | 6 ++ > > 1 file changed,

[f2fs-dev] [PATCH 1/2] f2fs: avoid non-section-aligned size pinned file generation

2025-06-16 Thread wangzijie
To prevent non-section-aligned size pinned file generated from truncation, add check condition in setattr. Signed-off-by: wangzijie --- fs/f2fs/file.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 6bd3de64f..72f7d1b4a 100644 --- a/fs/f2fs/file.c

[f2fs-dev] [PATCH 2/2] f2fs: cleanup F2FS_I_SB in f2fs_setattr()

2025-06-16 Thread wangzijie
After introduce sbi in f2fs_setattr(), cleanup F2FS_I_SB. No logic change. Signed-off-by: wangzijie --- fs/f2fs/file.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 72f7d1b4a..4ca1c2dfc 100644 --- a/fs/f2fs/file.c +++ b

[f2fs-dev] [PATCH] f2fs: avoid non-section-aligned size pinned file generation

2025-06-13 Thread wangzijie
To prevent non-section-aligned size pinned file generated from truncation, add check condition in setattr. Meanwhile, clean up F2FS_I_SB. Signed-off-by: wangzijie --- fs/f2fs/file.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/file.c b/fs

Re: [f2fs-dev] [PATCH v2] f2fs: introduce reserved_pin_section sysfs entry

2025-06-13 Thread wangzijie
to introduce this sysfs entry. Reviewed-by: wangzijie > --- > v2: > - assign SM_I(sbi)->ovp_segments after f2fs_build_segment_manager() > Documentation/ABI/testing/sysfs-fs-f2fs | 9 + > fs/f2fs/f2fs.h | 3 +++ > fs/f2fs/file.c

Re: [f2fs-dev] [PATCH] f2fs: introduce reserved_pin_section sysfs entry

2025-06-12 Thread wangzijie
> This patch introduces /sys/fs/f2fs//reserved_pin_section for tuning > @needed parameter of has_not_enough_free_secs(), if we configure it w/ > zero, it can avoid f2fs_gc() as much as possible while fallocating on > pinned file. > > Signed-off-by: Chao Yu > --- > Documentation/ABI/testing/sysfs

Re: [f2fs-dev] [PATCH] f2fs: continue to allocate pinned section when gc happens EAGAIN

2025-06-12 Thread wangzijie
>On 2025/6/12 20:34, wangzijie wrote: >>> On 6/12/25 11:27, wangzijie wrote: >>>> Wu Bo once mentioned a fallocate fail scenario in this link[1]. >>>> After commit 3fdd89b452c2("f2fs: prevent writing without fallocate() >>>> for pinned files&quo

Re: [f2fs-dev] [PATCH] f2fs: continue to allocate pinned section when gc happens EAGAIN

2025-06-12 Thread wangzijie
> On 6/12/25 11:27, wangzijie wrote: > > Wu Bo once mentioned a fallocate fail scenario in this link[1]. > > After commit 3fdd89b452c2("f2fs: prevent writing without fallocate() > > for pinned files"), we cannot directly generate 4K size file and > > pin it,

[f2fs-dev] [PATCH] f2fs: continue to allocate pinned section when gc happens EAGAIN

2025-06-11 Thread wangzijie
an continue to allocate pinned section when gc happens EAGAIN. Even if we don't have free section, f2fs_allocate_pinning_section() can fail with ENOSPC. [1] https://lore.kernel.org/linux-f2fs-devel/20231030094024.263707-1-bo...@vivo.com/t/#u Signed-off-by: wangzijie --- fs/f2fs/file.

Re: [f2fs-dev] [PATCH] f2fs : add a ioctl to estimate compression gain

2025-05-22 Thread wangzijie
>On 5/22/25 09:52, wangzijie wrote: >> This patch add a ioctl to estimate compression gain. In user mode >> compression, users can define >> the interval between clusters for estimation sampling before compress and >> release ioctl to a file. >> This can h

[f2fs-dev] [PATCH] f2fs : add a ioctl to estimate compression gain

2025-05-21 Thread wangzijie
. Signed-off-by: wangqi Signed-off-by: wangzijie --- fs/f2fs/compress.c| 107 ++ fs/f2fs/f2fs.h| 5 ++ fs/f2fs/file.c| 38 +- include/uapi/linux/f2fs.h | 8 +++ 4 files changed, 157 insertions(+), 1 deletion

[f2fs-dev] [PATCH v3] f2fs-tools: reduce memory alloc and copy for xattr

2024-12-30 Thread wangzijie
ee(xattrs) to free buffer properly. [1] https://lore.kernel.org/linux-f2fs-devel/502ae396-ae82-44d6-b08d-617e9e9c4...@oppo.com/ Signed-off-by: wangzijie --- v2 -> v3: - fix read_all_xattrs logic to check and set xattr header - change parameter name for read_all_xattrs - change subject v

[f2fs-dev] [PATCH v2] f2fs-tools: Check and fix inline xattr inplace

2024-12-10 Thread wangzijie
-f2fs-devel/502ae396-ae82-44d6-b08d-617e9e9c4...@oppo.com/ Signed-off-by: wangzijie --- v1: https://lore.kernel.org/linux-f2fs-devel/20241204122317.3042137-1-wangzij...@honor.com/ change since v1: - Suggestions from ShengYong to change {read|write}_all_xattrs and add free_xattrs - If we may ne

Re: [f2fs-dev] f2fs-tools: Check and fix inline xattr inplace

2024-12-04 Thread wangzijie
>On 2024/12/4 20:23, wangzijie wrote: >> When we check inode which just has inline xattr data, we copy >> inline xattr data from inode, check it(maybe fix it) and copy >> it again to inode. We can check and fix xattr inplace for this >> kind of inode to reduce memcpy

[f2fs-dev] f2fs-tools: Check and fix inline xattr inplace

2024-12-04 Thread wangzijie
When we check inode which just has inline xattr data, we copy inline xattr data from inode, check it(maybe fix it) and copy it again to inode. We can check and fix xattr inplace for this kind of inode to reduce memcpy times. Signed-off-by: wangzijie --- fsck/fsck.c | 18 ++ 1

Re: [f2fs-dev] [RFC PATCH] f2fs: don't set SBI_QUOTA_NEED_REPAIR flag if receive SIGKILL

2024-09-08 Thread wangzijie
>On 2024/9/8 12:12, wangzijie wrote: >>>> From: Chao Yu via Linux-f2fs-devel >>>> >>>>> On 2024/8/27 14:22, wangzijie wrote: >>>>>> Thread A >>>>>> -dquot_initialize >>>>>>  

Re: [f2fs-dev] [RFC PATCH] f2fs: don't set SBI_QUOTA_NEED_REPAIR flag if receive SIGKILL

2024-09-07 Thread wangzijie
>> From: Chao Yu via Linux-f2fs-devel >> >>> On 2024/8/27 14:22, wangzijie wrote: >>>> Thread A >>>> -dquot_initialize >>>>   -dqget >>>>    -f2fs_dquot_acquire >>>>     -v2_read_dquot >&

[f2fs-dev] [RFC PATCH] f2fs: don't set SBI_QUOTA_NEED_REPAIR flag if receive SIGKILL

2024-08-26 Thread wangzijie
: return -EINTR -set SBI_QUOTA_NEED_REPAIR -set SBI_QUOTA_NEED_REPAIR When calling read_cache_page_gfp in quota read, thread may receive SIGKILL and set SBI_QUOTA_NEED_REPAIR, should we set SBI_QUOTA_NEED_REPAIR in this error path? Signed-off-by: wangzijie --- fs/f2fs/inode.c | 3 ++- fs

Re: [f2fs-dev] [PATCH v5] f2fs: reduce expensive checkpoint trigger frequency

2024-07-09 Thread wangzijie
Hi Chao, I think that we should call f2fs_remove_ino_entry in f2fs_evict_inode to delete ino_entry in CP_XATTR_DIR list. ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-dev

Re: [f2fs-dev] [PATCH v3] f2fs: reduce expensive checkpoint trigger frequency

2024-06-24 Thread wangzijie
>On 2024/6/25 10:14, wangzijie wrote: >>> We may trigger high frequent checkpoint for below case: >>> 1. mkdir /mnt/dir1; set dir1 encrypted >>> 2. touch /mnt/file1; fsync /mnt/file1 >>> 3. mkdir /mnt/dir2; set dir2 encrypted >>> 4. touch /mnt/

Re: [f2fs-dev] [PATCH v3] f2fs: reduce expensive checkpoint trigger frequency

2024-06-24 Thread wangzijie
> We may trigger high frequent checkpoint for below case: > 1. mkdir /mnt/dir1; set dir1 encrypted > 2. touch /mnt/file1; fsync /mnt/file1 > 3. mkdir /mnt/dir2; set dir2 encrypted > 4. touch /mnt/file2; fsync /mnt/file2 > ... > > Although, newly created dir and file are not related, due to > commi

[f2fs-dev] [PATCH] f2fs: use f2fs_get_node_page when write inline data

2024-04-01 Thread wangzijie
From: Zijie Wang Date: Mon, 1 Apr 2024 21:24:08 +0800 Subject: [PATCH] [f2fs-dev] f2fs: use f2fs_get_node_page when write inline data We just need inode page when write inline data, use f2fs_get_node_page() to get it instead of using dnode_of_data, which can eliminate unnecessary struct use. Sig