Re: [f2fs-dev] [PATCH v5] f2fs: prevent writing without fallocate() for pinned files

2024-03-29 Thread Chao Yu
On 2024/3/27 4:31, Daeho Jeong wrote: From: Daeho Jeong In a case writing without fallocate(), we can't guarantee it's allocated in the conventional area for zoned stroage. To make it consistent across storage devices, we disallow it regardless of storage device types. Signed-off-by: Daeho

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

2024-03-29 Thread Chao Yu
On 2024/3/27 16:53, 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 in while loop, which is unnecessary. Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks

[f2fs-dev] [PATCH v2] f2fs: zone: don't block IO if there is remained open zone

2024-03-28 Thread Chao Yu
Jeong Signed-off-by: Chao Yu --- v2: - remove unneeded declaration. fs/f2fs/data.c| 80 +-- fs/f2fs/f2fs.h| 33 --- fs/f2fs/iostat.c | 7 + fs/f2fs/iostat.h | 2 ++ fs/f2fs/segment.c | 58

[f2fs-dev] [PATCH] f2fs: zone: don't block IO if there is remained open zone

2024-03-28 Thread Chao Yu
Jeong Signed-off-by: Chao Yu --- fs/f2fs/data.c| 80 +-- fs/f2fs/f2fs.h| 34 +--- fs/f2fs/iostat.c | 7 + fs/f2fs/iostat.h | 2 ++ fs/f2fs/segment.c | 58 ++ fs/f2fs/segment.h | 12 ++- fs

[f2fs-dev] [PATCH v6] f2fs: fix zoned block device information initialization

2024-03-28 Thread Chao Yu
From: Wenjie Qi If the max open zones of zoned devices are less than the active logs of F2FS, the device may error due to insufficient zone resources when multiple active logs are being written at the same time. Signed-off-by: Wenjie Qi Signed-off-by: Chao Yu --- v6: - add check condition

[f2fs-dev] [PATCH v2] f2fs: multidev: fix to recognize valid zero block address

2024-03-27 Thread Chao Yu
d-by: Yi Zhang Fixes: 1517c1a7a445 ("f2fs: implement iomap operations") Fixes: 8d3c1fa3fa5e ("f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin") Signed-off-by: Chao Yu --- v2: - add Tested-by tag of Yi Zhang. fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

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

2024-03-27 Thread Chao Yu
On 2024/3/27 9:26, Zhiguo Niu wrote: 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 in while

Re: [f2fs-dev] [PATCH] f2fs: remove clear SB_INLINECRYPT flag in default_options

2024-03-27 Thread Chao Yu
Yunlei He 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: multidev: fix to recognize valid zero block address

2024-03-26 Thread Chao Yu
On 2024/3/26 21:26, Yi Zhang wrote: I confirmed the issue was fixed now, thanks. Tested-by: Yi Zhang Yi, thanks for the test. Thanks, On Mon, Mar 25, 2024 at 11:26 PM Chao Yu wrote: As reported by Yi Zhang in mailing list [1], kernel warning was catched during zbd/010 test as below

[f2fs-dev] [PATCH] f2fs: fix to wait on page writeback in __clone_blkaddrs()

2024-03-26 Thread Chao Yu
- f2fs_up_write(dst) - f2fs_down_write(dst) - __exchange_data_block - __clone_blkaddrs - f2fs_get_new_data_page - memcpy_page Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up") Signed-off-by: Chao Yu --- fs/f2fs/file.c | 3 +++ 1 file

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

2024-03-26 Thread Chao Yu
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 in while loop, which is unnecessary. Signed-off-by: Zhiguo Niu --- v2: check i_size within inode

Re: [f2fs-dev] [PATCH v3] f2fs: prevent writing without fallocate() for pinned files

2024-03-25 Thread Chao Yu
On 2024/3/25 23:02, Daeho Jeong wrote: On Fri, Mar 22, 2024 at 9:26 PM Chao Yu wrote: On 2024/3/21 1:42, Daeho Jeong wrote: On Wed, Mar 20, 2024 at 2:38 AM Chao Yu wrote: On 2024/3/20 5:23, Daeho Jeong wrote: From: Daeho Jeong In a case writing without fallocate(), we can't guarantee

Re: [f2fs-dev] [bug report]WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 iomap_iter+0x32b observed with blktests zbd/010

2024-03-25 Thread Chao Yu
On 2024/3/25 14:56, Shinichiro Kawasaki wrote: On Mar 25, 2024 / 11:06, Chao Yu wrote: On 2024/3/25 10:14, Shinichiro Kawasaki wrote: On Mar 24, 2024 / 20:13, Chao Yu wrote: ... Hi Shinichiro, Can you please check below diff? IIUC, for the case: f2fs_map_blocks() returns zero blkaddr in non

[f2fs-dev] [PATCH 2/2] f2fs: support to map continuous holes or preallocated address

2024-03-25 Thread Chao Yu
tart blkaddr = 0x, len = 0x100, flags = 4, seg_type = 1, may_create = 0, multidevice = 0, flag = 3, err = 0 f2fs_direct_IO_exit: dev = (253,16), ino = 11 pos = 0 len = 1048576 rw = 0 ret = 1048576 Signed-off-by: Chao Yu --- fs/f2fs/data.c | 29 +++-- 1 file cha

[f2fs-dev] [PATCH 1/2] f2fs: introduce map_is_mergeable() for cleanup

2024-03-25 Thread Chao Yu
No logic changes. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 5ef1874b572a..9c000ca4f808 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1507,6 +1507,23

[f2fs-dev] [PATCH] f2fs: multidev: fix to recognize valid zero block address

2024-03-25 Thread Chao Yu
es: 1517c1a7a445 ("f2fs: implement iomap operations") Fixes: 8d3c1fa3fa5e ("f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin") Signed-off-by: Chao Yu --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index d9494b5

Re: [f2fs-dev] [bug report]WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 iomap_iter+0x32b observed with blktests zbd/010

2024-03-24 Thread Chao Yu
On 2024/3/25 10:14, Shinichiro Kawasaki wrote: On Mar 24, 2024 / 20:13, Chao Yu wrote: ... Hi Shinichiro, Can you please check below diff? IIUC, for the case: f2fs_map_blocks() returns zero blkaddr in non-primary device, which is a verified valid block address, we'd better to check m_flags

Re: [f2fs-dev] [bug report]WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 iomap_iter+0x32b observed with blktests zbd/010

2024-03-24 Thread Chao Yu
On 2024/3/19 19:13, Shinichiro Kawasaki wrote: On Mar 19, 2024 / 10:22, Chao Yu wrote: On 2024/3/18 13:47, Shinichiro Kawasaki via Linux-f2fs-devel wrote: I confirmed that the trigger commit is dbf8e63f48af as Yi reported. I took a look in the commit, but it looks fine to me. So I thought

Re: [f2fs-dev] [PATCH v3] f2fs: prevent writing without fallocate() for pinned files

2024-03-22 Thread Chao Yu
On 2024/3/21 1:42, Daeho Jeong wrote: On Wed, Mar 20, 2024 at 2:38 AM Chao Yu wrote: On 2024/3/20 5:23, Daeho Jeong wrote: From: Daeho Jeong In a case writing without fallocate(), we can't guarantee it's allocated in the conventional area for zoned stroage. Signed-off-by: Daeho Jeong

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

2024-03-22 Thread Chao Yu
On 2024/3/22 14:03, 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 in while loop, which is unnecessary. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c | 4 +++- 1

Re: [f2fs-dev] [PATCH] f2fs: Prevent s_writer rw_sem count mismatch in f2fs_evict_inode

2024-03-22 Thread Chao Yu
-by: Sunmin Jeong Signed-off-by: Yeongjin Gil 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] f2fs: fix to detect inconsistent nat entry during truncation

2024-03-22 Thread Chao Yu
des() may return -ENOENT, and f2fs_truncate_inode_blocks() doesn't handle such error correctly, fix it. Reported-by: Roman Smirnov Closes: https://lore.kernel.org/linux-f2fs-devel/085b27fd2b364a3c8c3a9ca77363e...@omp.ru Signed-off-by: Chao Yu --- fs/f2fs/node.c | 12 +++- 1 file changed, 11 i

Re: [f2fs-dev] [PATCH] f2fs: avoid the deadlock case when stopping discard thread

2024-03-20 Thread Chao Yu
,: waiting STOP_CP_REASON_SHUTDOWN); - f2fs_stop_discard_thread(sbi); - kthread_stop() : waiting - mnt_drop_write_file(filp); Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs

Re: [f2fs-dev] [PATCH v3] f2fs: prevent writing without fallocate() for pinned files

2024-03-20 Thread Chao Yu
On 2024/3/20 5:23, Daeho Jeong wrote: From: Daeho Jeong In a case writing without fallocate(), we can't guarantee it's allocated in the conventional area for zoned stroage. Signed-off-by: Daeho Jeong --- v2: covered the direct io case v3: covered the mkwrite case --- fs/f2fs/data.c | 14

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

2024-03-20 Thread Chao Yu
On 2024/3/20 14:22, Zhiguo Niu wrote: 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 Reviewed-by: Chao Yu Thanks

Re: [f2fs-dev] [bug report]WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 iomap_iter+0x32b observed with blktests zbd/010

2024-03-18 Thread Chao Yu
On 2024/3/18 13:47, Shinichiro Kawasaki via Linux-f2fs-devel wrote: I confirmed that the trigger commit is dbf8e63f48af as Yi reported. I took a look in the commit, but it looks fine to me. So I thought the cause is not in the commit diff. I found the WARN is printed when the f2fs is set up

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

2024-03-18 Thread Chao Yu
On 2024/3/15 19:32, Zhiguo Niu wrote: 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 |

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

2024-03-14 Thread Chao Yu
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, which will cause filesystem not idle. Meanwhile adjust f2fs_update_time(REQ_TIME) of f2fs_ioc_defragment

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

2024-03-14 Thread Chao Yu
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 successful case. Signed-off-by: Zhiguo Niu --- fs/f2fs/file.c | 9 - 1 file changed,

Re: [f2fs-dev] [PATCH 2/2] f2fs: truncate page cache before clearing flags when aborting atomic write

2024-03-14 Thread Chao Yu
+ Reviewed-by: Sungjong Seo Reviewed-by: Yeongjin Gil Signed-off-by: Sunmin Jeong 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 1/2] f2fs: mark inode dirty for FI_ATOMIC_COMMITTED flag

2024-03-14 Thread Chao Yu
- skip f2fs_update_inode since the inode is clean Fixes: 3db1de0e582c ("f2fs: change the current atomic write way") Cc: sta...@vger.kernel.org #v5.19+ Reviewed-by: Sungjong Seo Reviewed-by: Yeongjin Gil Signed-off-by: Sunmin Jeong Reviewed-by: Chao Y

Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault

2024-03-13 Thread Chao Yu
On 2024/3/13 9:31, Jaegeuk Kim wrote: On 03/12, Ed Tsai (蔡宗軒) wrote: On Mon, 2024-01-15 at 20:05 +0800, Hillf Danton wrote: ... --- x/fs/f2fs/file.c +++ y/fs/f2fs/file.c @@ -39,6 +39,7 @@ static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf) { struct inode *inode =

[f2fs-dev] [PATCH] f2fs: fix to avoid use-after-free issue in f2fs_filemap_fault

2024-03-13 Thread Chao Yu
e. Fixes: 87f3afd366f7 ("f2fs: add tracepoint for f2fs_vm_page_mkwrite()") Reported-and-tested-by: syzbot+763afad57075d3f86...@syzkaller.appspotmail.com Closes: https://lore.kernel.org/lkml/e8222b060f00d...@google.com Cc: Ed Tsai Cc: Hillf Danton Signed-off-by: Chao Yu ---

Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault

2024-03-13 Thread Chao Yu
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git wip On 2024/1/15 17:12, syzbot wrote: Hello, syzbot found the following issue on: HEAD commit:052d534373b7 Merge tag 'exfat-for-6.8-rc1' of git://git.ke.. git tree: upstream console output:

Re: [f2fs-dev] [PATCH v2] f2fs: prevent writing without fallocate() for pinned files

2024-03-12 Thread Chao Yu
On 2024/3/13 4:49, Daeho Jeong wrote: From: Daeho Jeong In a case writing without fallocate(), we can't guarantee it's allocated in the conventional area for zoned stroage. Signed-off-by: Daeho Jeong --- v2: covered the direct io case Oh, one more missed case, mkwrite? Thanks, ---

Re: [f2fs-dev] [PATCH 2/2] f2fs: prevent writing without fallocate() for pinned files

2024-03-11 Thread Chao Yu
On 2024/3/12 7:59, Daeho Jeong wrote: From: Daeho Jeong In a case writing without fallocate(), we can't guarantee it's allocated in the conventional area for zoned stroage. Signed-off-by: Daeho Jeong --- fs/f2fs/data.c | 7 +++ fs/f2fs/file.c | 4 2 files changed, 11

Re: [f2fs-dev] [PATCH 1/2] f2fs: prevent atomic write on pinned file

2024-03-11 Thread Chao Yu
On 2024/3/12 7:59, Daeho Jeong wrote: From: Daeho Jeong Since atomic write way was changed to out-place-update, we should prevent it on pinned files. Signed-off-by: Daeho Jeong Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list

Re: [f2fs-dev] [PATCH] f2fs: support .shutdown in f2fs_sops

2024-03-11 Thread Chao Yu
Ping, On 2024/2/29 22:38, Chao Yu wrote: Support .shutdown callback in f2fs_sops, then, it can be called to shut down the file system when underlying block device is marked dead. Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/file.c | 70

Re: [f2fs-dev] [PATCH] f2fs: fix to return EIO when reading after device removal

2024-03-11 Thread Chao Yu
Ping, Jaegeuk, do you have any comments on this patch? Thanks, On 2024/2/26 16:00, Chao Yu wrote: Any comments? Thanks, On 2024/2/19 11:13, Chao Yu wrote: On 2024/2/8 8:18, Jaegeuk Kim wrote: On 02/06, Chao Yu wrote: generic/730 2s ... - output mismatch (see /media/fstests/results

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

2024-03-11 Thread Chao Yu
On 2024/3/11 15:48, 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 expansion in {new,change}_curseg(). Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu

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

2024-03-11 Thread Chao Yu
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 expansion in {new,change}_curseg(). Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu --- fs

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

2024-03-10 Thread Chao Yu
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") Signed-off-by: Zhiguo Niu --- fs/f2fs/data.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff

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

2024-03-10 Thread Chao Yu
On 2024/3/8 14:25, 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. Do f2fs_handle_error in __f2fs_is_valid_blkaddr for cleanup. Signed-off-by: Zhiguo Niu Signed-off-by: Chao Yu

Re: [f2fs-dev] [PATCH 1/5] f2fs: fix to wait page writeback before update

2024-03-07 Thread Chao Yu
On 2020/6/20 6:47, Jaegeuk Kim wrote: diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 3268f8dd59bb..1862073b96d2 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1250,6 +1250,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,

[f2fs-dev] [PATCH] f2fs: zone: fix to remove pow2 check condition for zoned block device

2024-03-07 Thread Chao Yu
Commit 2e2c6e9b72ce ("f2fs: remove power-of-two limitation of zoned device") missed to remove pow2 check condition in init_blkz_info(), fix it. Fixes: 2e2c6e9b72ce ("f2fs: remove power-of-two limitation of zoned device") Signed-off-by: Feng Song Signed-off-by: Yongpeng Yang

[f2fs-dev] [PATCH v2] f2fs: fix to truncate meta inode pages forcely

2024-03-07 Thread Chao Yu
on, so we need to use truncate_inode_pages_range() instead of invalidate_mapping_pages() to make sure meta_inode page will be dropped. Fixes: 6aa58d8ad20a ("f2fs: readahead encrypted block during GC") Fixes: e3b49ea36802 ("f2fs: invalidate META_MAPPING before IPU/DIO write") Si

Re: [f2fs-dev] [PATCH] f2fs: fix to truncate meta inode pages forcely

2024-03-07 Thread Chao Yu
On 2024/3/8 2:37, Jaegeuk Kim wrote: On 03/07, Chao Yu wrote: Below race case can cause data corruption: Thread AGC thread - f2fs_inplace_write_data - gc_data_segment

[f2fs-dev] [PATCH] f2fs: fix to truncate meta inode pages forcely

2024-03-07 Thread Chao Yu
and so on, so we need to use truncate_inode_pages_range() instead of invalidate_mapping_pages() to make sure meta_inode page will be dropped. Fixes: 6aa58d8ad20a ("f2fs: readahead encrypted block during GC") Fixes: e3b49ea36802 ("f2fs: invalidate META_MAPPING before IPU/DIO write")

[f2fs-dev] [PATCH] f2fs_io: support get_advise command

2024-03-06 Thread Chao Yu
Support get_advise command to get i_advise field value and info in file. For example: f2fs_io get_advise /mnt/f2fs/foo.so i_advise=0x11, advise_type: cold keep_size Signed-off-by: Chao Yu --- man/f2fs_io.8 | 3 +++ tools/f2fs_io/f2fs_io.c | 41

Re: [f2fs-dev] [PATCH V2 2/2] f2fs: compress: fix reserve_cblocks counting error when out of space

2024-03-05 Thread Chao Yu
reserve_cblocks test.apk 924 Fixes: c75488fb4d82 ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") Signed-off-by: Xiuhong Wang Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-

Re: [f2fs-dev] [PATCH V2 1/2] f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks

2024-03-05 Thread Chao Yu
placed after the judgement of is_inode_flag_set(inode, FI_COMPRESS_RELEASED). Fixes: c75488fb4d82 ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS") Signed-off-by: Xiuhong Wang Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks, ___ Linux-

Re: [f2fs-dev] [PATCH v2] f2fs: add a proc entry show disk map

2024-03-05 Thread Chao Yu
On 2024/3/6 7:28, Jaegeuk Kim wrote: This patch adds the disk map of block address ranges configured by multiple partitions. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel

Re: [f2fs-dev] [PATCH] f2fs-tools: deal with permission denial on non-root user

2024-03-05 Thread Chao Yu
On 2024/3/6 4:48, Jaegeuk Kim wrote: This fixes some android build failures due to the missing permission when checking the loop device. Until we get a better solution, let's ignore the error with warnings. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks

Re: [f2fs-dev] [PATCH 2/2] f2fs: compress: fix reserve_cblocks counting error when out of space

2024-03-05 Thread Chao Yu
On 2024/3/5 16:40, Xiuhong Wang wrote: When a file only needs one direct_node, performing the following operations will cause the file to be unrepairable: unisoc # ./f2fs_io compress test.apk unisoc #df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.2M 100% /data unisoc # ./f2fs_io

Re: [f2fs-dev] [PATCH 1/2] f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks

2024-03-05 Thread Chao Yu
On 2024/3/5 16:40, Xiuhong Wang wrote: The following f2fs_io test will get a "0" result instead of -EINVAL, unisoc # ./f2fs_io compress file unisoc # ./f2fs_io reserve_cblocks file 0 it's not reasonable, so the judgement of atomic_read(_I(inode)->i_compr_blocks) should be placed after the

Re: [f2fs-dev] [PATCH] f2fs: Cast expression type to unsigned long in __count_extent_cache()

2024-03-05 Thread Chao Yu
On 2024/3/5 16:09, Roman Smirnov wrote: Cast expression type to unsigned long in __count_extent_cache() to prevent integer overflow. Found by Linux Verification Center (linuxtesting.org) with Svace. Signed-off-by: Roman Smirnov Reviewed-by: Sergey Shtylyov Reviewed-by: Chao Yu Thanks

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

2024-03-04 Thread Chao Yu
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: 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

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

2024-03-03 Thread Chao Yu
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 result should be check in its caller f2fs_allocate_segment_for_resize, alos pass this results

[f2fs-dev] [PATCH v2] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup

2024-03-03 Thread Chao Yu
Just cleanup, no functional change. Signed-off-by: Chao Yu --- v2: - don't cast type of segment number from unsigned int to long long, because segs << log_blocks_per_seg won't overflow due to f2fs doesn't support 64-bits addressing. fs/f2fs/debug.c | 7 +++ fs/f2fs/f2fs.h

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

2024-03-03 Thread Chao Yu
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_range. Zhiguo, What about handling all error paths of new_curseg() and change_curseg()

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

2024-03-03 Thread Chao Yu
. 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 1/2] f2fs: fix to check return value __allocate_new_segment

2024-03-03 Thread Chao Yu
On 2024/3/1 16:25, Zhiguo Niu wrote: __allocate_new_segment may return error when get_new_segment fails, so its caller should check its return value. Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux

Re: [f2fs-dev] [PATCH] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup

2024-02-29 Thread Chao Yu
On 2024/3/1 9:57, Jaegeuk Kim wrote: On 03/01, Chao Yu wrote: On 2024/3/1 0:35, Jaegeuk Kim wrote: On 02/29, Chao Yu wrote: On 2024/2/28 1:47, Jaegeuk Kim wrote: On 02/21, Chao Yu wrote: Just cleanup, no functional change. Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 7

Re: [f2fs-dev] [PATCH 1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()

2024-02-29 Thread Chao Yu
On 2024/3/1 1:41, Daeho Jeong wrote: On Thu, Feb 29, 2024 at 2:11 AM Chao Yu wrote: Jaegeuk, Daeho, Any comments on this serials? Thanks, No functional difference here, since start_blk is always aligned with the section address. You're right. However, this is more clear in itself

Re: [f2fs-dev] [PATCH] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup

2024-02-29 Thread Chao Yu
On 2024/3/1 0:35, Jaegeuk Kim wrote: On 02/29, Chao Yu wrote: On 2024/2/28 1:47, Jaegeuk Kim wrote: On 02/21, Chao Yu wrote: Just cleanup, no functional change. Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 7 +++ fs/f2fs/f2fs.h| 14 -- fs/f2fs/gc.c | 10

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

2024-02-29 Thread Chao Yu
some redundant judgment code. 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

[f2fs-dev] [PATCH] f2fs: support .shutdown in f2fs_sops

2024-02-29 Thread Chao Yu
Support .shutdown callback in f2fs_sops, then, it can be called to shut down the file system when underlying block device is marked dead. Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/file.c | 70 ++--- fs/f2fs/super.c | 6 + 3

Re: [f2fs-dev] [PATCH 1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()

2024-02-29 Thread Chao Yu
Jaegeuk, Daeho, Any comments on this serials? Thanks, On 2024/2/26 9:32, Chao Yu wrote: In f2fs_migrate_blocks(), when traversing blocks in last section, blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 5 +++-- 1 file

Re: [f2fs-dev] [PATCH] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup

2024-02-29 Thread Chao Yu
On 2024/2/28 1:47, Jaegeuk Kim wrote: On 02/21, Chao Yu wrote: Just cleanup, no functional change. Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 7 +++ fs/f2fs/f2fs.h| 14 -- fs/f2fs/gc.c | 10 +- fs/f2fs/gc.h | 4 ++-- fs/f2fs/segment.c | 12

Re: [f2fs-dev] [PATCH 2/4] f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage

2024-02-27 Thread Chao Yu
On 2024/2/28 1:50, Jaegeuk Kim wrote: On 02/22, Chao Yu wrote: f2fs_stop_checkpoint(, false) is complex and it may sleep, so we should move it outside segmap_lock spinlock coverage in get_new_segment(). Chao, I merged this patch into https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk

Re: [f2fs-dev] [PATCH] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup

2024-02-27 Thread Chao Yu
On 2024/2/28 1:47, Jaegeuk Kim wrote: On 02/21, Chao Yu wrote: Just cleanup, no functional change. Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 7 +++ fs/f2fs/f2fs.h| 14 -- fs/f2fs/gc.c | 10 +- fs/f2fs/gc.h | 4 ++-- fs/f2fs/segment.c | 12

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

2024-02-27 Thread Chao Yu
On 2024/2/28 1:18, 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, 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

Re: [f2fs-dev] [PATCH 3/5 v2] f2fs: print zone status in string and some log

2024-02-26 Thread Chao Yu
On 2024/2/27 6:52, Jaegeuk Kim wrote: No functional change, but add some more logs. Reviewed-by: Chao Yu v2 looks fine to me. Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists

Re: [f2fs-dev] [PATCH 2/5 v2] f2fs: fix write pointers all the time

2024-02-26 Thread Chao Yu
On 2024/2/27 8:59, Jaegeuk Kim wrote: Even if the roll forward recovery stopped due to any error, we have to fix the write pointers in order to mount the disk from the previous checkpoint. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks

Re: [f2fs-dev] [PATCH 1/5 v2] f2fs: check number of blocks in a current section

2024-02-26 Thread Chao Yu
On 2024/2/27 7:14, Jaegeuk Kim wrote: In cfd66bb715fd ("f2fs: fix deadloop in foreground GC"), we needed to check the number of blocks in a section instead of the segment. Fixes: cfd66bb715fd ("f2fs: fix deadloop in foreground GC") Signed-off-by: Jaegeuk Kim Reviewed-

Re: [f2fs-dev] [PATCH] f2fs: fix to return EIO when reading after device removal

2024-02-26 Thread Chao Yu
Any comments? Thanks, On 2024/2/19 11:13, Chao Yu wrote: On 2024/2/8 8:18, Jaegeuk Kim wrote: On 02/06, Chao Yu wrote: generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad) --- tests/generic/730.out    2023-08-07 01:39:51.055568499 + +++ /media

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

2024-02-25 Thread Chao Yu
Loop to Zhiguo, On 2024/2/22 20:18, Chao Yu wrote: If CONFIG_F2FS_CHECK_FS is off, and for very rare corner case that we run out of free segment, we should not panic kernel, instead, let's handle such error correctly in its caller. Signed-off-by: Chao Yu --- fs/f2fs/data.c| 7

[f2fs-dev] [PATCH 1/2] f2fs: ro: compress: fix to avoid caching unaligned extent

2024-02-25 Thread Chao Yu
: f2fs_update_read_extent_tree_range: dev = (253,48), ino = 5, pgofs = 36, len = 4, blkaddr = 66600, c_len = 3 Fixes: 94afd6d6e525 ("f2fs: extent cache: support unaligned extent") Signed-off-by: Chao Yu --- fs/f2fs/compress.c | 10 ++ fs/f2fs/f2fs.h | 6 -- fs/f2fs/node.

[f2fs-dev] [PATCH 2/2] f2fs: ro: don't start discard thread for readonly image

2024-02-25 Thread Chao Yu
:00 [f2fs_discard-253:48] There will be no deletion in readonly image, let's skip starting discard thread to save system resources. Signed-off-by: Chao Yu --- fs/f2fs/segment.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index b486fe4485f9

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

2024-02-25 Thread Chao Yu
On 2024/2/26 11:25, 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: 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: > A panic issue

[f2fs-dev] [PATCH] f2fs: fix to check return value in f2fs_insert_range()

2024-02-25 Thread Chao Yu
In f2fs_insert_range(), it missed to check return value of filemap_write_and_wait_range(), fix it. Meanwhile, just return error number once __exchange_data_block() fails. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs

Re: [f2fs-dev] [PATCH 5/5] f2fs: allow to mount if cap is 100

2024-02-25 Thread Chao Yu
On 2024/2/24 4:55, Jaegeuk Kim wrote: Don't block mounting the partition, if cap is 100%. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https

Re: [f2fs-dev] [PATCH 4/5] f2fs: prevent an f2fs_gc loop during disable_checkpoint

2024-02-25 Thread Chao Yu
On 2024/2/24 4:55, Jaegeuk Kim wrote: Don't get stuck in the f2fs_gc loop while disabling checkpoint. Instead, we have a time-based management. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs

Re: [f2fs-dev] [PATCH 3/5] f2fs: print zone status in string and some log

2024-02-25 Thread Chao Yu
On 2024/2/24 4:55, Jaegeuk Kim wrote: No functional change, but add some more logs. 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

Re: [f2fs-dev] [PATCH 2/5] f2fs: fix write pointers all the time

2024-02-25 Thread Chao Yu
On 2024/2/24 4:55, Jaegeuk Kim wrote: Even if the roll forward recovery stopped due to any error, we have to fix the write pointers in order to mount the disk from the previous checkpoint. Jaegeuk, IIUC, we may lost warm node chain once we allocate new section for all logs, should we give

Re: [f2fs-dev] [PATCH 1/5] f2fs: check number of blocks in a current section

2024-02-25 Thread Chao Yu
On 2024/2/24 4:55, Jaegeuk Kim wrote: In cfd66bb715fd ("f2fs: fix deadloop in foreground GC"), we needed to check the number of blocks in a section instead of the segment. In addtion, let's check the entire node sections when checking the avaiable node block space. It does not match one to one

Re: [f2fs-dev] [PATCH] f2fs: compress: reserve blocks on released compress inode while writing

2024-02-25 Thread Chao Yu
On 2024/1/10 17:10, Yangtao Li wrote: Reserve blocks on released compress inode while writing, so compressed files with released space are allowed to be rewritten. Signed-off-by: Yangtao Li --- fs/f2fs/file.c | 86 ++ 1 file changed, 51

[f2fs-dev] [PATCH 1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()

2024-02-25 Thread Chao Yu
In f2fs_migrate_blocks(), when traversing blocks in last section, blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index

[f2fs-dev] [PATCH 3/4] f2fs: clean up new_curseg()

2024-02-25 Thread Chao Yu
Move f2fs_valid_pinned_area() check logic from new_curseg() to get_new_segment(), it can avoid calling __set_free() if it fails to find free segment in conventional zone for pinned file. Signed-off-by: Chao Yu --- fs/f2fs/segment.c | 23 ++- 1 file changed, 14 insertions

[f2fs-dev] [PATCH 2/4] f2fs: relocate f2fs_precache_extents() in f2fs_swap_activate()

2024-02-25 Thread Chao Yu
This patch exchangs position of f2fs_precache_extents() and filemap_fdatawrite(), so that f2fs_precache_extents() can load extent info after physical addresses of all data are fixed. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[f2fs-dev] [PATCH 4/4] f2fs: fix to reset fields for unloaded curseg

2024-02-25 Thread Chao Yu
In f2fs_allocate_data_block(), before skip allocating new segment for DATA_PINNED log header, it needs to tag log header as unloaded one to avoid skipping logic in locate_dirty_segment() and __f2fs_save_inmem_curseg(). Signed-off-by: Chao Yu --- fs/f2fs/segment.c | 19 +++ 1

[f2fs-dev] [PATCH v2] f2fs: fix to use correct segment type in f2fs_allocate_data_block()

2024-02-24 Thread Chao Yu
ction") Signed-off-by: Chao Yu --- v2: - use curseg->seg_type instead of se->type due to se is valid only in atgc allocation context. fs/f2fs/segment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d4f228e6f771..847

Re: [f2fs-dev] [PATCH v3 2/2] f2fs: support file pinning for zoned devices

2024-02-24 Thread Chao Yu
On 2024/2/24 1:31, Jaegeuk Kim wrote: Hi Chao, I've tested the patch and queued in -dev, so can you take a look at it and propose any change on top of it? Then, we can discuss further on it. Okay, let me send patches for comments. Thanks, On 02/23, Chao Yu wrote: On 2024/2/14 1:38, Daeho

Re: [f2fs-dev] [PATCH] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup

2024-02-24 Thread Chao Yu
(SEGS_PER_SEC(sbi) -\ + BLKS_TO_SEGS(sbi, (sbi)->unusable_blocks_per_sec) #define GET_SEC_FROM_SEG(sbi, segno) \ (((segno) == -1) ? -1 : (segno) / SEGS_PER_SEC(sbi)) #define GET_SEG_FROM_SEC(sbi, secno) \ On 02/21, Chao Yu wrote: Just cleanup,

Re: [f2fs-dev] [PATCH] f2fs: fix to use correct segment type in f2fs_allocate_data_block()

2024-02-23 Thread Chao Yu
On 2024/2/24 4:52, Jaegeuk Kim wrote: On 02/23, Chao Yu wrote: @type in f2fs_allocate_data_block() indicates log header's type, it can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later one, fix it. Fixes

Re: [f2fs-dev] [PATCH v3 2/2] f2fs: support file pinning for zoned devices

2024-02-22 Thread Chao Yu
On 2024/2/14 1:38, Daeho Jeong wrote: From: Daeho Jeong Support file pinning with conventional storage area for zoned devices Signed-off-by: Daeho Jeong Signed-off-by: Jaegeuk Kim --- v3: check the hole when migrating blocks for swap. do not use the remainder of cold pin section. v2:

Re: [f2fs-dev] [PATCH v3 2/2] f2fs: support file pinning for zoned devices

2024-02-22 Thread Chao Yu
On 2024/2/14 1:38, Daeho Jeong wrote: From: Daeho Jeong Support file pinning with conventional storage area for zoned devices Signed-off-by: Daeho Jeong Signed-off-by: Jaegeuk Kim --- v3: check the hole when migrating blocks for swap. do not use the remainder of cold pin section. v2:

Re: [f2fs-dev] [PATCH v3 2/2] f2fs: support file pinning for zoned devices

2024-02-22 Thread Chao Yu
Hi Daeho, On 2024/2/14 1:38, Daeho Jeong wrote: From: Daeho Jeong Support file pinning with conventional storage area for zoned devices Signed-off-by: Daeho Jeong Signed-off-by: Jaegeuk Kim --- v3: check the hole when migrating blocks for swap. do not use the remainder of cold pin

[f2fs-dev] [PATCH] f2fs: fix to use correct segment type in f2fs_allocate_data_block()

2024-02-22 Thread Chao Yu
ction") Signed-off-by: Chao Yu --- fs/f2fs/segment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d0209ea77dd2..76422f50e6cc 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3505,12 +3505,12 @@ void f2fs_allocate_

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

2024-02-22 Thread Chao Yu
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: > A panic issue happened in a reboot test in small capacity device > as following: > 1.The device size is 64MB

  1   2   3   4   5   6   7   8   9   10   >