Re: [f2fs-dev] [PATCH v4 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2024-01-12 Thread Chao Yu
goto out; } - *submitted += _submitted; + *submitted_p += submitted; } out: On 01/11, Chao Yu wrote: When we overwrite compressed cluster w/ normal cluster, we should not unlock cp_rwsem during f2fs_write_raw_pages(), otherwise data will be corrupted if

Re: [f2fs-dev] [PATCH] f2fs: remove unnecessary f2fs_put_page in f2fs_rename

2024-01-12 Thread Chao Yu
Suggested-by: Al Viro Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Re: [f2fs-dev] [PATCH] f2fs: fix double free of f2fs_sb_info

2024-01-12 Thread Chao Yu
ing, my bad. Fixes: 275dca4630c1 ("f2fs: move release of block devices to after kill_block_super()") Reported-by: syzbot+8f477ac014ff5b32d...@syzkaller.appspotmail.com Closes: https://lore.kernel.org/r/6cb174060ec34...@google.com Signed-off-by: Eric Biggers Reviewe

Re: [f2fs-dev] [PATCH] f2fs: check free sections before disable checkpoint

2024-01-11 Thread Chao Yu
-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Re: [f2fs-dev] [PATCH v3 3/6] f2fs: compress: fix to check unreleased compressed cluster

2024-01-11 Thread Chao Yu
On 2024/1/12 1:15, Daeho Jeong wrote: On Wed, Jan 10, 2024 at 5:33 PM Chao Yu wrote: On 2024/1/11 9:18, Daeho Jeong wrote: On Thu, Dec 28, 2023 at 6:33 AM Chao Yu wrote: From: Sheng Yong Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix

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

2024-01-11 Thread Chao Yu
He Signed-off-by: Chao Yu --- v3: - Recently, Zhiguo Niu reported the same issue, so I repost this patch for comments. fs/f2fs/f2fs.h | 2 ++ fs/f2fs/file.c | 3 +++ fs/f2fs/xattr.c | 16 ++-- include/trace/events/f2fs.h | 3 ++- 4 files c

[f2fs-dev] [PATCH] f2fs: compress: fix to cover f2fs_disable_compressed_file() w/ i_sem

2024-01-10 Thread Chao Yu
Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 18 -- fs/f2fs/file.c | 5 ++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 74729db0b381..e2e0ca45f881 100

[f2fs-dev] [PATCH v4 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2024-01-10 Thread Chao Yu
port data compression") Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 20 ++-- fs/f2fs/data.c | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 9940b7886e5d..bf4cfab67aec 100644 --- a/fs/f2fs/compress.c

[f2fs-dev] [PATCH v4 5/6] f2fs: fix to remove unnecessary f2fs_bug_on() to avoid panic

2024-01-10 Thread Chao Yu
verify_blkaddr() will trigger panic once we inject fault into f2fs_is_valid_blkaddr(), fix to remove this unnecessary f2fs_bug_on(). Fixes: 18792e64c86d ("f2fs: support fault injection for f2fs_is_valid_blkaddr()") Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 4 +--- 1 file changed, 1

[f2fs-dev] [PATCH v4 6/6] f2fs: introduce FAULT_BLKADDR_CONSISTENCE

2024-01-10 Thread Chao Yu
heck error path handling in kernel side. Signed-off-by: Chao Yu --- v4: - rename macro to FAULT_BLKADDR_CONSISTENCE and FAULT_BLKADDR_VALIDITY suggested by Jaegeuk. Documentation/ABI/testing/sysfs-fs-f2fs | 47 + Documentation/filesystems/f2fs.rst | 47

[f2fs-dev] [PATCH v4 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2024-01-10 Thread Chao Yu
If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- fs/f2fs/compress.c |

[f2fs-dev] [PATCH v4 4/6] f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode

2024-01-10 Thread Chao Yu
oduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") Signed-off-by: Chao Yu --- fs/f2fs/data.c| 5 +++-- fs/f2fs/f2fs.h| 7 ++- fs/f2fs/file.c| 26 ++ fs/f2fs/segment.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f

[f2fs-dev] [PATCH v4 3/6] f2fs: compress: fix to check unreleased compressed cluster

2024-01-10 Thread Chao Yu
From: Sheng Yong Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks(). Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Sheng Yong Signed-off-b

Re: [f2fs-dev] [PATCH 5/6] f2fs: fix to restrict condition of compress inode conversion

2024-01-10 Thread Chao Yu
On 2024/1/3 6:54, Jaegeuk Kim wrote: On 12/28, Chao Yu wrote: On 2023/12/13 6:21, Jaegeuk Kim wrote: On 12/12, Chao Yu wrote: On 2023/12/12 6:11, Jaegeuk Kim wrote: On 12/10, Chao Yu wrote: This patch adds i_size check during compress inode conversion in order to avoid .page_mkwrite races w

Re: [f2fs-dev] [PATCH v3 6/6] f2fs: introduce FAULT_BLKADDR_INCONSISTENCE

2024-01-10 Thread Chao Yu
On 2024/1/3 4:55, Jaegeuk Kim wrote: On 12/28, Chao Yu wrote: We will encounter below inconsistent status when FAULT_BLKADDR type fault injection is on. Info: checkpoint state = d6 : nat_bits crc fsck compacted_summary orphan_inodes sudden-power-off [ASSERT] (fsck_chk_inode_blk:1254

Re: [f2fs-dev] [PATCH v3 3/6] f2fs: compress: fix to check unreleased compressed cluster

2024-01-10 Thread Chao Yu
On 2024/1/11 9:18, Daeho Jeong wrote: On Thu, Dec 28, 2023 at 6:33 AM Chao Yu wrote: From: Sheng Yong Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks(). Fixes

Re: [f2fs-dev] [PATCH v3 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2024-01-10 Thread Chao Yu
On 2024/1/11 8:55, Daeho Jeong wrote: On Thu, Dec 28, 2023 at 6:33 AM Chao Yu wrote: If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint. Fixes: 4c8ff7095bef ("

Re: [f2fs-dev] [PATCH 5/6] f2fs: fix to restrict condition of compress inode conversion

2023-12-28 Thread Chao Yu
On 2023/12/13 6:21, Jaegeuk Kim wrote: On 12/12, Chao Yu wrote: On 2023/12/12 6:11, Jaegeuk Kim wrote: On 12/10, Chao Yu wrote: This patch adds i_size check during compress inode conversion in order to avoid .page_mkwrite races w/ conversion. Which race condition do you see? Something

[f2fs-dev] [PATCH v3 4/6] f2fs: compress: fix to avoid inconsistent bewteen i_blocks and dnode

2023-12-28 Thread Chao Yu
oduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") Signed-off-by: Chao Yu --- fs/f2fs/data.c| 5 +++-- fs/f2fs/f2fs.h| 7 ++- fs/f2fs/file.c| 26 ++ fs/f2fs/segment.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f

[f2fs-dev] [PATCH v3 6/6] f2fs: introduce FAULT_BLKADDR_INCONSISTENCE

2023-12-28 Thread Chao Yu
can: a) use FAULT_BLKADDR_INCONSISTENCE in f2fs_truncate_data_blocks_range() to simulate inconsistent issue independently, b) FAULT_BLKADDR fault will not cause any inconsistent status, we can just use it to check error path handling in kernel side. Signed-off-by: Chao Yu --- v3: - rename FAUL

[f2fs-dev] [PATCH v3 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2023-12-28 Thread Chao Yu
port data compression") Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 20 ++-- fs/f2fs/data.c | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 9940b7886e5d..bf4cfab67aec 100644 --- a/fs/f2fs/compress.c

[f2fs-dev] [PATCH v3 5/6] f2fs: fix to remove unnecessary f2fs_bug_on() to avoid panic

2023-12-28 Thread Chao Yu
verify_blkaddr() will trigger panic once we inject fault into f2fs_is_valid_blkaddr(), fix to remove this unnecessary f2fs_bug_on(). Fixes: 18792e64c86d ("f2fs: support fault injection for f2fs_is_valid_blkaddr()") Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 4 +--- 1 file changed, 1

[f2fs-dev] [PATCH v3 3/6] f2fs: compress: fix to check unreleased compressed cluster

2023-12-28 Thread Chao Yu
From: Sheng Yong Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks(). Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Sheng Yong Signed-off-b

[f2fs-dev] [PATCH v3 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2023-12-28 Thread Chao Yu
If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- v3: - treat compressed

Re: [f2fs-dev] [PATCH v2 6/6] f2fs: introduce FAULT_INCONSISTENCE

2023-12-27 Thread Chao Yu
On 2023/12/28 7:06, Jaegeuk Kim wrote: On 12/25, Chao Yu wrote: We will encounter below inconsistent status when FAULT_BLKADDR type fault injection is on. Info: checkpoint state = d6 : nat_bits crc fsck compacted_summary orphan_inodes sudden-power-off [ASSERT] (fsck_chk_inode_blk:1254

Re: [f2fs-dev] [PATCH 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2023-12-27 Thread Chao Yu
On 2023/12/28 6:55, Jaegeuk Kim wrote: On 12/27, Chao Yu wrote: On 2023/12/27 5:02, Jaegeuk Kim wrote: On 12/20, Chao Yu wrote: If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page

Re: [f2fs-dev] [PATCH v2 1/2] f2fs: move release of block devices to after kill_block_super()

2023-12-27 Thread Chao Yu
fscrypt_destroy_keyring() just after calling ->put_super. This is because fscrypt_destroy_keyring() may call into f2fs_get_devices() via the fscrypt_operations. Signed-off-by: Eric Biggers Reviewed-by: Chao Yu Thanks,

Re: [f2fs-dev] [PATCH 2/3] f2fs: move release of block devices to after kill_block_super()

2023-12-26 Thread Chao Yu
On 2023/12/13 12:00, Eric Biggers wrote: From: Eric Biggers Call destroy_device_list() and free the f2fs_sb_info from kill_f2fs_super(), after the call to kill_block_super(). This is necessary to order it after the call to fscrypt_destroy_keyring() once generic_shutdown_super() starts calling

Re: [f2fs-dev] [PATCH 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2023-12-26 Thread Chao Yu
On 2023/12/27 5:02, Jaegeuk Kim wrote: On 12/20, Chao Yu wrote: If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint. Fixes: 4c8ff7095bef ("f2fs: support

[f2fs-dev] [PATCH v2 6/6] f2fs: introduce FAULT_INCONSISTENCE

2023-12-25 Thread Chao Yu
that we can: a) use FAULT_INCONSISTENCE in f2fs_truncate_data_blocks_range() to simulate inconsistent issue independently, b) FAULT_BLKADDR fault will not cause any inconsistent status, we can just use it to check error path handling in kernel side. Signed-off-by: Chao Yu --- v2: - make __f2fs_is_valid_blkaddr() vo

Re: [f2fs-dev] [PATCH v2] f2fs: Use wait_event_freezable_timeout() for freezable kthread

2023-12-24 Thread Chao Yu
(); try_to_freeze(); We can change it to a simple wait_event_freezable_timeout() and then eliminate the function calls to try_to_freeze() and freezing(). Signed-off-by: Kevin Hao Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs

[f2fs-dev] [PATCH v2 4/6] f2fs: compress: fix to avoid inconsistent bewteen i_blocks and dnode

2023-12-24 Thread Chao Yu
oduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") Signed-off-by: Chao Yu --- v2: - rebase code to last dev-test branch fs/f2fs/data.c| 5 +++-- fs/f2fs/f2fs.h| 7 ++- fs/f2fs/file.c| 26 ++ fs/f2fs/segment.c | 2 +- 4 files changed, 24 insertions(+), 16 deletion

Re: [f2fs-dev] [PATCH 1/2] f2fs: Constrain the modification range of dir_level in the sysfs

2023-12-22 Thread Chao Yu
long Signed-off-by: Yongpeng Yang Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Re: [f2fs-dev] [PATCH 2/2] f2fs: Add error handling for negative returns from do_garbage_collect

2023-12-22 Thread Chao Yu
ted by do_garbage_collect should immediately terminate the current GC. Signed-off-by: Yongpeng Yang Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

[f2fs-dev] [PATCH 2/6] f2fs: compress: fix to cover normal cluster write with cp_rwsem

2023-12-20 Thread Chao Yu
port data compression") Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 20 ++-- fs/f2fs/data.c | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 1122db8cc0b0..a1426c3eadcc 100644 --- a/fs/f2fs/compress.c

[f2fs-dev] [PATCH 3/6] f2fs: compress: fix to check unreleased compressed cluster

2023-12-20 Thread Chao Yu
From: Sheng Yong Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks(). Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Sheng Yong Signed-off-b

[f2fs-dev] [PATCH 1/6] f2fs: compress: fix to guarantee persisting compressed blocks by CP

2023-12-20 Thread Chao Yu
If data block in compressed cluster is not persisted with metadata during checkpoint, after SPOR, the data may be corrupted, let's guarantee to write compressed page by checkpoint. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- fs/f2fs/compress.c |

[f2fs-dev] [PATCH 4/6] f2fs: compress: fix to avoid inconsistent bewteen i_blocks and dnode

2023-12-20 Thread Chao Yu
oduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") Signed-off-by: Chao Yu --- fs/f2fs/data.c| 5 +++-- fs/f2fs/f2fs.h| 7 ++- fs/f2fs/file.c| 26 ++ fs/f2fs/segment.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f

[f2fs-dev] [PATCH 5/6] f2fs: fix to remove unnecessary f2fs_bug_on() to avoid panic

2023-12-20 Thread Chao Yu
verify_blkaddr() will trigger panic once we inject fault into f2fs_is_valid_blkaddr(), fix to remove this unnecessary f2fs_bug_on(). Fixes: 18792e64c86d ("f2fs: support fault injection for f2fs_is_valid_blkaddr()") Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 4 +--- 1 file changed, 1

[f2fs-dev] [PATCH 6/6] f2fs: introduce FAULT_INCONSISTENCE

2023-12-20 Thread Chao Yu
that we can: a) use FAULT_INCONSISTENCE in f2fs_truncate_data_blocks_range() to simulate inconsistent issue independently, b) FAULT_BLKADDR fault will not cause any inconsistent status, we can just use it to check error path handling in kernel side. Signed-off-by: Chao Yu --- Documentation/ABI/testing/sysfs-fs

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

2023-12-19 Thread Chao Yu
On 2023/12/20 9:59, 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. Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks

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

2023-12-19 Thread Chao Yu
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 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 Chao Yu
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 needed. Signed-off-by: Zhiguo Niu --- changes of v2: Improve the patch according to Chao's

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

2023-12-18 Thread Chao Yu
On 2023/12/18 19:07, 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. Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks

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

2023-12-14 Thread Chao Yu
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. Signed-off-by: Zhiguo Niu --- changes of v2: improve patch according Chao's suggestions. --- ---

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

2023-12-12 Thread Chao Yu
eturn EFSCORRUPTED, but try to run online repair") Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

2023-12-11 Thread Chao Yu
On 2023/12/8 16:50, Zhiguo Niu wrote: Should check return value of f2fs_recover_xattr_data in __f2fs_setxattr rather than doing invalid retry if error happen. Also just do set_page_dirty in f2fs_recover_xattr_data when page is changed really. Fixes: 50a472bbc79f ("f2fs: do not return

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

2023-12-11 Thread Chao Yu
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_error(ERROR_INVALID_BLKADDR) into f2fs_is_valid_blkaddr() for cleanup? Thanks, Signed-off-by: Zhiguo Niu ---

Re: [f2fs-dev] [PATCH 5/6] f2fs: fix to restrict condition of compress inode conversion

2023-12-11 Thread Chao Yu
On 2023/12/12 6:11, Jaegeuk Kim wrote: On 12/10, Chao Yu wrote: This patch adds i_size check during compress inode conversion in order to avoid .page_mkwrite races w/ conversion. Which race condition do you see? Something like: - f2fs_setflags_common - check S_ISREG && F2FS_HA

[f2fs-dev] [PATCH v2 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write

2023-12-11 Thread Chao Yu
In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag. Cc: Eric Biggers Signed-off-by: Chao Yu --- v2: - clean up codes fs/f2fs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs

[f2fs-dev] [PATCH 6/6] f2fs: fix to update iostat correctly in f2fs_filemap_fault()

2023-12-10 Thread Chao Yu
In f2fs_filemap_fault(), it fixes to update iostat info only if VM_FAULT_LOCKED is tagged in return value of filemap_fault(). Fixes: 8b83ac81f428 ("f2fs: support read iostat") Signed-off-by: Chao Yu --- fs/f2fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[f2fs-dev] [PATCH 5/6] f2fs: fix to restrict condition of compress inode conversion

2023-12-10 Thread Chao Yu
This patch adds i_size check during compress inode conversion in order to avoid .page_mkwrite races w/ conversion. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 8 +++- fs/f2fs/file.c | 5 ++--- 2 files changed, 9 insert

[f2fs-dev] [PATCH 3/6] f2fs: fix to check compress file in f2fs_move_file_range()

2023-12-10 Thread Chao Yu
f2fs_move_file_range() doesn't support migrating compressed cluster data, let's add the missing check condition and return -EOPNOTSUPP for the case until we support it. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- fs/f2fs/file.c | 5 + 1 file

[f2fs-dev] [PATCH 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write

2023-12-10 Thread Chao Yu
In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag. Cc: Eric Biggers Signed-off-by: Chao Yu --- fs/f2fs/file.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/file.c

[f2fs-dev] [PATCH 2/6] f2fs: fix to wait on block writeback for post_read case

2023-12-10 Thread Chao Yu
to out-of-order GC and common IO. - f2fs_read_end_io Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu --- fs/f2fs/data.c | 7 --- 1 file changed, 4 insertions(+), 3 deletion

[f2fs-dev] [PATCH 1/6] f2fs: fix to tag gcing flag on page during block migration

2023-12-10 Thread Chao Yu
o tag gcing flag on page during file defragment"). Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 4 +++- fs/f2fs/file.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index b35be5799726..c5a4364c4482 100644 --- a/fs/f2fs/

[f2fs-dev] [PATCH 5/6] f2fs: introduce f2fs_invalidate_internal_cache() for cleanup

2023-12-10 Thread Chao Yu
Just cleanup, no logic changes. Signed-off-by: Chao Yu --- fs/f2fs/data.c| 8 +++- fs/f2fs/f2fs.h| 7 +++ fs/f2fs/gc.c | 5 ++--- fs/f2fs/segment.c | 14 -- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index

[f2fs-dev] [PATCH 1/6] f2fs: delete obsolete FI_FIRST_BLOCK_WRITTEN

2023-12-10 Thread Chao Yu
ge as zero. After commit 7bc155fec5b3 ("f2fs: kill volatile write support"), we won't support volatile write, but it missed to remove obsolete FI_FIRST_BLOCK_WRITTEN, delete it in this patch. Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 2 -- fs/f2fs/data.c | 2 -- fs/f2fs/f2fs.h

[f2fs-dev] [PATCH 3/6] f2fs: introduce get_dnode_addr() to clean up codes

2023-12-10 Thread Chao Yu
Just cleanup, no logic changes. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 11 ++- fs/f2fs/f2fs.h | 18 +++--- fs/f2fs/file.c | 8 +--- fs/f2fs/inode.c | 32 ++-- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/fs/f2fs

[f2fs-dev] [PATCH 4/6] f2fs: update blkaddr in __set_data_blkaddr() for cleanup

2023-12-10 Thread Chao Yu
This patch allows caller to pass blkaddr to f2fs_set_data_blkaddr() and let __set_data_blkaddr() inside f2fs_set_data_blkaddr() to update dn->data_blkaddr w/ last value of blkaddr. Just cleanup, no logic changes. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 13 ++--- fs/f2fs/f2fs.h |

[f2fs-dev] [PATCH 2/6] f2fs: delete obsolete FI_DROP_CACHE

2023-12-10 Thread Chao Yu
FI_DROP_CACHE was introduced in commit 1e84371ffeef ("f2fs: change atomic and volatile write policies") for volatile write feature, after commit 7bc155fec5b3 ("f2fs: kill volatile write support"), we won't support volatile write, let's delete related codes. Signed-off-by: C

[f2fs-dev] [PATCH 6/6] f2fs: add tracepoint for f2fs_vm_page_mkwrite()

2023-12-10 Thread Chao Yu
This patch adds to support tracepoint for f2fs_vm_page_mkwrite(), meanwhile it prints more details for trace_f2fs_filemap_fault(). Signed-off-by: Chao Yu --- fs/f2fs/file.c | 25 ++-- include/trace/events/f2fs.h | 39 - 2

Re: [f2fs-dev] [PATCH 1/1] f2fs: fix fallocate failed under pinned block situation

2023-12-09 Thread Chao Yu
On 2023/11/28 20:51, Wu Bo wrote: On 2023/11/28 14:22, Chao Yu wrote: On 2023/11/17 7:34, Wu Bo wrote: On 2023/11/11 12:49, Chao Yu wrote: On 2023/11/8 21:48, Wu Bo wrote: On 2023/11/7 22:39, Chao Yu wrote: On 2023/10/30 17:40, Wu Bo wrote: If GC victim has pinned block, it can't

Re: [f2fs-dev] [PATCH] f2fs: compress: do cleanup in f2fs_truncate_partial_cluster()

2023-12-09 Thread Chao Yu
On 2023/11/30 17:23, Yangtao Li wrote: Remove unnecessary code logic. Signed-off-by: Yangtao Li --- fs/f2fs/compress.c | 30 +- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index

[f2fs-dev] [PATCH 2/2] f2fs: show i_mode in trace_f2fs_new_inode()

2023-11-28 Thread Chao Yu
This patch supports to show i_mode field in trace_f2fs_new_inode(). Signed-off-by: Chao Yu --- include/trace/events/f2fs.h | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 36d9e29ca3c5

[f2fs-dev] [PATCH 1/2] f2fs: introduce tracepoint for f2fs_rename()

2023-11-28 Thread Chao Yu
This patch adds tracepoints for f2fs_rename(). Signed-off-by: Chao Yu --- fs/f2fs/namei.c | 16 ++--- include/trace/events/f2fs.h | 69 + 2 files changed, 80 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index

[f2fs-dev] [PATCH] f2fs: fix to avoid dirent corruption

2023-11-28 Thread Chao Yu
s: 7e01e7ad746b ("f2fs: support RENAME_WHITEOUT") Cc: Jan Kara Reported-by: Al Viro Signed-off-by: Chao Yu --- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 3b1793cfb002..ede6afb81762 100644 --- a/fs/f2fs/namei.c

Re: [f2fs-dev] [PATCH v2] f2fs-tools: fixed incorrect error handling

2023-11-27 Thread Chao Yu
On 2023/11/20 15:55, Maxim Korotkov wrote: Case of failed memory allocation of dev->zone_cap_blocks doesn't release heap allocated rep Found by RASU JSC Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support) Signed-off-by: Maxim Korotkov Reviewed-by: Chao Yu Tha

Re: [f2fs-dev] [PATCH 1/1] f2fs: fix fallocate failed under pinned block situation

2023-11-27 Thread Chao Yu
On 2023/11/17 7:34, Wu Bo wrote: On 2023/11/11 12:49, Chao Yu wrote: On 2023/11/8 21:48, Wu Bo wrote: On 2023/11/7 22:39, Chao Yu wrote: On 2023/10/30 17:40, Wu Bo wrote: If GC victim has pinned block, it can't be recycled. And if GC is foreground running, after many failure try, the pinned

Re: [f2fs-dev] [PATCH] f2fs: add support for an i_version counter

2023-11-27 Thread Chao Yu
On 2023/11/20 17:54, Yangtao Li wrote: NFSv4 mandates a change attribute to avoid problems with timestamp granularity, which Linux implements using the i_version counter. This is particularly important when the underlying filesystem is fast. Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 1

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

2023-11-27 Thread Chao Yu
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 we can check them through sysfs when needed. What about adding this entry to /sys/fs/f2fs//stat/?

Re: [f2fs-dev] [PATCH 2/3] f2fs-tools: Wait for Block Size to initialize Cache

2023-11-27 Thread Chao Yu
On 2023/11/28 8:52, Daniel Rosenberg wrote: On Sun, Nov 26, 2023 at 5:42 PM Chao Yu wrote: Hi Daniel, How about this? It be more explicit to indicate the logic? --- fsck/mount.c | 2 ++ include/f2fs_fs.h | 3 +++ lib/libf2fs_io.c | 4 3 files changed, 9 insertions

Re: [f2fs-dev] [PATCH v1] f2fs: New victim selection for GC

2023-11-26 Thread Chao Yu
Hi Yonggil, On 2023/10/26 17:18, Yonggil Song wrote: Overview Introduce a new way to select the data section first when selecting a victim in foreground GC. This victim selection method works when the prefer_data_victim mount option is enabled. If foreground GC migrates only data

Re: [f2fs-dev] [PATCH 3/3] f2fs-tools: Fix dqb_curspace to reflect blocksize

2023-11-26 Thread Chao Yu
On 2023/11/18 10:03, Daniel Rosenberg wrote: The initial sizes for dqblk.dqb_curspace should reflect the block size, as that's the minimal filesize. Signed-off-by: Daniel Rosenberg Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list

Re: [f2fs-dev] [PATCH 2/3] f2fs-tools: Wait for Block Size to initialize Cache

2023-11-26 Thread Chao Yu
On 2023/11/18 10:03, Daniel Rosenberg wrote: The cache is initialized during the first read, however, it requires the block size to establish its buffer. This disables the cache until the block size is known. Hi Daniel, How about this? It be more explicit to indicate the logic? ---

Re: [f2fs-dev] [PATCH 1/3] f2fs-tools: Fix debug size print

2023-11-24 Thread Chao Yu
On 2023/11/18 10:03, Daniel Rosenberg wrote: The conversion from block size to MB in this debug statement assumes a block size of 4K. This switches it to properly use the filesystem's block size. Signed-off-by: Daniel Rosenberg Reviewed-by: Chao Yu Thanks

[f2fs-dev] [PATCH] f2fs: sysfs: support discard_io_aware

2023-11-22 Thread Chao Yu
. Signed-off-by: Chao Yu --- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++ fs/f2fs/f2fs.h | 7 +++ fs/f2fs/segment.c | 6 +- fs/f2fs/sysfs.c | 9 + 4 files changed, 27 insertions(+), 1 deletion(-) diff

Re: [f2fs-dev] [PATCH] f2fs-tools: adjust nat and block release logic

2023-11-19 Thread Chao Yu
On 2023/11/18 4:38, Daeho Jeong wrote: From: Daeho Jeong Fixes: 0f503e443ccb ("f2fs-tools: do not reuse corrupted quota inodes") Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-

Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists

2023-11-19 Thread Chao Yu
On 2023/11/18 1:41, Jaegeuk Kim wrote: Not sure other cases yet.. let's do one by one, since I hit this in real. Sure. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thansk, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel

[f2fs-dev] [PATCH 3/3] f2fs: fix to check return value of f2fs_reserve_new_block()

2023-11-15 Thread Chao Yu
; Signed-off-by: Chao Yu --- fs/f2fs/recovery.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index b56d0f1078a7..16415c770b45 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -712,7 +712,16 @@ static

[f2fs-dev] [PATCH 2/3] f2fs: use shared inode lock during f2fs_fiemap()

2023-11-15 Thread Chao Yu
f2fs_fiemap() will only traverse metadata of inode, let's use shared inode lock for it to avoid unnecessary race on inode lock. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 4e42b5f24deb

[f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name

2023-11-15 Thread Chao Yu
Just cleanup, no logic changes. Signed-off-by: Chao Yu --- fs/f2fs/namei.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index d0053b0284d8..a9360ee02da1 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -459,7 +459,6 @@ static

Re: [f2fs-dev] [PATCH] f2fs-tools: do not put CP_UMOUNT_FLAG for roll forward recovery

2023-11-15 Thread Chao Yu
On 2023/10/27 23:49, Daeho Jeong wrote: From: Daeho Jeong If we write CP_UMOUNT_FLAG in fsck, f2fs will not do foll forward recovery :s/foll/roll Otherwise, it looks good to me. Reviewed-by: Chao Yu Thanks, even though it has to do. Signed-off-by: Daeho Jeong --- fsck/fsck.c

Re: [f2fs-dev] [PATCH] f2fs-tools: use total_node_count when creating a new node block in fsck

2023-11-15 Thread Chao Yu
On 2023/10/27 23:30, Daeho Jeong wrote: From: Daeho Jeong We might allocate more node blocks than total_valid_node_count, when we recreate quota files. Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list

Re: [f2fs-dev] [PATCH] f2fs-tools: ensure that unused xattr space is zeroized

2023-11-15 Thread Chao Yu
when writing xattrs. So, the kernel relies on the unused space containing zeroes. Also, add a missing free() to fix a memory leak. Signed-off-by: Eric Biggers Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel

Re: [f2fs-dev] [PATCH] f2fs-tools: fix corrupted xattr entry

2023-11-15 Thread Chao Yu
On 2023/10/23 23:50, Jaegeuk Kim wrote: From: Daeho Jeong Detect and fix a corrupted xattr entry. Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https

Re: [f2fs-dev] [PATCH v2] f2fs-tools: do not reuse corrupted quota inodes

2023-11-15 Thread Chao Yu
On 2023/10/27 8:21, Daeho Jeong wrote: From: Daeho Jeong When we detect quota inode corruption, we better deallocate the current space and allocate new ones for a clean start. Signed-off-by: Daeho Jeong --- v2: change node count check when creating a new node block --- fsck/fsck.c|

Re: [f2fs-dev] [PATCH v2] f2fs_io: add list/setattr command

2023-11-14 Thread Chao Yu
On 2023/10/20 10:39, Jaegeuk Kim wrote: Let's add list/set/removexattrs commands. It looks it missed to add related description in man/f2fs_io.8. Thanks, Signed-off-by: Jaegeuk Kim --- - add removexattrs tools/f2fs_io/f2fs_io.c | 107 1 file

Re: [f2fs-dev] [PATCH 2/2] fsck.f2fs: fix cache offset for multiple partitions

2023-11-14 Thread Chao Yu
On 2023/10/17 5:58, Jaegeuk Kim wrote: The cache offset should have been considered multiple partitions per fd. Let's fix. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel

Re: [f2fs-dev] [PATCH 1/2] Revert "f2fs-tools: do not support user-space cache"

2023-11-14 Thread Chao Yu
On 2023/10/17 5:58, Jaegeuk Kim wrote: This reverts commit 2835107ae3908576b41ff5f6a4e63ba7ec9a6246. There's a report that the impact was true. Signed-off-by: Jaegeuk Kim Sorry for delay reply, feel free to add: Reviewed-by: Chao Yu Thanks

Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists

2023-11-14 Thread Chao Yu
On 2023/11/15 10:45, Jaegeuk Kim wrote: On 11/15, Chao Yu wrote: On 2023/11/15 5:24, Jaegeuk Kim wrote: When recovering zoned UFS, sometimes we add the same zone to discard multiple times. Simple workaround is to bypass adding it. What about skipping f2fs_bug_on() just for zoned UFS case? so

Re: [f2fs-dev] [PATCH] f2fs: skip adding a discard command if exists

2023-11-14 Thread Chao Yu
On 2023/11/15 5:24, Jaegeuk Kim wrote: When recovering zoned UFS, sometimes we add the same zone to discard multiple times. Simple workaround is to bypass adding it. What about skipping f2fs_bug_on() just for zoned UFS case? so that the check condition can still be used for non-zoned UFS case.

Re: [f2fs-dev] [PATCH 1/1] f2fs: fix fallocate failed under pinned block situation

2023-11-10 Thread Chao Yu
On 2023/11/8 21:48, Wu Bo wrote: On 2023/11/7 22:39, Chao Yu wrote: On 2023/10/30 17:40, Wu Bo wrote: If GC victim has pinned block, it can't be recycled. And if GC is foreground running, after many failure try, the pinned file is expected to be clear pin flag. To enable the section

Re: [f2fs-dev] [PATCH V2] libf2fs: Fix using uninitialized variables error in get_device_info()

2023-11-09 Thread Chao Yu
-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Re: [f2fs-dev] [PATCH] libf2fs: Fix using uninitialized variables error in get_device_info()

2023-11-09 Thread Chao Yu
On 2023/11/8 20:38, zangyangyang1 wrote: This issue comes from a static code scanning tool. When c.sparse_mode is 1, stat_buf will not be initialized, but it will be used next. If this issue does not require modification, please ignore this commit. Signed-off-by: zangyangyang1 ---

Re: [f2fs-dev] [PATCH] f2fs: data: fix possible overflow in check_swap_activate()

2023-11-07 Thread Chao Yu
Hi Sergey, Thanks for the patch. On 2023/10/26 4:20, Sergey Shtylyov wrote: In check_swap_activate(), if the *while* loop exits early (0- or 1-page long swap file), an overflow happens while calculating the value of the span parameter as the lowest_pblock variable ends up being greater than

Re: [f2fs-dev] [PATCH] f2fs: explicitly null-terminate the xattr list

2023-11-07 Thread Chao Yu
On 2023/11/7 12:44, Eric Biggers wrote: From: Eric Biggers When setting an xattr, explicitly null-terminate the xattr list. This eliminates the fragile assumption that the unused xattr space is always zeroed. Signed-off-by: Eric Biggers Reviewed-by: Chao Yu Thanks

Re: [f2fs-dev] [PATCH] f2fs: the name of a struct is wrong in a comment.

2023-11-07 Thread Chao Yu
On 2023/11/4 15:45, ds...@lzu.edu.cn wrote: From: Yang Hubin The macro SUMMARY_SIZE represents the size of the struct f2fs_summary, instead of the size of the struct summary. Signed-off-by: Yang Hubin Signed-off-by: Qian Haolai Reviewed-by: Chao Yu Thanks

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

2023-11-07 Thread Chao Yu
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 device number information. If there are more than one partition using the f2fs file system, it is very

Re: [f2fs-dev] [PATCH 1/1] f2fs: fix fallocate failed under pinned block situation

2023-11-07 Thread Chao Yu
On 2023/10/30 17:40, Wu Bo wrote: If GC victim has pinned block, it can't be recycled. And if GC is foreground running, after many failure try, the pinned file is expected to be clear pin flag. To enable the section be recycled. But when fallocate trigger FG_GC, GC can never recycle the pinned

<    1   2   3   4   5   6   7   8   9   10   >