Re: [f2fs-dev] [PATCH V3 4/7] f2fs: Add f2fs_fs_context to record the mount options

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/24/25 01:08, Eric Sandeen wrote: > From: Hongbo Li > > At the parsing phase of mouont in the new mount api, options > value will be recorded with the context, and then it will be > used in fill_super and other helpers. > > Note that, this is a temporary status, we want remove the sb > and s

Re: [f2fs-dev] [PATCH V3 3/7] f2fs: Allow sbi to be NULL in f2fs_printk

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/24/25 01:08, Eric Sandeen wrote: > From: Hongbo Li > > At the parsing phase of the new mount api, sbi will not be > available. So here allows sbi to be NULL in f2fs log helpers > and use that in handle_mount_opt(). > > Signed-off-by: Hongbo Li > [sandeen: forward port] > Signed-off-by: Eri

Re: [f2fs-dev] [PATCH V3 2/7] f2fs: move the option parser into handle_mount_opt

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/24/25 01:08, Eric Sandeen wrote: > From: Hongbo Li > > In handle_mount_opt, we use fs_parameter to parse each option. > However we're still using the old API to get the options string. > Using fsparams parse_options allows us to remove many of the Opt_ > enums, so remove them. > > The check

Re: [f2fs-dev] [PATCH V3 1/7] f2fs: Add fs parameter specifications for mount options

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/24/25 01:08, Eric Sandeen wrote: > From: Hongbo Li > > Use an array of `fs_parameter_spec` called f2fs_param_specs to > hold the mount option specifications for the new mount api. > > Add constant_table structures for several options to facilitate > parsing. > > Signed-off-by: Hongbo Li >

[f2fs-dev] [PATCH 6/6] f2fs: return bool from __write_node_folio

2025-05-07 Thread Christoph Hellwig
__write_node_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE. As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return instead. Signed-off-by: Christoph Hellwig Reviewed-by: Chao Yu --- fs/f2fs/node.c | 29 + 1 file changed, 13 insertions(+), 16 delet

[f2fs-dev] [PATCH 5/6] f2fs: simplify return value handling in f2fs_fsync_node_pages

2025-05-07 Thread Christoph Hellwig
Always assign ret where the error happens, and jump to out instead of multiple loop exit conditions to prepare for changes in the __write_node_folio calling convention. Signed-off-by: Christoph Hellwig --- fs/f2fs/node.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletion

[f2fs-dev] [PATCH 4/6] f2fs: always unlock the page in f2fs_write_single_data_page

2025-05-07 Thread Christoph Hellwig
Consolidate the code to unlock the page in f2fs_write_single_data_page instead of leaving it to the callers for the AOP_WRITEPAGE_ACTIVATE case. Replace AOP_WRITEPAGE_ACTIVATE with a positive return of 1 as this case now doesn't match the historic ->writepage special return code that is on it's way

[f2fs-dev] [PATCH 2/6] f2fs: return bool from __f2fs_write_meta_folio

2025-05-07 Thread Christoph Hellwig
__f2fs_write_meta_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE. As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return instead. Signed-off-by: Christoph Hellwig Reviewed-by: Chao Yu --- fs/f2fs/checkpoint.c | 22 +++--- 1 file changed, 11 insertions(+), 11 d

[f2fs-dev] cleanup AOP_WRITEPAGE_ACTIVATE use in f2fs v2

2025-05-07 Thread Christoph Hellwig
Hi all, this almost entirely cleans up usage of AOP_WRITEPAGE_ACTIVATE in f2fs. Changes since v1: - pick up the bug fix from Chao as patch 1 - release the folio batch on early exit - remove the dead for_reclaim handling - keep the ability of the caller to exit early for the redity case Diffs

[f2fs-dev] [PATCH 1/6] f2fs: fix to return correct error number in f2fs_sync_node_pages()

2025-05-07 Thread Christoph Hellwig
From: Chao Yu If __write_node_folio() failed, it will return AOP_WRITEPAGE_ACTIVATE, the incorrect return value may be passed to userspace in below path, fix it. - sync_filesystem - sync_fs - f2fs_issue_checkpoint - block_operations - f2fs_sync_node_pages - __write_node_folio

[f2fs-dev] [PATCH 3/6] f2fs: remove wbc->for_reclaim handling

2025-05-07 Thread Christoph Hellwig
Since commits 7ff0104a8052 ("f2fs: Remove f2fs_write_node_page()") and 3b47398d9861 ("f2fs: Remove f2fs_write_meta_page()'), f2fs can't be called from reclaim context any more. Remove all code keyed of the wbc->for_rename flag, which is now only set for writing out swap or shmem pages inside the s

Re: [f2fs-dev] [PATCH 2/7] f2fs: move the option parser into handle_mount_opt

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 23:02, Jaegeuk Kim wrote: > On 05/07, Eric Sandeen wrote: >> On 5/7/25 6:26 AM, Chao Yu wrote: >>> On 4/20/25 23:25, Eric Sandeen wrote: From: Hongbo Li In handle_mount_opt, we use fs_parameter to parse each option. However we're still using the old API to get the opt

Re: [f2fs-dev] [PATCH 2/7] f2fs: move the option parser into handle_mount_opt

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 20:31, Eric Sandeen wrote: > On 5/7/25 6:26 AM, Chao Yu wrote: >> On 4/20/25 23:25, Eric Sandeen wrote: >>> From: Hongbo Li >>> >>> In handle_mount_opt, we use fs_parameter to parse each option. >>> However we're still using the old API to get the options string. >>> Using fsparams parse

Re: [f2fs-dev] [PATCH V3 1/7] f2fs: Add fs parameter specifications for mount options

2025-05-07 Thread Hongbo Li via Linux-f2fs-devel
On 2025/4/24 1:08, Eric Sandeen wrote: From: Hongbo Li Use an array of `fs_parameter_spec` called f2fs_param_specs to hold the mount option specifications for the new mount api. Add constant_table structures for several options to facilitate parsing. Signed-off-by: Hongbo Li [sandeen: for

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Jaegeuk Kim via Linux-f2fs-devel
On 05/07, Eric Sandeen wrote: > On 5/7/25 2:48 PM, Jaegeuk Kim wrote: > > On 05/07, Eric Sandeen wrote: > >> On 5/7/25 9:46 AM, Jaegeuk Kim wrote: > >> > >>> I meant: > >>> > >>> # mkfs/mkfs.f2fs -c /dev/v...@vdc.file /dev/vdb > >>> # mount /dev/vdb mnt > >>> > >>> It's supposed to be successful, s

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Jaegeuk Kim via Linux-f2fs-devel
On 05/07, Eric Sandeen wrote: > On 5/7/25 3:28 PM, Jaegeuk Kim wrote: > >> But as far as I can tell, at least for the extent cache, remount is handled > >> properly already (with the hunk above): > >> > >> # mkfs/mkfs.f2fs -c /dev/v...@vdc.file /dev/vdb > >> # mount /dev/vdb mnt > >> # mount -o rem

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Eric Sandeen via Linux-f2fs-devel
On 5/7/25 3:28 PM, Jaegeuk Kim wrote: >> But as far as I can tell, at least for the extent cache, remount is handled >> properly already (with the hunk above): >> >> # mkfs/mkfs.f2fs -c /dev/v...@vdc.file /dev/vdb >> # mount /dev/vdb mnt >> # mount -o remount,noextent_cache mnt >> mount: /root/mnt:

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Eric Sandeen via Linux-f2fs-devel
On 5/7/25 2:48 PM, Jaegeuk Kim wrote: > On 05/07, Eric Sandeen wrote: >> On 5/7/25 9:46 AM, Jaegeuk Kim wrote: >> >>> I meant: >>> >>> # mkfs/mkfs.f2fs -c /dev/v...@vdc.file /dev/vdb >>> # mount /dev/vdb mnt >>> >>> It's supposed to be successful, since extent_cache is enabled by default. >> >> I'm

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Jaegeuk Kim via Linux-f2fs-devel
On 05/07, Eric Sandeen wrote: > On 5/7/25 9:46 AM, Jaegeuk Kim wrote: > > > I meant: > > > > # mkfs/mkfs.f2fs -c /dev/v...@vdc.file /dev/vdb > > # mount /dev/vdb mnt > > > > It's supposed to be successful, since extent_cache is enabled by default. > > I'm sorry, clearly I was too sleepy last ni

Re: [f2fs-dev] [PATCH v2] f2fs/013: test to check potential corruption on atomic_write file

2025-05-07 Thread Daeho Jeong
On Tue, May 6, 2025 at 8:17 PM Chao Yu wrote: > > On 5/7/25 04:25, Daeho Jeong wrote: > > On Tue, May 6, 2025 at 12:05 AM Chao Yu via Linux-f2fs-devel > > wrote: > >> > >> This is a regression testcase to check whether we will handle database > >> inode dirty status correctly: > >> 1. mount f2fs

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Eric Sandeen via Linux-f2fs-devel
On 5/7/25 9:46 AM, Jaegeuk Kim wrote: > I meant: > > # mkfs/mkfs.f2fs -c /dev/v...@vdc.file /dev/vdb > # mount /dev/vdb mnt > > It's supposed to be successful, since extent_cache is enabled by default. I'm sorry, clearly I was too sleepy last night. This fixes it for me. We have to test the ma

Re: [f2fs-dev] [PATCH 2/7] f2fs: move the option parser into handle_mount_opt

2025-05-07 Thread Jaegeuk Kim via Linux-f2fs-devel
On 05/07, Eric Sandeen wrote: > On 5/7/25 6:26 AM, Chao Yu wrote: > > On 4/20/25 23:25, Eric Sandeen wrote: > >> From: Hongbo Li > >> > >> In handle_mount_opt, we use fs_parameter to parse each option. > >> However we're still using the old API to get the options string. > >> Using fsparams parse_

Re: [f2fs-dev] [PATCH V3 0/7] f2fs: new mount API conversion

2025-05-07 Thread Jaegeuk Kim via Linux-f2fs-devel
On 05/06, Eric Sandeen wrote: > On 5/6/25 9:56 PM, Eric Sandeen wrote: > > On 5/6/25 8:23 PM, Jaegeuk Kim wrote: > > ... > > >> What about: > >> # mount -o loop,noextent_cache f2fsfile.img mnt > >> > >> In this case, 1) ctx_clear_opt(), 2) set_opt() in default_options, > >> 3) clear_opt since mas

Re: [f2fs-dev] [PATCH 2/7] f2fs: move the option parser into handle_mount_opt

2025-05-07 Thread Eric Sandeen via Linux-f2fs-devel
On 5/7/25 6:26 AM, Chao Yu wrote: > On 4/20/25 23:25, Eric Sandeen wrote: >> From: Hongbo Li >> >> In handle_mount_opt, we use fs_parameter to parse each option. >> However we're still using the old API to get the options string. >> Using fsparams parse_options allows us to remove many of the Opt_

Re: [f2fs-dev] [bug report] f2fs: Use folios in do_garbage_collect()

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 15:31, Dan Carpenter wrote: > On Wed, May 07, 2025 at 10:59:11AM +0800, Chao Yu wrote: >> On 5/2/25 16:15, Dan Carpenter wrote: >>> Hello Matthew Wilcox (Oracle), >>> >>> 1768 /* reference all summary page */ >>> 1769 while (segno < end_segno) { >>> 1770

Re: [f2fs-dev] [PATCH 3/7] f2fs: Allow sbi to be NULL in f2fs_printk

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/20/25 23:25, Eric Sandeen wrote: > From: Hongbo Li > > At the parsing phase of the new mount api, sbi will not be > available. So here allows sbi to be NULL in f2fs log helpers > and use that in handle_mount_opt(). > > Signed-off-by: Hongbo Li > [sandeen: forward port] > Signed-off-by: Eri

Re: [f2fs-dev] [PATCH v3 2/2] f2fs: add ckpt_valid_blocks to the section entry

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 12:30, yohan.joung wrote: > when performing buffered writes in a large section, > overhead is incurred due to the iteration through > ckpt_valid_blocks within the section. > when SEGS_PER_SEC is 128, this overhead accounts for 20% within > the f2fs_write_single_data_page routine. > as the

Re: [f2fs-dev] [PATCH 2/7] f2fs: move the option parser into handle_mount_opt

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/20/25 23:25, Eric Sandeen wrote: > From: Hongbo Li > > In handle_mount_opt, we use fs_parameter to parse each option. > However we're still using the old API to get the options string. > Using fsparams parse_options allows us to remove many of the Opt_ > enums, so remove them. > > The check

[f2fs-dev] [PATCH] f2fs: use unsigned int type for severial mount option variables

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
active_logs, inline_xattr_size, f2fs_fault_info.inject_rate in struct f2fs_mount_info should never be negative, change its type from int to unsigned int. Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 12 ++-- fs/f2fs/inode.c | 2 +- fs/f2fs/super.c | 8 3 files changed, 11 inse

Re: [f2fs-dev] [PATCH 1/7] f2fs: Add fs parameter specifications for mount options

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 4/20/25 23:25, Eric Sandeen wrote: > From: Hongbo Li > > Use an array of `fs_parameter_spec` called f2fs_param_specs to > hold the mount option specifications for the new mount api. > > Add constant_table structures for several options to facilitate > parsing. > > Signed-off-by: Hongbo Li >

Re: [f2fs-dev] [PATCH v3 2/2] f2fs: add ckpt_valid_blocks to the section entry

2025-05-07 Thread yohan.joung
>On 5/7/25 12:30, yohan.joung wrote: >> when performing buffered writes in a large section, >> overhead is incurred due to the iteration through >> ckpt_valid_blocks within the section. >> when SEGS_PER_SEC is 128, this overhead accounts for 20% within >> the f2fs_write_single_data_page routine. >>

Re: [f2fs-dev] [PATCH v3 1/2] f2fs: add a method for calculating the remaining blocks in the current segment in LFS mode.

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 12:30, yohan.joung wrote: > In LFS mode, the previous segment cannot use invalid blocks, > so the remaining blocks from the next_blkoff of the current segment > to the end of the section are calculated. > > Signed-off-by: yohan.joung > --- > fs/f2fs/segment.h | 23 +++--

Re: [f2fs-dev] cleanup AOP_WRITEPAGE_ACTIVATE use in f2fs

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 15:48, Christoph Hellwig wrote: > On Wed, May 07, 2025 at 03:38:20PM +0800, Chao Yu wrote: >> On 5/5/25 17:25, Christoph Hellwig wrote: >>> Hi all, >>> >>> this almost entirely cleans up usage of AOP_WRITEPAGE_ACTIVATE in f2fs. >>> >>> f2fs_sync_node_pages can still return it in a way tha

[f2fs-dev] [PATCH] f2fs: fix to return correct error number in f2fs_sync_node_pages()

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
If __write_node_folio() failed, it will return AOP_WRITEPAGE_ACTIVATE, the incorrect return value may be passed to userspace in below path, fix it. - sync_filesystem - sync_fs - f2fs_issue_checkpoint - block_operations - f2fs_sync_node_pages - __write_node_folio : return AOP_WR

Re: [f2fs-dev] cleanup AOP_WRITEPAGE_ACTIVATE use in f2fs

2025-05-07 Thread Christoph Hellwig
On Wed, May 07, 2025 at 03:38:20PM +0800, Chao Yu wrote: > On 5/5/25 17:25, Christoph Hellwig wrote: > > Hi all, > > > > this almost entirely cleans up usage of AOP_WRITEPAGE_ACTIVATE in f2fs. > > > > f2fs_sync_node_pages can still return it in a way that is not handled > > by any caller and even

Re: [f2fs-dev] cleanup AOP_WRITEPAGE_ACTIVATE use in f2fs

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/5/25 17:25, Christoph Hellwig wrote: > Hi all, > > this almost entirely cleans up usage of AOP_WRITEPAGE_ACTIVATE in f2fs. > > f2fs_sync_node_pages can still return it in a way that is not handled > by any caller and eventually is propagated to userspace. This does look > like a bug and nee

Re: [f2fs-dev] [bug report] f2fs: Use folios in do_garbage_collect()

2025-05-07 Thread Dan Carpenter
On Wed, May 07, 2025 at 10:59:11AM +0800, Chao Yu wrote: > On 5/2/25 16:15, Dan Carpenter wrote: > > Hello Matthew Wilcox (Oracle), > > > > 1768 /* reference all summary page */ > > 1769 while (segno < end_segno) { > > 1770 struct folio *sum_folio = f2fs

Re: [f2fs-dev] [PATCH 4/4] f2f2: return bool from __write_node_folio

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/5/25 17:26, Christoph Hellwig wrote: > __write_node_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE. > As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return > instead. > > Signed-off-by: Christoph Hellwig Reviewed-by: Chao Yu Thanks, __

Re: [f2fs-dev] [PATCH 3/4] f2fs: simplify return value handling in f2fs_fsync_node_pages

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/5/25 17:26, Christoph Hellwig wrote: > Always assign ret where the error happens, and jump to out instead > of multiple loop exit conditions to prepare for changes in the > __write_node_folio calling convention. > > Signed-off-by: Christoph Hellwig > --- > fs/f2fs/node.c | 18 +-

Re: [f2fs-dev] [PATCH 2/4] f2fs: don't return AOP_WRITEPAGE_ACTIVATE from f2fs_write_single_data_page

2025-05-07 Thread Christoph Hellwig
On Wed, May 07, 2025 at 02:28:55PM +0800, Chao Yu wrote: > > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c > > index e016b0f96313..ce63b3bfb28f 100644 > > --- a/fs/f2fs/compress.c > > +++ b/fs/f2fs/compress.c > > @@ -1565,10 +1565,7 @@ static int f2fs_write_raw_pages(struct compress_ctx > >

Re: [f2fs-dev] [PATCH 2/4] f2fs: don't return AOP_WRITEPAGE_ACTIVATE from f2fs_write_single_data_page

2025-05-07 Thread Chao Yu via Linux-f2fs-devel
On 5/7/25 14:44, Christoph Hellwig wrote: > On Wed, May 07, 2025 at 02:28:55PM +0800, Chao Yu wrote: >>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c >>> index e016b0f96313..ce63b3bfb28f 100644 >>> --- a/fs/f2fs/compress.c >>> +++ b/fs/f2fs/compress.c >>> @@ -1565,10 +1565,7 @@ static int f