Re: [f2fs-dev] [PATCH] f2fs-tools: allocate logs after conventional area for HM zoned devices

2024-01-29 Thread Yongpeng Yang via Linux-f2fs-devel
cur_seg[CURSEG_COLD_DATA] will exceed end boundary of main area when: device[1]: zone device size = [2 MB ~ 10MB] So, if there are not enough seq zones for six cursegs, we should still assign 0 to c.cur_seg[CURSEG_HOT_NODE] or reserve several conv zones for cursegs. On 1/29/2024 11:47 PM, Dae

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 of f2fs_is_valid_blkaddr not handled as > > > ERROR_INV

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 handling about all of > > f2fs_is_va

Re: [f2fs-dev] [PATCH v3 5/5] block: remove gfp_flags from blkdev_zone_mgmt

2024-01-29 Thread Damien Le Moal
On 1/29/24 16:52, Johannes Thumshirn wrote: > Now that all callers pass in GFP_KERNEL to blkdev_zone_mgmt() and use > memalloc_no{io,fs}_{save,restore}() to define the allocation scope, we can > drop the gfp_mask parameter from blkdev_zone_mgmt() as well as > blkdev_zone_reset_all() and blkdev_zone

Re: [f2fs-dev] [PATCH v3 4/5] f2fs: guard blkdev_zone_mgmt with nofs scope

2024-01-29 Thread Damien Le Moal
On 1/29/24 16:52, Johannes Thumshirn wrote: > Guard the calls to blkdev_zone_mgmt() with a memalloc_nofs scope. > This helps us getting rid of the GFP_NOFS argument to blkdev_zone_mgmt(); > > Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Resea

Re: [f2fs-dev] [PATCH v3 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope

2024-01-29 Thread Damien Le Moal
On 1/29/24 16:52, Johannes Thumshirn wrote: > Add a memalloc_nofs scope around all calls to blkdev_zone_mgmt(). This > allows us to further get rid of the GFP_NOFS argument for > blkdev_zone_mgmt(). > > Signed-off-by: Johannes Thumshirn Looks OK to me. Reviewed-by: Damien Le Moal -- Damien

Re: [f2fs-dev] [PATCH v3 2/5] dm: dm-zoned: guard blkdev_zone_mgmt with noio scope

2024-01-29 Thread Damien Le Moal
On 1/29/24 16:52, Johannes Thumshirn wrote: > Guard the calls to blkdev_zone_mgmt() with a memalloc_noio scope. > This helps us getting rid of the GFP_NOIO argument to blkdev_zone_mgmt(); > > Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal > --- > drivers/md/dm-zoned-metadata.c

Re: [f2fs-dev] [PATCH v3 1/5] zonefs: pass GFP_KERNEL to blkdev_zone_mgmt() call

2024-01-29 Thread Damien Le Moal
On 1/29/24 16:52, Johannes Thumshirn wrote: > Pass GFP_KERNEL instead of GFP_NOFS to the blkdev_zone_mgmt() call in > zonefs_zone_mgmt(). > > As as zonefs_zone_mgmt() and zonefs_inode_zone_mgmt() are never called > from a place that can recurse back into the filesystem on memory reclaim, > it is s

[f2fs-dev] [PATCH v5 11/12] ubifs: Configure dentry operations at dentry-creation time

2024-01-29 Thread Gabriel Krisman Bertazi
fscrypt now supports configuring dentry operations at dentry-creation time through the preset sb->s_d_op, instead of at lookup time. Enable this in ubifs, since the lookup-time mechanism is going away. Signed-off-by: Gabriel Krisman Bertazi --- fs/ubifs/dir.c | 1 - fs/ubifs/super.c | 1 + 2 f

[f2fs-dev] [PATCH v5 12/12] libfs: Drop generic_set_encrypted_ci_d_ops

2024-01-29 Thread Gabriel Krisman Bertazi
No filesystems depend on it anymore, and it is generally a bad idea. Since all dentries should have the same set of dentry operations in case-insensitive filesystems, it should be propagated through ->s_d_op. Signed-off-by: Gabriel Krisman Bertazi --- fs/libfs.c | 34

[f2fs-dev] [PATCH v5 10/12] f2fs: Configure dentry operations at dentry-creation time

2024-01-29 Thread Gabriel Krisman Bertazi
This was already the case for case-insensitive before commit bb9cd9106b22 ("fscrypt: Have filesystems handle their d_ops"), but it was changed to set at lookup-time to facilitate the integration with fscrypt. But it's a problem because dentries that don't get created through ->lookup() won't have

[f2fs-dev] [PATCH v5 08/12] libfs: Add helper to choose dentry operations at mount-time

2024-01-29 Thread Gabriel Krisman Bertazi
In preparation to drop the similar helper that sets d_op at lookup time, add a version to set the right d_op filesystem-wide, through sb->s_d_op. The operations structures are shared across filesystems supporting fscrypt and/or casefolding, therefore we can keep it in common libfs code. Signed-off

[f2fs-dev] [PATCH v5 09/12] ext4: Configure dentry operations at dentry-creation time

2024-01-29 Thread Gabriel Krisman Bertazi
This was already the case for case-insensitive before commit bb9cd9106b22 ("fscrypt: Have filesystems handle their d_ops"), but it was changed to set at lookup-time to facilitate the integration with fscrypt. But it's a problem because dentries that don't get created through ->lookup() won't have

[f2fs-dev] [PATCH v5 07/12] libfs: Merge encrypted_ci_dentry_ops and ci_dentry_ops

2024-01-29 Thread Gabriel Krisman Bertazi
In preparation to get case-insensitive dentry operations from sb->s_d_op again, use the same structure for case-insensitive filesystems with and without fscrypt. This means that on a casefolded filesystem without fscrypt, we end up having to call fscrypt_d_revalidate once per dentry, which does th

[f2fs-dev] [PATCH v5 05/12] fscrypt: Drop d_revalidate once the key is added

2024-01-29 Thread Gabriel Krisman Bertazi
>From fscrypt perspective, once the key is available, the dentry will remain valid until evicted for other reasons, since keyed dentries don't require revalidation and, if the key is removed, the dentry is forcefully evicted. Therefore, we don't need to keep revalidating them repeatedly. Obviousl

[f2fs-dev] [PATCH v5 06/12] fscrypt: Ignore plaintext dentries during d_move

2024-01-29 Thread Gabriel Krisman Bertazi
Now that we do more than just clear the DCACHE_NOKEY_NAME in fscrypt_handle_d_move, skip it entirely for plaintext dentries, to avoid extra costs. Note that VFS will call this function for any dentry, whether the volume has fscrypt on not. But, since we only care about DCACHE_NOKEY_NAME, we can c

[f2fs-dev] [PATCH v5 03/12] fscrypt: Call fscrypt_prepare_lookup_dentry on unencrypted dentries

2024-01-29 Thread Gabriel Krisman Bertazi
In preparation to dropping DCACHE_OP_REVALIDATE for dentries that don't need it at lookup time, refactor the code to make unencrypted denties also call fscrypt_prepare_dentry. This makes the non-inline __fscrypt_prepare_lookup superfulous, so drop it. Signed-off-by: Gabriel Krisman Bertazi ---

[f2fs-dev] [PATCH v5 02/12] fscrypt: Factor out a helper to configure the lookup dentry

2024-01-29 Thread Gabriel Krisman Bertazi
Both fscrypt_prepare_lookup_dentry_partial and fscrypt_prepare_lookup_dentry will set DCACHE_NOKEY_NAME for dentries when the key is not available. Extract out a helper to set this flag in a single place, in preparation to also add the optimization that will disable ->d_revalidate if possible. Sig

[f2fs-dev] [PATCH v5 00/12] Set casefold/fscrypt dentry operations through sb->s_d_op

2024-01-29 Thread Gabriel Krisman Bertazi
Hi, Sorry for the quick respin. The only difference from v4 is that we change the way we check for relevant dentries during a d_move, as suggested by Eric. The v5 of this patchset addresses the issues Eric pointed out in the previous version. The patch merging the fscrypt lookup helpers was comp

[f2fs-dev] [PATCH v5 01/12] ovl: Reject mounting over case-insensitive directories

2024-01-29 Thread Gabriel Krisman Bertazi
overlayfs relies on the filesystem setting DCACHE_OP_HASH or DCACHE_OP_COMPARE to reject mounting over case-insensitive directories. Since commit bb9cd9106b22 ("fscrypt: Have filesystems handle their d_ops"), we set ->d_op through a hook in ->d_lookup, which means the root dentry won't have them,

[f2fs-dev] [PATCH v5 04/12] fscrypt: Drop d_revalidate for valid dentries during lookup

2024-01-29 Thread Gabriel Krisman Bertazi
Unencrypted and encrypted-dentries where the key is available don't need to be revalidated with regards to fscrypt, since they don't go stale from under VFS and the key cannot be removed for the encrypted case without evicting the dentry. Mark them with d_set_always_valid, to avoid unnecessary rev

Re: [f2fs-dev] [PATCH 1/2] f2fs: support printk_ratelimited() in f2fs_printk()

2024-01-29 Thread patchwork-bot+f2fs
Hello: This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim : On Fri, 26 Jan 2024 23:19:16 +0800 you wrote: > This patch supports using printk_ratelimited() in f2fs_printk(), and > wrap ratelimited f2fs_printk() into f2fs_{err,warn,info}_ratelimited(), > then, use these new helps to c

[f2fs-dev] Patchwork summary for: f2fs

2024-01-29 Thread patchwork-bot+f2fs
Hello: The following patches were marked "accepted", because they were applied to jaegeuk/f2fs.git (dev): Patch: [f2fs-dev] f2fs: remove unnecessary f2fs_put_page in f2fs_rename Submitter: Jaegeuk Kim Committer: Jaegeuk Kim Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series

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

2024-01-29 Thread patchwork-bot+f2fs
Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim : On Fri, 12 Jan 2024 09:16:45 -0800 you wrote: > [1] changed the below condition, which made f2fs_put_page() voided. > This patch reapplies the AL's resolution in -next from [2]. > > - if (S_ISDIR(old_inode->i_mode)) {

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

2024-01-29 Thread patchwork-bot+f2fs
Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim : On Thu, 28 Dec 2023 20:25:07 -0700 you wrote: > 'f2fs_is_checkpoint_ready()' checks free sections. If there is not > enough free sections, most f2fs operations will return -ENOSPC when > checkpoint is disabled. > > It would

Re: [f2fs-dev] [PATCH] f2fs: zone: fix to wait completion of last bio in zone correctly

2024-01-29 Thread patchwork-bot+f2fs
Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim : On Mon, 29 Jan 2024 19:27:40 +0800 you wrote: > It needs to check last zone_pending_bio and wait IO completion before > traverse next fio in io->io_list, otherwise, bio in next zone may be > submitted before all IO completio

Re: [f2fs-dev] [PATCH v1] f2fs: fix NULL pointer dereference in f2fs_submit_page_write()

2024-01-29 Thread patchwork-bot+f2fs
Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim : On Tue, 16 Jan 2024 22:11:38 +0800 you wrote: > BUG: kernel NULL pointer dereference, address: 0014 > RIP: 0010:f2fs_submit_page_write+0x6cf/0x780 [f2fs] > Call Trace: > > ? show_regs+0x6e/0x80 > ? __die+0x29/0x

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

2024-01-29 Thread patchwork-bot+f2fs
Hello: This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim : On Sat, 13 Jan 2024 03:41:27 +0800 you 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 ch

Re: [f2fs-dev] [PATCH 1/2] libf2fs: Accept Sparse files with non 4K Blocksize

2024-01-29 Thread Jaegeuk Kim
On 01/26, Daniel Rosenberg wrote: > Since we may not know the block size when initializing sparse files, we > should assume that the sparse file's blocksize is correct. > > Signed-off-by: Daniel Rosenberg > --- > fsck/mount.c | 20 +--- > lib/libf2fs_io.c | 11 +++ >

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

2024-01-29 Thread Jaegeuk Kim
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 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: >

Re: [f2fs-dev] [PATCH v3 04/10] fscrypt: Drop d_revalidate once the key is added

2024-01-29 Thread Gabriel Krisman Bertazi
Eric Biggers writes: > On Thu, Jan 25, 2024 at 05:20:56PM -0300, Gabriel Krisman Bertazi wrote: >> Eric Biggers writes: >> >> > On Fri, Jan 19, 2024 at 03:47:36PM -0300, Gabriel Krisman Bertazi wrote: >> >> /* >> >> * When d_splice_alias() moves a directory's no-key alias to its >> >> plainte

Re: [f2fs-dev] [PATCH] f2fs: zone: fix to wait completion of last bio in zone correctly

2024-01-29 Thread Daeho Jeong
Reviewed-by: Daeho Jeong Thanks, On Mon, Jan 29, 2024 at 3:29 AM Chao Yu wrote: > > It needs to check last zone_pending_bio and wait IO completion before > traverse next fio in io->io_list, otherwise, bio in next zone may be > submitted before all IO completion in current zone. > > Fixes: e067d

Re: [f2fs-dev] [PATCH] f2fs-tools: allocate logs after conventional area for HM zoned devices

2024-01-29 Thread Daeho Jeong
On Sun, Jan 28, 2024 at 5:27 PM Chao Yu wrote: > > On 2024/1/27 2:17, Daeho Jeong wrote: > > On Thu, Jan 25, 2024 at 5:27 PM Chao Yu wrote: > >> > >> On 2024/1/26 0:25, Daeho Jeong wrote: > >>> On Wed, Jan 24, 2024 at 7:34 PM Chao Yu wrote: > > +Cc Yongpeng Yang > > Daeho, >

[f2fs-dev] [PATCH] f2fs: zone: fix to wait completion of last bio in zone correctly

2024-01-29 Thread Chao Yu
It needs to check last zone_pending_bio and wait IO completion before traverse next fio in io->io_list, otherwise, bio in next zone may be submitted before all IO completion in current zone. Fixes: e067dc3c6b9c ("f2fs: maintain six open zones for zoned devices") Cc: Daeho Jeong Signed-off-by: Cha

Re: [f2fs-dev] [PATCH v1] f2fs: fix NULL pointer dereference in f2fs_submit_page_write()

2024-01-29 Thread Chao Yu
On 2024/1/29 18:27, Chao Yu wrote: On 2024/1/16 22:11, Wenjie Qi wrote: BUG: kernel NULL pointer dereference, address: 0014 RIP: 0010:f2fs_submit_page_write+0x6cf/0x780 [f2fs] Call Trace: ? show_regs+0x6e/0x80 ? __die+0x29/0x70 ? page_fault_oops+0x154/0x4a0 ? prb_read_valid+0x20/0x3

Re: [f2fs-dev] [PATCH v1] f2fs: fix NULL pointer dereference in f2fs_submit_page_write()

2024-01-29 Thread Chao Yu
On 2024/1/16 22:11, Wenjie Qi wrote: BUG: kernel NULL pointer dereference, address: 0014 RIP: 0010:f2fs_submit_page_write+0x6cf/0x780 [f2fs] Call Trace: ? show_regs+0x6e/0x80 ? __die+0x29/0x70 ? page_fault_oops+0x154/0x4a0 ? prb_read_valid+0x20/0x30 ? __irq_work_queue_local+0x39/0xd0

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

2024-01-29 Thread Zhiguo Niu
There is a corner scenario on a small-capacity partition with 64MB size: 1. The main area has a total of 24 segments, and there are no free segments left shown from the free_segmap bitmap and free_secmap in free_segmap_info. - bitm

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

2024-01-29 Thread Zhiguo Niu
NULL_SEGNO should also be returned when the blk_addr value is out-of-bound main area even __is_valid_data_blkaddr return true. For example, a 64MB partition with total 24 main segments has no any free segments left, then a new wrtie request use get_new_segment may get a out-of-bound segno 24 if CO

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

2024-01-29 Thread Zhiguo Niu
When CONFIG_F2FS_CHECK_FS is not enabled, f2fs_bug_on just printing warning, get_new_segment may get an out-of-bounds segment when there is no free segments. Then a block is allocated from this invalid segment, update_sit_entry will access the invalid bitmap address, cause system panic. Just as bel

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

2024-01-29 Thread Zhiguo Niu
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_CHECK_FS is not enabled. 2.There is no any free segments left shown in free_segmap_info, then another write request cause get_new_segment get a ou

[f2fs-dev] [PATCH v3 5/5] block: remove gfp_flags from blkdev_zone_mgmt

2024-01-29 Thread Johannes Thumshirn via Linux-f2fs-devel
Now that all callers pass in GFP_KERNEL to blkdev_zone_mgmt() and use memalloc_no{io,fs}_{save,restore}() to define the allocation scope, we can drop the gfp_mask parameter from blkdev_zone_mgmt() as well as blkdev_zone_reset_all() and blkdev_zone_reset_all_emulated(). Signed-off-by: Johannes Thum

[f2fs-dev] [PATCH v3 2/5] dm: dm-zoned: guard blkdev_zone_mgmt with noio scope

2024-01-29 Thread Johannes Thumshirn via Linux-f2fs-devel
Guard the calls to blkdev_zone_mgmt() with a memalloc_noio scope. This helps us getting rid of the GFP_NOIO argument to blkdev_zone_mgmt(); Signed-off-by: Johannes Thumshirn --- drivers/md/dm-zoned-metadata.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-z

[f2fs-dev] [PATCH v3 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope

2024-01-29 Thread Johannes Thumshirn via Linux-f2fs-devel
Add a memalloc_nofs scope around all calls to blkdev_zone_mgmt(). This allows us to further get rid of the GFP_NOFS argument for blkdev_zone_mgmt(). Signed-off-by: Johannes Thumshirn --- fs/btrfs/zoned.c | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions(-) di

[f2fs-dev] [PATCH v3 1/5] zonefs: pass GFP_KERNEL to blkdev_zone_mgmt() call

2024-01-29 Thread Johannes Thumshirn via Linux-f2fs-devel
Pass GFP_KERNEL instead of GFP_NOFS to the blkdev_zone_mgmt() call in zonefs_zone_mgmt(). As as zonefs_zone_mgmt() and zonefs_inode_zone_mgmt() are never called from a place that can recurse back into the filesystem on memory reclaim, it is save to call blkdev_zone_mgmt() with GFP_KERNEL. Link: h

[f2fs-dev] [PATCH v3 0/5] block: remove gfp_mask for blkdev_zone_mgmt()

2024-01-29 Thread Johannes Thumshirn via Linux-f2fs-devel
Fueled by the LSFMM discussion on removing GFP_NOFS initiated by Willy, I've looked into the sole GFP_NOFS allocation in zonefs. As it turned out, it is only done for zone management commands and can be removed. After digging into more callers of blkdev_zone_mgmt() I came to the conclusion that th

[f2fs-dev] [PATCH v3 4/5] f2fs: guard blkdev_zone_mgmt with nofs scope

2024-01-29 Thread Johannes Thumshirn via Linux-f2fs-devel
Guard the calls to blkdev_zone_mgmt() with a memalloc_nofs scope. This helps us getting rid of the GFP_NOFS argument to blkdev_zone_mgmt(); Signed-off-by: Johannes Thumshirn --- fs/f2fs/segment.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment