[f2fs-dev] [PATCH] f2fs: fix error path of __f2fs_build_free_nids

2023-10-13 Thread Zhiguo Niu
SBI_NEED_FSCK should be set for fsck has a chance to repair in case of scan_nat_page fail in run time. Signed-off-by: Zhiguo Niu --- fs/f2fs/node.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index ee2e1dd..d9e6087 100644 --- a/fs/f2fs

[f2fs-dev] [PATCH] f2fs: fix thread name cannot be fully displayed

2023-11-01 Thread Zhiguo Niu
" PID: 420TASK: ff80f6505880 CPU: 2 COMMAND: "f2fs_gc-259:41" PID: 393TASK: ff80f6b72c40 CPU: 1 COMMAND: "f2fs_gc-259:40 PID: 513TASK: ff80dd62e740 CPU: 1 COMMAND: "f2fs_gc-254:40" Signed-off-by: Zhiguo Niu --- fs/f2fs/checkpoin

Re: [f2fs-dev] [PATCH] f2fs: fix thread name cannot be fully displayed

2023-11-07 Thread Zhiguo Niu
Dear Chao, On Tue, Nov 7, 2023 at 10:53 PM Chao Yu wrote: > > On 2023/11/2 9:20, Zhiguo Niu wrote: > > Because the length of task'name in task_struct can not exceed > > 16 characters, f2fs some thread'name cannot be fully displayed, > > including important d

[f2fs-dev] [PATCH] f2fs: fix error handling of __get_node_page

2023-10-18 Thread Zhiguo Niu
Use f2fs_handle_error to record inconsistent node block error and return -EFSCORRUPTED instead of -EINVAL. Signed-off-by: Zhiguo Niu --- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 248764b..ed963c56 100644 --- a/fs

Re: [f2fs-dev] [PATCH] f2fs: fix error path of __f2fs_build_free_nids

2023-10-16 Thread Zhiguo Niu
Dear Chao, On Mon, Oct 16, 2023 at 3:37 PM Chao Yu wrote: > > On 2023/10/13 18:58, Zhiguo Niu wrote: > > SBI_NEED_FSCK should be set for fsck has a chance to > > repair in case of scan_nat_page fail in run time. > > > > Signed-off-by: Zhiguo Niu > > Hi Zh

Re: [f2fs-dev] [PATCH] f2fs: fix error path of __f2fs_build_free_nids

2023-10-16 Thread Zhiguo Niu
Dear Chao, On Mon, Oct 16, 2023 at 5:07 PM Chao Yu wrote: > > Zhiguo, > > On 2023/10/16 17:02, Zhiguo Niu wrote: > > Dear Chao, > > > > On Mon, Oct 16, 2023 at 3:37 PM Chao Yu wrote: > >> > >> On 2023/10/13 18:58, Zhiguo Niu wrote: > &g

[f2fs-dev] [PATCH V2] f2fs: fix error path of __f2fs_build_free_nids

2023-10-16 Thread Zhiguo Niu
it has no luck to trigger a checkpoint to record SBI_NEED_FSCK Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu --- changes of v2: Improve the patch according to Chao's suggestions. --- --- fs/f2fs/node.c | 11 +-- include/linux/f2fs_fs.h | 1 + 2 files changed, 10 insertions

[f2fs-dev] [PATCH] f2fs: should update REQ_TIME for direct write

2023-08-10 Thread Zhiguo Niu
The sending interval of discard and GC should also consider direct write requests; filesystem is not idle if there is direct write. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 5ac53d2627d2..713a2d98728a

[f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device

2024-02-06 Thread Zhiguo Niu
get a out-of-bound segment --- Zhiguo Niu (4): f2fs: correct counting methods of free_segments in __set_inuse f2fs: fix panic issue in update_sit_entry f2fs: enhance judgment conditions of GET_SEGNO f2fs: stop checkpoint when get a out-of-bounds segment fs/f2fs/file.c | 7

[f2fs-dev] [PATCH v2 3/4] f2fs: enhance judgment conditions of GET_SEGNO

2024-02-06 Thread Zhiguo Niu
unexpected problems later. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c| 7 ++- fs/f2fs/segment.c | 4 +++- fs/f2fs/segment.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 23cd6a1..2cd3cd9 100644 --- a/fs/f2fs/file.c +++ b/fs

[f2fs-dev] [PATCH v2 4/4] f2fs: stop checkpoint when get a out-of-bounds segment

2024-02-06 Thread Zhiguo Niu
reason: STOP_CP_REASON_OUTOF_RAGNE. Signed-off-by: Zhiguo Niu --- fs/f2fs/segment.c | 12 ++-- include/linux/f2fs_fs.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 6772ad4..6fe2baf 100644 --- a/fs/f2fs/segment.c

[f2fs-dev] [PATCH v2 1/4] f2fs: correct counting methods of free_segments in __set_inuse

2024-02-06 Thread Zhiguo Niu
methods like free_sections should be used to free_segments. Signed-off-by: Zhiguo Niu --- fs/f2fs/segment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 8129be7..f2847f1 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment

[f2fs-dev] [PATCH v2 2/4] f2fs: fix panic issue in update_sit_entry

2024-02-06 Thread Zhiguo Niu
/0xc28 [ 13.508997] do_filp_open+0xbc/0x16c [ 13.509535] do_sys_openat2+0xa0/0x2a0 So sanity check should be add in update_sit_entry. Also remove some redundant judgment code. Signed-off-by: Zhiguo Niu --- fs/f2fs/segment.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[f2fs-dev] [PATCH v4 4/4] f2fs: stop checkpoint when get a out-of-bounds segment

2024-02-19 Thread Zhiguo Niu
reason: STOP_CP_REASON_NO_SEGMENT. Signed-off-by: Zhiguo Niu --- changes of v4: use more suitable MACRO name according to Chao's suggestions changes of v3: correct MACRO spelling and update based on the lastes code --- --- fs/f2fs/segment.c | 7 ++- include/linux/f2fs_fs.h | 1 + 2 files

[f2fs-dev] [PATCH] f2fs-tools: add a new stop cp reason STOP_CP_REASON_NO_SEGMENT

2024-02-20 Thread Zhiguo Niu
Add a new stop cp reason STOP_CP_REASON_NO_SEGMENT for keeping consistent with kernel codes. Signed-off-by: Zhiguo Niu --- fsck/mount.c | 1 + include/f2fs_fs.h | 1 + 2 files changed, 2 insertions(+) diff --git a/fsck/mount.c b/fsck/mount.c index 50afd01..b983920 100644 --- a/fsck

Re: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-02-19 Thread Zhiguo Niu
On Tue, Feb 20, 2024 at 10:36 AM Chao Yu wrote: > > On 2024/2/19 22:36, Chao Yu wrote: > Please think about how to optimize this, which is really ugly now > --- > fs/f2fs/checkpoint.c | 12 > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git

[f2fs-dev] [PATCH v3 4/4] f2fs: stop checkpoint when get a out-of-bounds segment

2024-02-18 Thread Zhiguo Niu
reason: STOP_CP_REASON_OUT_OF_RANGE. Signed-off-by: Zhiguo Niu --- changes of v3: correct MACRO spelling and update based on the lastes code --- --- fs/f2fs/segment.c | 7 ++- include/linux/f2fs_fs.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b

Re: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-02-19 Thread Zhiguo Niu
Dear Chao On Mon, Feb 19, 2024 at 11:46 AM Chao Yu wrote: > > On 2024/2/6 11:32, Jaegeuk Kim wrote: > > On 02/05, Chao Yu wrote: > >> On 2024/2/5 11:30, Zhiguo Niu wrote: > >>> There are some cases of f2fs_is_valid_blkaddr not handled as > >>> ERRO

Re: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-02-06 Thread Zhiguo Niu
On Tue, Feb 6, 2024 at 11:36 AM Chao Yu wrote: > > On 2024/2/6 11:32, Jaegeuk Kim wrote: > > On 02/05, Chao Yu wrote: > >> On 2024/2/5 11:30, Zhiguo Niu wrote: > >>> There are some cases of f2fs_is_valid_blkaddr not handled as > >>> ERROR_INVALID_

Re: [f2fs-dev] [PATCH V2] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2023-12-17 Thread Zhiguo Niu
Dear Chao, thanks for your feedback. On Fri, Dec 15, 2023 at 10:28 AM Chao Yu wrote: > > On 2023/12/12 13:23, Zhiguo Niu wrote: > > unify the error handling of ERROR_INVALID_BLKADDR in f2fs_is_valid_blkaddr > > and remove some redundant codes in f2fs_cache_compressed_page.

[f2fs-dev] [PATCH V3] f2fs: show more discard status by sysfs

2023-12-18 Thread Zhiguo Niu
The current pending_discard attr just only shows the discard_cmd_cnt information. More discard status can be shown so that we can check them through sysfs when needed. Signed-off-by: Zhiguo Niu --- changes of v2: Improve the patch according to Chao's suggestions. changes of v3: Add a blank line

[f2fs-dev] [PATCH V4] f2fs: show more discard status by sysfs

2023-12-18 Thread Zhiguo Niu
The current pending_discard attr just only shows the discard_cmd_cnt information. More discard status can be shown so that we can check them through sysfs when needed. Signed-off-by: Zhiguo Niu --- changes of v2: Improve the patch according to Chao's suggestions. changes of v3: Add a blank line

Re: [f2fs-dev] [PATCH V3] f2fs: show more discard status by sysfs

2023-12-18 Thread Zhiguo Niu
On Tue, Dec 19, 2023 at 1:45 AM Jaegeuk Kim wrote: > > On 12/18, Zhiguo Niu wrote: > > The current pending_discard attr just only shows the discard_cmd_cnt > > information. More discard status can be shown so that we can check > > them through sysfs when needed. > >

Re: [f2fs-dev] [PATCH V4] f2fs: show more discard status by sysfs

2023-12-18 Thread Zhiguo Niu
On Tue, Dec 19, 2023 at 12:00 PM Chao Yu wrote: > > On 2023/12/19 10:21, Zhiguo Niu wrote: > > The current pending_discard attr just only shows the discard_cmd_cnt > > information. More discard status can be shown so that we can check > > them through sysfs when ne

[f2fs-dev] [PATCH V3] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2023-12-18 Thread Zhiguo Niu
unify the error handling of ERROR_INVALID_BLKADDR in f2fs_is_valid_blkaddr and remove some redundant codes in f2fs_cache_compressed_page. Signed-off-by: Zhiguo Niu --- changes of v2: improve patch according Chao's suggestions. changes of v3: -rebase patch to dev-test -correct

Re: [f2fs-dev] [PATCH V4] f2fs: show more discard status by sysfs

2023-12-19 Thread Zhiguo Niu
On Tue, Dec 19, 2023 at 11:24 PM Chao Yu wrote: > > On 2023/12/19 12:09, Zhiguo Niu wrote: > > On Tue, Dec 19, 2023 at 12:00 PM Chao Yu wrote: > >> > >> On 2023/12/19 10:21, Zhiguo Niu wrote: > >>> The current pending_discard attr just only shows t

[f2fs-dev] [PATCH V5] f2fs: show more discard status by sysfs

2023-12-19 Thread Zhiguo Niu
The current pending_discard attr just only shows the discard_cmd_cnt information. More discard status can be shown so that we can check them through sysfs when needed. Signed-off-by: Zhiguo Niu --- changes of v2: Improve the patch according to Chao's suggestions. changes of v3: Add a blank line

Re: [f2fs-dev] [PATCH V3] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2023-12-24 Thread Zhiguo Niu
Dear Chao, Do you have any other suggestions about this patch version? thanks! On Tue, Dec 19, 2023 at 11:57 AM Zhiguo Niu wrote: > > unify the error handling of ERROR_INVALID_BLKADDR in f2fs_is_valid_blkaddr > and remove some redundant codes in f2fs_cache_compressed_page. >

[f2fs-dev] [PATCH V1] f2fs: fix potentail deadloop issue in do_recover_data

2023-12-25 Thread Zhiguo Niu
des, the mainly error -ENOSPC has been handled as bug on, so other error cases can be proecssed normally without looping. Fixes: 956fa1ddc132 ("f2fs: fix to check return value of f2fs_reserve_new_block()") Signed-off-by: Zhiguo Niu --- fs/f2fs/recovery.c | 26 -- 1 fi

Re: [f2fs-dev] [PATCH] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2023-12-11 Thread Zhiguo Niu
Dear Chao On Tue, Dec 12, 2023 at 9:32 AM Chao Yu wrote: > > On 2023/12/1 13:42, Zhiguo Niu wrote: > > unify the error handling of f2fs_is_valid_blkaddr and remove some > > redundant codes in f2fs_cache_compressed_page. > > What about moving f2fs_handle_err

[f2fs-dev] [PATCH V2] f2fs: fix to check return value of f2fs_recover_xattr_data

2023-12-11 Thread Zhiguo Niu
epair") Signed-off-by: Zhiguo Niu --- changes of v2: move infor print to sutiable position according to Chao's suggestion. --- --- fs/f2fs/node.c | 6 +++--- fs/f2fs/xattr.c | 11 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c ind

[f2fs-dev] [PATCH V2] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2023-12-11 Thread Zhiguo Niu
unify the error handling of ERROR_INVALID_BLKADDR in f2fs_is_valid_blkaddr and remove some redundant codes in f2fs_cache_compressed_page. Signed-off-by: Zhiguo Niu --- changes of v2: improve patch according Chao's suggestions. --- --- fs/f2fs/checkpoint.c | 43

[f2fs-dev] [PATCH] f2fs: use IS_INODE replace IS_DNODE in f2fs_flush_inline_data

2024-01-17 Thread Zhiguo Niu
for IO, f2fs_flush_inline_data will be blocked here, which will affects the checkpoint process, this is unreasonable. So IS_INODE should be used in f2fs_flush_inline_data. Signed-off-by: Zhiguo Niu --- fs/f2fs/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b

[f2fs-dev] [PATCH] f2fs: compress: remove some redundant codes in f2fs_cache_compressed_page

2024-01-17 Thread Zhiguo Niu
Just remove some redundant codes, no logic change. Signed-off-by: Zhiguo Niu --- fs/f2fs/compress.c | 4 1 file changed, 4 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index ff26b49..624212d 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1889,12 +1889,8

[f2fs-dev] [PATCH] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2023-11-30 Thread Zhiguo Niu
unify the error handling of f2fs_is_valid_blkaddr and remove some redundant codes in f2fs_cache_compressed_page. Signed-off-by: Zhiguo Niu --- fs/f2fs/checkpoint.c | 6 +- fs/f2fs/compress.c | 8 +++- fs/f2fs/data.c | 3 ++- fs/f2fs/extent_cache.c | 7 --- fs/f2fs

[f2fs-dev] [PATCH] f2fs: show more discard stat by sysfs

2023-11-23 Thread Zhiguo Niu
The current pending_discard attr just only shows the discard_cmd_cnt information, which is not very meaningful. More discard information can be shown so that we can check them through sysfs when needed. Signed-off-by: Zhiguo Niu --- fs/f2fs/sysfs.c | 21 +++-- 1 file changed, 15

[f2fs-dev] [PATCH] f2fs: fix to check return value of f2fs_recover_xattr_data

2023-12-08 Thread Zhiguo Niu
epair") Signed-off-by: Zhiguo Niu --- fs/f2fs/node.c | 6 +++--- fs/f2fs/xattr.c | 12 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e50a093..93bf724 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2754,11 +2754

Re: [f2fs-dev] [PATCH] f2fs: show more discard stat by sysfs

2023-11-27 Thread Zhiguo Niu
Dear Chao, On Tue, Nov 28, 2023 at 10:13 AM Chao Yu wrote: > > On 2023/11/24 9:08, Zhiguo Niu wrote: > > The current pending_discard attr just only shows the discard_cmd_cnt > > information, which is not very meaningful. More discard information > > can be shown so that w

[f2fs-dev] [PATCH V2] f2fs: show more discard status by sysfs

2023-11-27 Thread Zhiguo Niu
The current pending_discard attr just only shows the discard_cmd_cnt information. More discard status can be shown so that we can check them through sysfs when needed. Signed-off-by: Zhiguo Niu --- changes of v2: Improve the patch according to Chao's suggestions. --- --- Documentation/ABI

Re: [f2fs-dev] [PATCH v5] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-02-01 Thread Zhiguo Niu
On Thu, Feb 1, 2024 at 6:04 PM Chao Yu wrote: > > On 2024/1/31 10:43, Zhiguo Niu wrote: > > There are some cases of f2fs_is_valid_blkaddr not handled as > > ERROR_INVALID_BLKADDR,so unify the error handling about all of > > f2fs_is_valid_blkaddr. > >

[f2fs-dev] [PATCH v6] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-02-01 Thread Zhiguo Niu
There are some cases of f2fs_is_valid_blkaddr not handled as ERROR_INVALID_BLKADDR,so unify the error handling about all of f2fs_is_valid_blkaddr. Signed-off-by: Zhiguo Niu --- changes of v6: improve patch according to Chao's suggestions -restore dump_stack to original position -adjuest code

Re: [f2fs-dev] [PATCH V1] f2fs: fix potentail deadloop issue in do_recover_data

2024-01-21 Thread Zhiguo Niu
Hi Chao On Mon, Jan 22, 2024 at 11:46 AM Chao Yu wrote: > > On 2023/12/25 19:11, Zhiguo Niu wrote: > > There is a potentail deadloop issue in the corner case of > > CONFIG_F2FS_FAULT_INJECTION is enabled and the return value > > of f2fs_reserve_new_block

[f2fs-dev] [PATCH v4] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-01-23 Thread Zhiguo Niu
There are some cases of f2fs_is_valid_blkaddr not handled as ERROR_INVALID_BLKADDR,so unify the error handling about all of f2fs_is_valid_blkaddr. Signed-off-by: Zhiguo Niu --- changes of v2: improve patch according Chao's suggestions. changes of v3: -rebase patch to dev-test

[f2fs-dev] [PATCH v5] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-01-30 Thread Zhiguo Niu
There are some cases of f2fs_is_valid_blkaddr not handled as ERROR_INVALID_BLKADDR,so unify the error handling about all of f2fs_is_valid_blkaddr. Signed-off-by: Zhiguo Niu --- changes of v2: improve patch according Chao's suggestions. changes of v3: -rebase patch to dev-test -correct return

Re: [f2fs-dev] [PATCH v4] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-01-29 Thread Zhiguo Niu
Hi Jaegeuk, Thanks for your suggestion,the following is my comment. On Tue, Jan 30, 2024 at 3:53 AM Jaegeuk Kim wrote: > > On 01/23, Zhiguo Niu wrote: > > There are some cases of f2fs_is_valid_blkaddr not handled as > > ERROR_INVALID_BLKADDR,so unify the error

Re: [f2fs-dev] [PATCH v4] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-01-29 Thread Zhiguo Niu
On Tue, Jan 30, 2024 at 8:46 AM Zhiguo Niu wrote: > > Hi Jaegeuk, > Thanks for your suggestion,the following is my comment. > > On Tue, Jan 30, 2024 at 3:53 AM Jaegeuk Kim wrote: > > > > On 01/23, Zhiguo Niu wrote: > > > There are some cases

Re: [f2fs-dev] [PATCH V1] f2fs: fix potentail deadloop issue in do_recover_data

2024-01-24 Thread Zhiguo Niu
> On 2024/1/22 13:46, Zhiguo Niu wrote: > > Hi Chao > > > > On Mon, Jan 22, 2024 at 11:46 AM Chao Yu wrote: > >> > >> On 2023/12/25 19:11, Zhiguo Niu wrote: > >>> There is a potentail deadloop issue in the corner case of > >>> CONFIG_

[f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-02-04 Thread Zhiguo Niu
There are some cases of f2fs_is_valid_blkaddr not handled as ERROR_INVALID_BLKADDR,so unify the error handling about all of f2fs_is_valid_blkaddr. Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu --- changes of v7: update patch according to sync with Chao -restore some code to original

Re: [f2fs-dev] [PATCH 0/3] f2fs: fix panic issue in small capacity device

2024-02-05 Thread Zhiguo Niu
On Tue, Feb 6, 2024 at 11:15 AM Jaegeuk Kim wrote: > > On 01/29, Zhiguo Niu wrote: > > A panic issue happened in a reboot test in small capacity device > > as following: > > 1.The device size is 64MB, and main area has 24 segments, and > > CONFIG_F2FS_

[f2fs-dev] [PATCH 3/3] f2fs: enhance judgment conditions of GET_SEGNO

2024-01-29 Thread Zhiguo Niu
unexpected problems later. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c| 7 ++- fs/f2fs/segment.c | 4 +++- fs/f2fs/segment.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 23cd6a1..2cd3cd9 100644 --- a/fs/f2fs/file.c +++ b/fs

[f2fs-dev] [PATCH 2/3] f2fs: fix panic issue in update_sit_entry

2024-01-29 Thread Zhiguo Niu
/0xc28 [ 13.508997] do_filp_open+0xbc/0x16c [ 13.509535] do_sys_openat2+0xa0/0x2a0 So sanity check should be add in update_sit_entry. Also remove some redundant judgment code. Signed-off-by: Zhiguo Niu --- fs/f2fs/segment.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[f2fs-dev] [PATCH 1/3] f2fs: correct counting methods of free_segments in __set_inuse

2024-01-29 Thread Zhiguo Niu
methods like free_sections should be used to free_segments. Signed-off-by: Zhiguo Niu --- fs/f2fs/segment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 8129be7..f2847f1 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment

[f2fs-dev] [PATCH 0/3] f2fs: fix panic issue in small capacity device

2024-01-29 Thread Zhiguo Niu
a out-of-bound segment with segno 24. 3.panic happen in update_sit_entry because access invalid bitmap pointer. More detail shown in following three patches. The three patches are splited here because the modifications are relatively independent and more readable. Zhiguo Niu (3): f2fs: correct

Re: [f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device

2024-02-26 Thread Zhiguo Niu
On Tue, Feb 27, 2024 at 9:13 AM Jaegeuk Kim wrote: > > On 02/26, Zhiguo Niu wrote: > > Dear Chao, > > > > On Fri, Feb 23, 2024 at 10:38 AM Chao Yu wrote: > > > > > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > > >

[f2fs-dev] [PATCH 2/2] f2fs: fix to check return value of f2fs_gc_range

2024-03-01 Thread Zhiguo Niu
f2fs_gc_range may return error, so its caller f2fs_allocate_pinning_section should determine whether to do retry based on ist return value. Also just do f2fs_gc_range when f2fs_allocate_new_section return -EAGAIN, and check cp error case in f2fs_gc_range. Signed-off-by: Zhiguo Niu --- fs/f2fs

[f2fs-dev] [PATCH 1/2] f2fs: fix to check return value __allocate_new_segment

2024-03-01 Thread Zhiguo Niu
__allocate_new_segment may return error when get_new_segment fails, so its caller should check its return value. Signed-off-by: Zhiguo Niu --- fs/f2fs/f2fs.h | 2 +- fs/f2fs/recovery.c | 2 +- fs/f2fs/segment.c | 7 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs

[f2fs-dev] [PATCH] f2fs: fix to check result of new_curseg in f2fs_allocate_segment_for_resize

2024-03-01 Thread Zhiguo Niu
new_curseg may return error if get_new_segment fail, so its result should be check in its caller f2fs_allocate_segment_for_resize, alos pass this results to free_segment_range. Signed-off-by: Zhiguo Niu --- fs/f2fs/f2fs.h| 2 +- fs/f2fs/gc.c | 7 +-- fs/f2fs/segment.c | 9

[f2fs-dev] 答复: [bug report] f2fs: stop checkpoint when get a out-of-bounds segment

2024-02-27 Thread Zhiguo Niu
Hi Jaegeuk, Chao's patch fix should can fix this warning: f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage thanks! -邮件原件- 发件人: Jaegeuk Kim 发送时间: 2024年2月28日 1:38 收件人: Dan Carpenter 抄送: 牛志国 (Zhiguo Niu) ; linux-f2fs-devel@lists.sourceforge.net 主题: Re: [f2fs-dev] [bug

[f2fs-dev] 答复: [bug report] f2fs: stop checkpoint when get a out-of-bounds segment

2024-02-27 Thread Zhiguo Niu
Hi Jaegeuk, I understand what you mean^^, please ignore my last email, sorry again:). Thanks! -邮件原件- 发件人: 牛志国 (Zhiguo Niu) 发送时间: 2024年2月28日 8:55 收件人: 'Jaegeuk Kim' ; 'Dan Carpenter' 抄送: 'linux-f2fs-devel@lists.sourceforge.net' ; 金红宇 (Hongyu Jin) ; 'Chao Yu' 主题: 答复: [f2fs-dev] [bug

Re: [f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device

2024-02-27 Thread Zhiguo Niu
On Wed, Feb 28, 2024 at 1:18 AM Jaegeuk Kim wrote: > > On 02/27, Zhiguo Niu wrote: > > On Tue, Feb 27, 2024 at 9:13 AM Jaegeuk Kim wrote: > > > > > > On 02/26, Zhiguo Niu wrote: > > > > Dear Chao, > > > > > > > > On Fri, Feb 23,

[f2fs-dev] [PATCH] f2fs: fix to do sanity check in update_sit_entry

2024-02-28 Thread Zhiguo Niu
If GET_SEGNO return NULL_SEGNO for some unecpected case, update_sit_entry will access invalid memory address, cause system crash. It is better to do sanity check about GET_SEGNO just like update_segment_mtime & locate_dirty_segment. Also remove some redundant judgment code. Signed-off-by: Zh

Re: [f2fs-dev] [PATCH] f2fs: fix to check result of new_curseg in f2fs_allocate_segment_for_resize

2024-03-03 Thread Zhiguo Niu
On Mon, Mar 4, 2024 at 11:19 AM Chao Yu wrote: > > On 2024/3/1 19:36, Zhiguo Niu wrote: > > new_curseg may return error if get_new_segment fail, so its result > > should be check in its caller f2fs_allocate_segment_for_resize, > > alos pass this results to free_segment_ran

Re: [f2fs-dev] [PATCH] f2fs: fix to check result of new_curseg in f2fs_allocate_segment_for_resize

2024-03-03 Thread Zhiguo Niu
On Mon, Mar 4, 2024 at 3:17 PM Chao Yu wrote: > > On 2024/3/4 11:33, Zhiguo Niu wrote: > > On Mon, Mar 4, 2024 at 11:19 AM Chao Yu wrote: > >> > >> On 2024/3/1 19:36, Zhiguo Niu wrote: > >>> new_curseg may return error if get_new_segment fail, so its

Re: [f2fs-dev] [PATCH] f2fs: fix to check result of new_curseg in f2fs_allocate_segment_for_resize

2024-03-04 Thread Zhiguo Niu
On Mon, Mar 4, 2024 at 5:19 PM Chao Yu wrote: > > On 2024/3/4 15:52, Zhiguo Niu wrote: > > On Mon, Mar 4, 2024 at 3:17 PM Chao Yu wrote: > >> > >> On 2024/3/4 11:33, Zhiguo Niu wrote: > >>> On Mon, Mar 4, 2024 at 11:19 AM Chao Yu wrote: > &g

[f2fs-dev] [PATCH] f2fs: fix to remove f2fs_bug_on in add_bio_entry

2024-03-04 Thread Zhiguo Niu
add_bio_entry should not trigger system panic when bio_add_page fail, fix to remove it. Fixes: 0b20fcec8651 ("f2fs: cache global IPU bio") Signed-off-by: Zhiguo Niu --- fs/f2fs/data.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/da

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

2024-03-04 Thread Zhiguo Niu
ve case, please help consider this patch or any comment/suggestions about this? thanks! On Mon, Feb 26, 2024 at 9:22 AM 牛志国 (Zhiguo Niu) wrote: > > > Hi Jaegeuk > > Sorry for disturbing you, Do you have any comments about this patch from > Chao, I’ve met this issue several tim

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

2024-03-04 Thread Zhiguo Niu
6fc and I tested Chao's patch can avoid the above case, please help consider this patch or any comment/suggestions about this? thanks! On Tue, Mar 5, 2024 at 9:56 AM Zhiguo Niu wrote: > > Dear Jaegeuk, > > Let me describe the problem process, it is reproduced by monkey stability

Re: [f2fs-dev] [PATCH 3/4] f2fs: fix to handle segment allocation failure correctly

2024-02-26 Thread Zhiguo Niu
error correctly in its caller. > > > > Signed-off-by: Chao Yu Tested-by: Zhiguo Niu Thanks! > > --- > > fs/f2fs/data.c| 7 +-- > > fs/f2fs/f2fs.h| 2 +- > > fs/f2fs/file.c| 7 ++- > > fs/f2fs/gc.c | 7 ++- > >

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

2024-02-25 Thread Zhiguo Niu
-ker...@vger.kernel.org; 牛志国 (Zhiguo Niu) 主题: Re: [PATCH v3] f2fs: reduce expensive checkpoint trigger frequency 注意: 这封邮件来自于外部。除非你确定邮件内容安全,否则不要点击任何链接和附件。 CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender

Re: [f2fs-dev] [PATCH v2 0/4] f2fs: fix panic issue in small capacity device

2024-02-25 Thread Zhiguo Niu
Dear Chao, On Fri, Feb 23, 2024 at 10:38 AM Chao Yu wrote: > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu > <mailto:c...@kernel.org>> wrote: > > > > On 2024/2/7 10:01, Zhiguo Niu wrote: &g

[f2fs-dev] [PATCH V8] f2fs: unify the error handling of f2fs_is_valid_blkaddr

2024-03-07 Thread Zhiguo Niu
There are some cases of f2fs_is_valid_blkaddr not handled as ERROR_INVALID_BLKADDR,so unify the error handling about all of f2fs_is_valid_blkaddr. Do f2fs_handle_error in __f2fs_is_valid_blkaddr for cleanup. Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu --- v8: do reboot/monkey stability

[f2fs-dev] [PATCH 2/2] f2fs: fix to handle error paths of {new, change}_curseg()

2024-03-08 Thread Zhiguo Niu
{new,change}_curseg() may return error in some special cases, error handling should be did in their callers, and this will also facilitate subsequent error path expansion in {new,change}_curseg(). Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu --- fs/f2fs/extent_cache.c | 2 +- fs/f2fs

[f2fs-dev] [PATCH 1/2] f2fs: fix to remove f2fs_bug_on in add_bio_entry

2024-03-08 Thread Zhiguo Niu
add_bio_entry should not trigger system panic when bio_add_page fail, fix to remove it. Fixes: 0b20fcec8651 ("f2fs: cache global IPU bio") Signed-off-by: Zhiguo Niu --- fs/f2fs/data.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/da

[f2fs-dev] [PATCH V2 2/2] f2fs: fix to handle error paths of {new, change}_curseg()

2024-03-11 Thread Zhiguo Niu
{new,change}_curseg() may return error in some special cases, error handling should be did in their callers, and this will also facilitate subsequent error path expansion in {new,change}_curseg(). Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu --- v2: remove the part that are irrelevant

Re: [f2fs-dev] [PATCH 2/2] f2fs: fix to handle error paths of {new, change}_curseg()

2024-03-11 Thread Zhiguo Niu
On Mon, Mar 11, 2024 at 2:09 PM Chao Yu wrote: > > On 2024/3/8 18:12, Zhiguo Niu wrote: > > {new,change}_curseg() may return error in some special cases, > > error handling should be did in their callers, and this will also > > facilitate subsequent error path expansio

Re: [f2fs-dev] [PATCH 1/2] f2fs: fix to remove f2fs_bug_on in add_bio_entry

2024-03-11 Thread Zhiguo Niu
On Mon, Mar 11, 2024 at 11:54 AM Chao Yu wrote: > > On 2024/3/8 18:12, Zhiguo Niu wrote: > > add_bio_entry should not trigger system panic when bio_add_page fail, > > fix to remove it. > > > > Fixes: 0b20fcec8651 ("f2fs: cache global IPU bio") > > Si

[f2fs-dev] [PATCH] f2fs: add REQ_TIME time update for some user behaviors

2024-03-12 Thread Zhiguo Niu
some user behaviors requested filesystem operations, which will cause filesystem not idle. Meanwhile adjust f2fs_update_time(REQ_TIME) of f2fs_ioc_defragment to successful case. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff

[f2fs-dev] [PATCH] f2fs: fix to adjust appropirate defragment pg_end

2024-03-22 Thread Zhiguo Niu
A length that exceeds the real size of the inode may be specified from user, although these out-of-range areas are not mapped, but they still need to be check in while loop, which is unnecessary. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion

[f2fs-dev] [PATCH V2] f2fs: add REQ_TIME time update for some user behaviors

2024-03-15 Thread Zhiguo Niu
some user behaviors requested filesystem operations, which will cause filesystem not idle. Meanwhile adjust some f2fs_update_time(REQ_TIME) positions. Signed-off-by: Zhiguo Niu --- v2: update patch according to Chao's suggestions --- --- fs/f2fs/file.c | 13 ++--- 1 file changed, 10

Re: [f2fs-dev] [PATCH] f2fs: add REQ_TIME time update for some user behaviors

2024-03-14 Thread Zhiguo Niu
On Thu, Mar 14, 2024 at 9:06 PM Chao Yu wrote: > > On 2024/3/13 12:11, Zhiguo Niu wrote: > > some user behaviors requested filesystem operations, which > > will cause filesystem not idle. > > Meanwhile adjust f2fs_update_time(REQ_TIME) of > > f2fs_ioc_defragment to s

Re: [f2fs-dev] [PATCH] f2fs: add REQ_TIME time update for some user behaviors

2024-03-14 Thread Zhiguo Niu
On Fri, Mar 15, 2024 at 11:07 AM Chao Yu wrote: > > On 2024/3/15 9:46, Zhiguo Niu wrote: > > On Thu, Mar 14, 2024 at 9:06 PM Chao Yu wrote: > >> > >> On 2024/3/13 12:11, Zhiguo Niu wrote: > >>> some user behaviors requested filesystem operations,

[f2fs-dev] [PATCH V3] f2fs: add REQ_TIME time update for some user behaviors

2024-03-20 Thread Zhiguo Niu
some user behaviors requested filesystem operations, which will cause filesystem not idle. Meanwhile adjust some f2fs_update_time(REQ_TIME) positions. Signed-off-by: Zhiguo Niu --- v3: modify some update conditions according to Chao's suggeestions v2: update patch according to Chao's suggestions

[f2fs-dev] [PATCH V2] f2fs: fix to adjust appropirate defragment pg_end

2024-03-24 Thread Zhiguo Niu
A length that exceeds the real size of the inode may be specified from user, although these out-of-range areas are not mapped, but they still need to be check in while loop, which is unnecessary. Signed-off-by: Zhiguo Niu --- v2: check i_size within inode lock according to Chao's suggestions

Re: [f2fs-dev] [PATCH V2] f2fs: fix to adjust appropirate defragment pg_end

2024-03-26 Thread Zhiguo Niu
On Tue, Mar 26, 2024 at 7:11 PM Chao Yu wrote: > > On 2024/3/25 13:56, Zhiguo Niu wrote: > > A length that exceeds the real size of the inode may be > > specified from user, although these out-of-range areas > > are not mapped, but they still need to be check

[f2fs-dev] [PATCH] f2fs: fix some ambiguous comments

2024-04-07 Thread Zhiguo Niu
Some comments are confused and just correct with block size is 4KB. Signed-off-by: Zhiguo Niu --- include/linux/f2fs_fs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index a357287..4a56d18 100644 --- a/include/linux

Re: [f2fs-dev] [PATCH 1/2] f2fs: fix to relocate check condition in f2fs_fallocate()

2024-04-07 Thread Zhiguo Niu
On Sun, Apr 7, 2024 at 3:29 PM Chao Yu wrote: > > On 2024/4/7 10:11, Zhiguo Niu wrote: > > On Wed, Apr 3, 2024 at 10:26 PM Chao Yu wrote: > >> > >> compress and pinfile flag should be checked after inode lock held to > >> avoid race condition, fix i

Re: [f2fs-dev] [PATCH 1/2] f2fs: fix to relocate check condition in f2fs_fallocate()

2024-04-06 Thread Zhiguo Niu
On Wed, Apr 3, 2024 at 10:26 PM Chao Yu wrote: > > compress and pinfile flag should be checked after inode lock held to > avoid race condition, fix it. > > Fixes: 4c8ff7095bef ("f2fs: support data compression") > Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file") >

[f2fs-dev] [PATCH V3] f2fs: fix to adjust appropirate defragment pg_end

2024-03-27 Thread Zhiguo Niu
A length that exceeds the real size of the inode may be specified from user, although these out-of-range areas are not mapped, but they still need to be check in while loop, which is unnecessary. Signed-off-by: Zhiguo Niu --- v3: adjust code positions according to Chao's suggestions v2: check

Re: [f2fs-dev] [PATCH V3] f2fs: add REQ_TIME time update for some user behaviors

2024-04-10 Thread Zhiguo Niu
Hi Jaegeuk Any comments about this patch? thanks! On Wed, Mar 20, 2024 at 5:33 PM Chao Yu wrote: > > On 2024/3/20 14:22, Zhiguo Niu wrote: > > some user behaviors requested filesystem operations, which > > will cause filesystem not idle. > > Meanwhile adjust some f

Re: [f2fs-dev] [PATCH 2/2] f2fs: remove unnecessary block size check in init_f2fs_fs()

2024-04-16 Thread Zhiguo Niu
On Tue, Apr 16, 2024 at 3:22 PM Chao Yu wrote: > > After commit d7e9a9037de2 ("f2fs: Support Block Size == Page Size"), > F2FS_BLKSIZE equals to PAGE_SIZE, remove unnecessary check condition. > > Signed-off-by: Chao Yu > --- > fs/f2fs/super.c | 6 -- > 1 file changed, 6 deletions(-) > >

Re: [f2fs-dev] [PATCH] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO

2024-04-26 Thread Zhiguo Niu
Dear Chao, On Fri, Apr 26, 2024 at 6:37 PM Chao Yu wrote: > > Otherwise, it breaks pinfile's sematics. > > Cc: Daeho Jeong > Signed-off-by: Chao Yu > --- > fs/f2fs/data.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index

Re: [f2fs-dev] [PATCH 2/2] f2fs: remove unnecessary block size check in init_f2fs_fs()

2024-04-26 Thread Zhiguo Niu
Fixed! On Fri, Apr 26, 2024 at 5:37 PM Chao Yu wrote: > > On 2024/4/16 19:12, Zhiguo Niu wrote: > > On Tue, Apr 16, 2024 at 3:22 PM Chao Yu wrote: > >> > >> After commit d7e9a9037de2 ("f2fs: Support Block Size == Page Size"), > >> F2FS_BLKS

[f2fs-dev] [PATCH V2] f2fs: fix some ambiguous comments

2024-04-26 Thread Zhiguo Niu
After commit d7e9a9037de2 ("f2fs: Support Block Size == Page Size"), Some comments are confused and just correct with block size is 4KB. Signed-off-by: Zhiguo Niu --- v2: add comments "support 64 TB disk size for 16K page size" --- --- include/linux/f2fs_fs.h | 10 +++--

[f2fs-dev] [PATCH] f2fs: enable atgc if atgc_age_threshold from user is less than elapsed_time

2024-05-20 Thread Zhiguo Niu
k even the above conditions met. It is better to enable atgc dynamiclly when user change atgc_age_threshold meanwhile this vale is less than elapsed_time and ATGC mount option is on. Signed-off-by: Zhiguo Niu --- fs/f2fs/f2fs.h| 1 + fs/f2fs/segment.c | 9 - fs/f2fs/sysfs.c

[f2fs-dev] [PATCH] f2fs: fix to check return value of f2fs_allocate_new_section

2024-05-17 Thread Zhiguo Niu
commit 245930617c9b ("f2fs: fix to handle error paths of {new,change}_curseg()") missed this allocated path, fix it. Signed-off-by: Zhiguo Niu --- fs/f2fs/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c ind

Re: [f2fs-dev] [PATCH] f2fs: fix to check return value of f2fs_allocate_new_section

2024-05-20 Thread Zhiguo Niu
On Tue, May 21, 2024 at 3:52 AM Jaegeuk Kim wrote: > > On 05/17, Zhiguo Niu wrote: > > commit 245930617c9b ("f2fs: fix to handle error paths of > > {new,change}_curseg()") > > missed this allocated path, fix it. > > > > Signed-off-by: Zhiguo Niu

[f2fs-dev] [PATCH] f2fs: fix to avoid use SSR allocate when do defragment

2024-05-29 Thread Zhiguo Niu
557056 3681809 3681809 1 A new FI flag FI_DEFRAG_IN_PROGRESS is introduced to avoid this scenarios. Signed-off-by: Zhiguo Niu --- fs/f2fs/f2fs.h| 1 + fs/f2fs/file.c| 2 ++ fs/f2fs/segment.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs

[f2fs-dev] [PATCH v2] f2fs: fix to avoid use SSR allocate when do defragment

2024-05-29 Thread Zhiguo Niu
557056 3681809 3681809 1 Signed-off-by: Zhiguo Niu --- v2: check FI_OPU_WRITE without adding new FI flag. --- --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 7caf20a..f0c0906 100644 --- a/fs

Re: [f2fs-dev] [PATCH] f2fs: enable atgc if atgc_age_threshold from user is less than elapsed_time

2024-05-30 Thread Zhiguo Niu
On Mon, May 27, 2024 at 12:07 PM Zhiguo Niu wrote: > > On Mon, May 27, 2024 at 11:49 AM Chao Yu wrote: > > > > On 2024/5/20 19:36, Zhiguo Niu wrote: > > > Now atgc can be enabled based on the following conditions: > > > -ATGC mount option is