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

2024-03-04 Thread Zhiguo Niu
Sorry, move jaegeuk to the "To"   list

Dear  Jaegeuk,

Let me describe the problem process, it is reproduced by monkey stability test:

 1.SBI_NEED_CP flag bit is set,
 set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP);

 2.Ckpt thread is blocked by IO busy when it is doing CP,  it can not
get request tag from block queue,
 PID: 505  TASK: ff80ed7f49c0  CPU: 4COMMAND: "f2fs_ckpt-254:4"
 #0 [ffc015fcb330] __switch_to at ffc010196350
 #1 [ffc015fcb390] __schedule at ffc01168e53c
 #2 [ffc015fcb3f0] schedule at ffc01168ed7c
 #3 [ffc015fcb450] io_schedule at ffc01168f7a0
 #4 [ffc015fcb4c0] blk_mq_get_tag at ffc0101008a4
 #5 [ffc015fcb530] blk_mq_get_request at ffc0109241b0
 #6 [ffc015fcb5f0] blk_mq_make_request at ffc0109233bc
 #7 [ffc015fcb680] generic_make_request at ffc0100fc6ec
 #8 [ffc015fcb700] submit_bio at ffc0100fc3b8
 #9 [ffc015fcb750] __submit_bio at ffc01081a2e0
 #10 [ffc015fcb7d0] __submit_merged_bio at ffc01081b07c
 #11 [ffc015fcb8a0] f2fs_submit_page_write at ffc0100ecd3c
 #12 [ffc015fcb990] f2fs_do_write_meta_page at ffc010845738
 #13 [ffc015fcb9d0] __f2fs_write_meta_page at ffc01080a8f4
 #14 [ffc015fcbb60] f2fs_sync_meta_pages at ffc01080a684
 #15 [ffc015fcbca0] do_checkpoint at ffc01080f0a8
 #16 [ffc015fcbd10] f2fs_write_checkpoint at ffc01080e50c
 #17 [ffc015fcbdb0] __checkpoint_and_complete_reqs at ffc010810f54
 #18 [ffc015fcbe40] issue_checkpoint_thread at ffc0108113ec
 #19 [ffc015fcbe80] kthread at ffc0102665b0

 3.Subsequent regular file fsync will trigger ckpt because SBI_NEED_CP
has not been cleared.
 In fact, these cases should not trigger ckpt.

 4.If some processes that perform f2fs_do_sync_file are important processes
 in the system(such as init) and are blocked for too long, it will
cause other problems in the system, ANR or android reboot
 PID: 287  TASK: ff80f9eb0ec0  CPU: 2COMMAND: "init"
 #0 [ffc01389bab0] __switch_to at ffc010196350
 #1 [ffc01389bb10] __schedule at ffc01168e53c
 #2 [ffc01389bb70] schedule at ffc01168ed7c
 #3 [ffc01389bbc0] wait_for_completion at ffc011692368
 #4 [ffc01389bca0] f2fs_issue_checkpoint at ffc010810cb0
 #5 [ffc01389bd00] f2fs_sync_fs at ffc0107f4e1c
 #6 [ffc01389bdc0] f2fs_do_sync_file at ffc0107d4d44
 #7 [ffc01389be20] f2fs_sync_file at ffc0107d492c
 #8 [ffc01389be30] __arm64_sys_fsync at ffc0105d31d8
 #9 [ffc01389be70] el0_svc_common at ffc0101aa550
 #10 [ffc01389beb0] el0_svc_handler at ffc0100886fc

and I tested Chao's patch can avoid the above case, please help
consider this patch or
any comment/suggestions about this?

thanks!

On Tue, Mar 5, 2024 at 9:56 AM Zhiguo Niu  wrote:
>
> Dear  Jaegeuk,
>
> Let me describe the problem process, it is reproduced by monkey stability 
> test:
>
>  1.SBI_NEED_CP flag bit is set,
>  set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP);
>
>  2.Ckpt thread is blocked by IO busy when it is doing CP,  it can not
> get request tag from block queue,
>  PID: 505  TASK: ff80ed7f49c0  CPU: 4COMMAND: "f2fs_ckpt-254:4"
>  #0 [ffc015fcb330] __switch_to at ffc010196350
>  #1 [ffc015fcb390] __schedule at ffc01168e53c
>  #2 [ffc015fcb3f0] schedule at ffc01168ed7c
>  #3 [ffc015fcb450] io_schedule at ffc01168f7a0
>  #4 [ffc015fcb4c0] blk_mq_get_tag at ffc0101008a4
>  #5 [ffc015fcb530] blk_mq_get_request at ffc0109241b0
>  #6 [ffc015fcb5f0] blk_mq_make_request at ffc0109233bc
>  #7 [ffc015fcb680] generic_make_request at ffc0100fc6ec
>  #8 [ffc015fcb700] submit_bio at ffc0100fc3b8
>  #9 [ffc015fcb750] __submit_bio at ffc01081a2e0
>  #10 [ffc015fcb7d0] __submit_merged_bio at ffc01081b07c
>  #11 [ffc015fcb8a0] f2fs_submit_page_write at ffc0100ecd3c
>  #12 [ffc015fcb990] f2fs_do_write_meta_page at ffc010845738
>  #13 [ffc015fcb9d0] __f2fs_write_meta_page at ffc01080a8f4
>  #14 [ffc015fcbb60] f2fs_sync_meta_pages at ffc01080a684
>  #15 [ffc015fcbca0] do_checkpoint at ffc01080f0a8
>  #16 [ffc015fcbd10] f2fs_write_checkpoint at ffc01080e50c
>  #17 [ffc015fcbdb0] __checkpoint_and_complete_reqs at ffc010810f54
>  #18 [ffc015fcbe40] issue_checkpoint_thread at ffc0108113ec
>  #19 [ffc015fcbe80] kthread at ffc0102665b0
>
>  3.Subsequent regular file fsync will trigger ckpt because SBI_NEED_CP
> has not been cleared.
>  In fact, these cases should not trigger ckpt.
>
>  4.If some processes that perform f2fs_do_sync_file are important processes
>  in the system(such as init) and are blocked for too long, it will
> cause other problems in the system, ANR or android reboot
>  PID: 287  TASK: ff80f9eb0ec0  CPU: 2COMMAND: "init"
>  #0 [ffc01389bab0] __switch_to at ffc010196350
>  #1 

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

2024-03-04 Thread Zhiguo Niu
Dear  Jaegeuk,

Let me describe the problem process, it is reproduced by monkey stability test:

 1.SBI_NEED_CP flag bit is set,
 set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP);

 2.Ckpt thread is blocked by IO busy when it is doing CP,  it can not
get request tag from block queue,
 PID: 505  TASK: ff80ed7f49c0  CPU: 4COMMAND: "f2fs_ckpt-254:4"
 #0 [ffc015fcb330] __switch_to at ffc010196350
 #1 [ffc015fcb390] __schedule at ffc01168e53c
 #2 [ffc015fcb3f0] schedule at ffc01168ed7c
 #3 [ffc015fcb450] io_schedule at ffc01168f7a0
 #4 [ffc015fcb4c0] blk_mq_get_tag at ffc0101008a4
 #5 [ffc015fcb530] blk_mq_get_request at ffc0109241b0
 #6 [ffc015fcb5f0] blk_mq_make_request at ffc0109233bc
 #7 [ffc015fcb680] generic_make_request at ffc0100fc6ec
 #8 [ffc015fcb700] submit_bio at ffc0100fc3b8
 #9 [ffc015fcb750] __submit_bio at ffc01081a2e0
 #10 [ffc015fcb7d0] __submit_merged_bio at ffc01081b07c
 #11 [ffc015fcb8a0] f2fs_submit_page_write at ffc0100ecd3c
 #12 [ffc015fcb990] f2fs_do_write_meta_page at ffc010845738
 #13 [ffc015fcb9d0] __f2fs_write_meta_page at ffc01080a8f4
 #14 [ffc015fcbb60] f2fs_sync_meta_pages at ffc01080a684
 #15 [ffc015fcbca0] do_checkpoint at ffc01080f0a8
 #16 [ffc015fcbd10] f2fs_write_checkpoint at ffc01080e50c
 #17 [ffc015fcbdb0] __checkpoint_and_complete_reqs at ffc010810f54
 #18 [ffc015fcbe40] issue_checkpoint_thread at ffc0108113ec
 #19 [ffc015fcbe80] kthread at ffc0102665b0

 3.Subsequent regular file fsync will trigger ckpt because SBI_NEED_CP
has not been cleared.
 In fact, these cases should not trigger ckpt.

 4.If some processes that perform f2fs_do_sync_file are important processes
 in the system(such as init) and are blocked for too long, it will
cause other problems in the system, ANR or android reboot
 PID: 287  TASK: ff80f9eb0ec0  CPU: 2COMMAND: "init"
 #0 [ffc01389bab0] __switch_to at ffc010196350
 #1 [ffc01389bb10] __schedule at ffc01168e53c
 #2 [ffc01389bb70] schedule at ffc01168ed7c
 #3 [ffc01389bbc0] wait_for_completion at ffc011692368
 #4 [ffc01389bca0] f2fs_issue_checkpoint at ffc010810cb0
 #5 [ffc01389bd00] f2fs_sync_fs at ffc0107f4e1c
 #6 [ffc01389bdc0] f2fs_do_sync_file at ffc0107d4d44
 #7 [ffc01389be20] f2fs_sync_file at ffc0107d492c
 #8 [ffc01389be30] __arm64_sys_fsync at ffc0105d31d8
 #9 [ffc01389be70] el0_svc_common at ffc0101aa550
 #10 [ffc01389beb0] el0_svc_handler at ffc0100886fc

and I tested Chao's patch can avoid the above case, please help
consider this patch or
any comment/suggestions about this?

thanks!

On Mon, Feb 26, 2024 at 9:22 AM 牛志国 (Zhiguo Niu)  wrote:
>
>
> Hi Jaegeuk
>
> Sorry for disturbing you, Do you have any comments about this patch from 
> Chao, I’ve met this issue several times on our platform when do monkey test.
> Thanks!
>
> -邮件原件-
> 发件人: Chao Yu 
> 发送时间: 2024年2月19日 15:19
> 收件人: jaeg...@kernel.org
> 抄送: linux-f2fs-devel@lists.sourceforge.net; linux-ker...@vger.kernel.org; 牛志国 
> (Zhiguo Niu) 
> 主题: Re: [PATCH v3] f2fs: reduce expensive checkpoint trigger frequency
>
>
> 注意: 这封邮件来自于外部。除非你确定邮件内容安全,否则不要点击任何链接和附件。
> CAUTION: This email originated from outside of the organization. Do not click 
> links or open attachments unless you recognize the sender and know the 
> content is safe.
>
>
>
> Jaegeuk,
>
> Any comments?
>
> On 2024/1/11 16:17, Chao Yu wrote:
> > We may trigger high frequent checkpoint for below case:
> > 1. mkdir /mnt/dir1; set dir1 encrypted 2. touch /mnt/file1; fsync
> > /mnt/file1 3. mkdir /mnt/dir2; set dir2 encrypted 4. touch /mnt/file2;
> > fsync /mnt/file2 ...
> >
> > Although, newly created dir and file are not related, due to commit
> > bbf156f7afa7 ("f2fs: fix lost xattrs of directories"), we will trigger
> > checkpoint whenever fsync() comes after a new encrypted dir created.
> >
> > In order to avoid such condition, let's record an entry including
> > directory's ino into global cache when we initialize encryption policy
> > in a checkpointed directory, and then only trigger checkpoint() when
> > target file's parent has non-persisted encryption policy, for the case
> > its parent is not checkpointed, need_do_checkpoint() has cover that by
> > verifying it with f2fs_is_checkpointed_node().
> >
> > Reported-by: Zhiguo Niu 
> > Tested-by: Zhiguo Niu 
> > Reported-by: Yunlei 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 changed, 21 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index
> > e2e0ca45f881..0094a8c85f4a 100644
> > 

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

2024-03-04 Thread Jaegeuk Kim
This patch adds the disk map of block address ranges configured by multiple
partitions.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/sysfs.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 10f308b3128f..e81af6adb85b 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -1492,6 +1492,27 @@ static int __maybe_unused discard_plist_seq_show(struct 
seq_file *seq,
return 0;
 }
 
+static int __maybe_unused disk_map_seq_show(struct seq_file *seq,
+   void *offset)
+{
+   struct super_block *sb = seq->private;
+   struct f2fs_sb_info *sbi = F2FS_SB(sb);
+   int i;
+
+   seq_puts(seq, "Disk Map for multi devices:\n");
+   if (!f2fs_is_multi_device(sbi))
+   return 0;
+
+   for (i = 0; i < sbi->s_ndevs; i++) {
+   seq_printf(seq, "%2d (zoned=%d): %20x - %20x",
+   i, bdev_is_zoned(FDEV(i).bdev),
+   FDEV(i).start_blk, FDEV(i).end_blk);
+   seq_putc(seq, '\n');
+   }
+   return 0;
+}
+
+
 int __init f2fs_init_sysfs(void)
 {
int ret;
@@ -1573,6 +1594,8 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
victim_bits_seq_show, sb);
proc_create_single_data("discard_plist_info", 0444, sbi->s_proc,
discard_plist_seq_show, sb);
+   proc_create_single_data("disk_map", 0444, sbi->s_proc,
+   disk_map_seq_show, sb);
return 0;
 put_feature_list_kobj:
kobject_put(>s_feature_list_kobj);
-- 
2.44.0.278.ge034bb2e1d-goog



___
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/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()

2024-03-04 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon, 26 Feb 2024 09:32:05 +0800 you 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 changed, 3 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [f2fs-dev,1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()
https://git.kernel.org/jaegeuk/f2fs/c/8249aac1b05c
  - [f2fs-dev,2/4] f2fs: relocate f2fs_precache_extents() in 
f2fs_swap_activate()
https://git.kernel.org/jaegeuk/f2fs/c/f1e7646a8cd4
  - [f2fs-dev,3/4] f2fs: clean up new_curseg()
https://git.kernel.org/jaegeuk/f2fs/c/1081b5121b27
  - [f2fs-dev,4/4] f2fs: fix to reset fields for unloaded curseg
https://git.kernel.org/jaegeuk/f2fs/c/42a80aacb76b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
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 in f2fs_insert_range()

2024-03-04 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon, 26 Feb 2024 11:19:16 +0800 you wrote:
> 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 
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: fix to check return value in f2fs_insert_range()
https://git.kernel.org/jaegeuk/f2fs/c/2fc2bcc8d399

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
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-04 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Fri, 1 Mar 2024 16:25:54 +0800 you 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 
> ---
>  fs/f2fs/f2fs.h | 2 +-
>  fs/f2fs/recovery.c | 2 +-
>  fs/f2fs/segment.c  | 7 +--
>  3 files changed, 7 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [f2fs-dev,1/2] f2fs: fix to check return value __allocate_new_segment
https://git.kernel.org/jaegeuk/f2fs/c/28f66cc65403
  - [f2fs-dev,2/2] f2fs: fix to check return value of f2fs_gc_range
https://git.kernel.org/jaegeuk/f2fs/c/22af1b8c31cb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] Patchwork summary for: f2fs

2024-03-04 Thread patchwork-bot+f2fs
Hello:

The following patches were marked "accepted", because they were applied to
jaegeuk/f2fs.git (dev):

Patch: [f2fs-dev,v2] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=831928
  Lore link: https://lore.kernel.org/r/20240304032855.1425579-1-c...@kernel.org

Series: [f2fs-dev,1/2] f2fs: fix to check return value __allocate_new_segment
  Submitter: Zhiguo Niu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=831423
  Lore link: 
https://lore.kernel.org/r/1709281555-11373-1-git-send-email-zhiguo@unisoc.com
Patches: [f2fs-dev,1/2] f2fs: fix to check return value 
__allocate_new_segment
 [f2fs-dev,2/2] f2fs: fix to check return value of f2fs_gc_range

Series: [f2fs-dev,1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=829643
  Lore link: https://lore.kernel.org/r/20240226013208.2389246-1-c...@kernel.org
Patches: [f2fs-dev,1/4] f2fs: fix blkofs_end correctly in 
f2fs_migrate_blocks()
 [f2fs-dev,2/4] f2fs: relocate f2fs_precache_extents() in 
f2fs_swap_activate()
 [f2fs-dev,3/4] f2fs: clean up new_curseg()
 [f2fs-dev,4/4] f2fs: fix to reset fields for unloaded curseg

Series: [f2fs-dev,1/2] f2fs: ro: compress: fix to avoid caching unaligned extent
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=829726
  Lore link: https://lore.kernel.org/r/20240226073539.2509926-1-c...@kernel.org
Patches: [f2fs-dev,1/2] f2fs: ro: compress: fix to avoid caching unaligned 
extent
 [f2fs-dev,2/2] f2fs: ro: don't start discard thread for readonly 
image

Patch: [f2fs-dev] f2fs: fix to check return value in f2fs_insert_range()
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=829662
  Lore link: https://lore.kernel.org/r/20240226031916.2420870-1-c...@kernel.org

Patch: [f2fs-dev] f2fs: fix to do sanity check in update_sit_entry
  Submitter: Zhiguo Niu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=830683
  Lore link: 
https://lore.kernel.org/r/1709121594-22314-1-git-send-email-zhiguo@unisoc.com

Patch: [f2fs-dev,v2] f2fs: fix to use correct segment type in 
f2fs_allocate_data_block()
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=829557
  Lore link: https://lore.kernel.org/r/20240225063628.2086320-1-c...@kernel.org


Total patches: 12

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
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 do sanity check in update_sit_entry

2024-03-04 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Wed, 28 Feb 2024 19:59:54 +0800 you wrote:
> If GET_SEGNO return NULL_SEGNO for some unecpected case,
> update_sit_entry will access invalid memory address,
> cause system crash. It is better to do sanity check about
> GET_SEGNO just like update_segment_mtime & locate_dirty_segment.
> 
> Also remove some redundant judgment code.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: fix to do sanity check in update_sit_entry
https://git.kernel.org/jaegeuk/f2fs/c/36959d18c3cf

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

2024-03-04 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Sun, 25 Feb 2024 14:36:28 +0800 you 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: 093749e296e2 ("f2fs: support age threshold based garbage collection")
> Signed-off-by: Chao Yu 
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: fix to use correct segment type in 
f2fs_allocate_data_block()
https://git.kernel.org/jaegeuk/f2fs/c/732485823782

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

2024-03-04 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon,  4 Mar 2024 11:28:55 +0800 you wrote:
> 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| 14 --
>  fs/f2fs/gc.c  | 10 +-
>  fs/f2fs/gc.h  |  4 ++--
>  fs/f2fs/segment.c | 12 ++--
>  fs/f2fs/segment.h | 15 +++
>  fs/f2fs/super.c   | 16 
>  fs/f2fs/sysfs.c   |  4 ++--
>  8 files changed, 41 insertions(+), 41 deletions(-)

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: introduce SEGS_TO_BLKS/BLKS_TO_SEGS for cleanup
https://git.kernel.org/jaegeuk/f2fs/c/45809cd3bdac

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
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: ro: compress: fix to avoid caching unaligned extent

2024-03-04 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon, 26 Feb 2024 15:35:38 +0800 you wrote:
> Mapping info from dump.f2fs:
> i_addr[0x2d] cluster flag [0xfffe : 4294967294]
> i_addr[0x2e]  [0x   10428 : 66600]
> i_addr[0x2f]  [0x   10429 : 66601]
> i_addr[0x30]  [0x   1042a : 66602]
> 
> f2fs_io fiemap 37 1 /mnt/f2fs/disk-58390c8c.raw
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,1/2] f2fs: ro: compress: fix to avoid caching unaligned extent
https://git.kernel.org/jaegeuk/f2fs/c/4b99ecd30429
  - [f2fs-dev,2/2] f2fs: ro: don't start discard thread for readonly image
https://git.kernel.org/jaegeuk/f2fs/c/a217f1873ab9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

2024-03-04 Thread Jaegeuk Kim
On 02/23, Jaegeuk Kim wrote:
> No functional change, but add some more logs.
> 
> Signed-off-by: Jaegeuk Kim 
> ---
>  fs/f2fs/segment.c | 34 --
>  fs/f2fs/super.c   |  1 +
>  2 files changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index d4f228e6f771..6d586ae8b55f 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info 
> *sbi)
>  }
>  
>  #ifdef CONFIG_BLK_DEV_ZONED
> +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = {

Added static.

> + [BLK_ZONE_COND_NOT_WP]  = "NOT_WP",
> + [BLK_ZONE_COND_EMPTY]   = "EMPTY",
> + [BLK_ZONE_COND_IMP_OPEN]= "IMPLICITE_OPEN",
> + [BLK_ZONE_COND_EXP_OPEN]= "EXPLICITE_OPEN",
> + [BLK_ZONE_COND_CLOSED]  = "CLOSED",
> + [BLK_ZONE_COND_READONLY]= "READONLY",
> + [BLK_ZONE_COND_FULL]= "FULL",
> + [BLK_ZONE_COND_OFFLINE] = "OFFLINE",
> +};
>  
>  static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
>   struct f2fs_dev_info *fdev,
> @@ -4928,18 +4938,22 @@ static int check_zone_write_pointer(struct 
> f2fs_sb_info *sbi,
>   zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block);
>   zone_segno = GET_SEGNO(sbi, zone_block);
>  
> + /*
> +  * Get # of valid block of the zone.
> +  */
> + valid_block_cnt = get_valid_blocks(sbi, zone_segno, true);
> +
>   /*
>* Skip check of zones cursegs point to, since
>* fix_curseg_write_pointer() checks them.
>*/
>   if (zone_segno >= MAIN_SEGS(sbi) ||
> - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno)))
> + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) {
> + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]",
> + zone_segno, valid_block_cnt,
> + f2fs_zone_status[zone->cond]);
>   return 0;
> -
> - /*
> -  * Get # of valid block of the zone.
> -  */
> - valid_block_cnt = get_valid_blocks(sbi, zone_segno, true);
> + }
>  
>   if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) ||
>   (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL))
> @@ -4947,8 +4961,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info 
> *sbi,
>  
>   if (!valid_block_cnt) {
>   f2fs_notice(sbi, "Zone without valid block has non-zero write "
> - "pointer. Reset the write pointer: cond[0x%x]",
> - zone->cond);
> + "pointer. Reset the write pointer: cond[%s]",
> + f2fs_zone_status[zone->cond]);
>   ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block,
>   zone->len >> log_sectors_per_block);
>   if (ret)
> @@ -4965,8 +4979,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info 
> *sbi,
>* selected for write operation until it get discarded.
>*/
>   f2fs_notice(sbi, "Valid blocks are not aligned with write "
> - "pointer: valid block[0x%x,0x%x] cond[0x%x]",
> - zone_segno, valid_block_cnt, zone->cond);
> + "pointer: valid block[0x%x,0x%x] cond[%s]",
> + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]);
>  
>   ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH,
>   zone->start, zone->len, GFP_NOFS);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 4d03ce1109ad..fc7f1a9fbbda 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void 
> *data, int silent)
>* check zoned block devices' write pointer consistency.
>*/
>   if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) {
> + f2fs_notice(sbi, "Checking entire write pointers");
>   err = f2fs_check_write_pointer(sbi);
>   if (err)
>   goto free_meta;
> -- 
> 2.44.0.rc0.258.g7320e95886-goog


___
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 remove f2fs_bug_on in add_bio_entry

2024-03-04 Thread Zhiguo Niu
add_bio_entry should not trigger system panic when bio_add_page fail,
fix to remove it.

Fixes: 0b20fcec8651 ("f2fs: cache global IPU bio")
Signed-off-by: Zhiguo Niu 
---
 fs/f2fs/data.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index bd8674b..2fbbf8f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -761,8 +761,10 @@ static void add_bio_entry(struct f2fs_sb_info *sbi, struct 
bio *bio,
be->bio = bio;
bio_get(bio);
 
-   if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE)
-   f2fs_bug_on(sbi, 1);
+   if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE) {
+   bio_put(bio);
+   return;
+   }
 
f2fs_down_write(>bio_list_lock);
list_add_tail(>list, >bio_list);
-- 
1.9.1



___
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 result of new_curseg in f2fs_allocate_segment_for_resize

2024-03-04 Thread Zhiguo Niu
On Mon, Mar 4, 2024 at 5:19 PM Chao Yu  wrote:
>
> On 2024/3/4 15:52, Zhiguo Niu wrote:
> > On Mon, Mar 4, 2024 at 3:17 PM Chao Yu  wrote:
> >>
> >> On 2024/3/4 11:33, Zhiguo Niu wrote:
> >>> On Mon, Mar 4, 2024 at 11:19 AM Chao Yu  wrote:
> 
>  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()
>  in one patch?
> >>> Dear Chao,
> >>>
> >>> Do you mean to merge it with the previous patch “f2fs: fix to check
> >>> return value of f2fs_gc_range”?
> >>> Because in addition to new_curseg/change_curseg error handling, there
> >>> are some other changes in the previous patch.
> >>> besides, I searched for new related codes, and there should be the
> >>> only place left without error handling about new_curseg/
> >>> change_curseg .
> >>
> >> Zhiguo, I meant something like this?
> >>
> >> Subject: [PATCH] f2fs: fix to handle error paths of {new,change}_curseg()
> > Dear Chao,
> > I got your meaning and I think this patch looks good.
> > Please ignore my patch and use your version:).
>
> Zhiguo,
>
> This is a raw patch, can you please write commit message for it, and
> resend it once you've tested it.
Dear Chao,
OK, no problem.
thanks!
>
> Thanks,
>
> > thanks!
> >>
> >> ---
> >>fs/f2fs/f2fs.h|  4 +--
> >>fs/f2fs/gc.c  |  7 +++--
> >>fs/f2fs/segment.c | 67 +++
> >>fs/f2fs/super.c   |  4 ++-
> >>4 files changed, 54 insertions(+), 28 deletions(-)
> >>
> >> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> >> index 80789255bf68..03927f1b2ea1 100644
> >> --- a/fs/f2fs/f2fs.h
> >> +++ b/fs/f2fs/f2fs.h
> >> @@ -3702,10 +3702,10 @@ int f2fs_disable_cp_again(struct f2fs_sb_info 
> >> *sbi, block_t unusable);
> >>void f2fs_release_discard_addrs(struct f2fs_sb_info *sbi);
> >>int f2fs_npages_for_summary_flush(struct f2fs_sb_info *sbi, bool 
> >> for_ra);
> >>bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, int segno);
> >> -void f2fs_init_inmem_curseg(struct f2fs_sb_info *sbi);
> >> +int f2fs_init_inmem_curseg(struct f2fs_sb_info *sbi);
> >>void f2fs_save_inmem_curseg(struct f2fs_sb_info *sbi);
> >>void f2fs_restore_inmem_curseg(struct f2fs_sb_info *sbi);
> >> -void f2fs_allocate_segment_for_resize(struct f2fs_sb_info *sbi, int type,
> >> +int f2fs_allocate_segment_for_resize(struct f2fs_sb_info *sbi, int type,
> >>  unsigned int start, unsigned int 
> >> end);
> >>int f2fs_allocate_new_section(struct f2fs_sb_info *sbi, int type, bool 
> >> force);
> >>int f2fs_allocate_pinning_section(struct f2fs_sb_info *sbi);
> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> >> index f8314765246a..854ad0a3f6ea 100644
> >> --- a/fs/f2fs/gc.c
> >> +++ b/fs/f2fs/gc.c
> >> @@ -2033,8 +2033,11 @@ static int free_segment_range(struct f2fs_sb_info 
> >> *sbi,
> >>  mutex_unlock(_I(sbi)->seglist_lock);
> >>
> >>  /* Move out cursegs from the target range */
> >> -   for (type = CURSEG_HOT_DATA; type < NR_CURSEG_PERSIST_TYPE; type++)
> >> -   f2fs_allocate_segment_for_resize(sbi, type, start, end);
> >> +   for (type = CURSEG_HOT_DATA; type < NR_CURSEG_PERSIST_TYPE; 
> >> type++) {
> >> +   err = f2fs_allocate_segment_for_resize(sbi, type, start, 
> >> end);
> >> +   if (err)
> >> +   goto out;
> >> +   }
> >>
> >>  /* do GC to move out valid blocks in the range */
> >>  err = f2fs_gc_range(sbi, start, end, dry_run, 0);
> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> >> index 22241aba6564..2bcf01fde143 100644
> >> --- a/fs/f2fs/segment.c
> >> +++ b/fs/f2fs/segment.c
> >> @@ -2863,7 +2863,7 @@ bool f2fs_segment_has_free_slot(struct f2fs_sb_info 
> >> *sbi, int segno)
> >> * This function always allocates a used segment(from dirty seglist) by 
> >> SSR
> >> * manner, so it should recover the existing segment information of 
> >> valid blocks
> >> */
> >> -static void change_curseg(struct f2fs_sb_info *sbi, int type)
> >> +static int change_curseg(struct f2fs_sb_info *sbi, int type)
> >>{
> >>  struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
> >>  struct curseg_info *curseg = CURSEG_I(sbi, type);
> >> @@ -2888,21 +2888,24 @@ static void change_curseg(struct f2fs_sb_info 
> >> *sbi, int type)
> >>  if (IS_ERR(sum_page)) {
> >>  /* GC won't be able to use stale summary pages by 
> >> cp_error */
> >>  memset(curseg->sum_blk, 0, SUM_ENTRY_SIZE);
> >> -   return;
> >> +   return PTR_ERR(sum_page);
> >>  }
> >>  sum_node = (struct f2fs_summary_block *)page_address(sum_page);
> >>  

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 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()
in one patch?

Dear Chao,

Do you mean to merge it with the previous patch “f2fs: fix to check
return value of f2fs_gc_range”?
Because in addition to new_curseg/change_curseg error handling, there
are some other changes in the previous patch.
besides, I searched for new related codes, and there should be the
only place left without error handling about new_curseg/
change_curseg .


Zhiguo, I meant something like this?

Subject: [PATCH] f2fs: fix to handle error paths of {new,change}_curseg()

Dear Chao,
I got your meaning and I think this patch looks good.
Please ignore my patch and use your version:).


Zhiguo,

This is a raw patch, can you please write commit message for it, and
resend it once you've tested it.

Thanks,


thanks!


---
   fs/f2fs/f2fs.h|  4 +--
   fs/f2fs/gc.c  |  7 +++--
   fs/f2fs/segment.c | 67 +++
   fs/f2fs/super.c   |  4 ++-
   4 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 80789255bf68..03927f1b2ea1 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3702,10 +3702,10 @@ int f2fs_disable_cp_again(struct f2fs_sb_info *sbi, 
block_t unusable);
   void f2fs_release_discard_addrs(struct f2fs_sb_info *sbi);
   int f2fs_npages_for_summary_flush(struct f2fs_sb_info *sbi, bool for_ra);
   bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, int segno);
-void f2fs_init_inmem_curseg(struct f2fs_sb_info *sbi);
+int f2fs_init_inmem_curseg(struct f2fs_sb_info *sbi);
   void f2fs_save_inmem_curseg(struct f2fs_sb_info *sbi);
   void f2fs_restore_inmem_curseg(struct f2fs_sb_info *sbi);
-void f2fs_allocate_segment_for_resize(struct f2fs_sb_info *sbi, int type,
+int f2fs_allocate_segment_for_resize(struct f2fs_sb_info *sbi, int type,
 unsigned int start, unsigned int end);
   int f2fs_allocate_new_section(struct f2fs_sb_info *sbi, int type, bool 
force);
   int f2fs_allocate_pinning_section(struct f2fs_sb_info *sbi);
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index f8314765246a..854ad0a3f6ea 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -2033,8 +2033,11 @@ static int free_segment_range(struct f2fs_sb_info *sbi,
 mutex_unlock(_I(sbi)->seglist_lock);

 /* Move out cursegs from the target range */
-   for (type = CURSEG_HOT_DATA; type < NR_CURSEG_PERSIST_TYPE; type++)
-   f2fs_allocate_segment_for_resize(sbi, type, start, end);
+   for (type = CURSEG_HOT_DATA; type < NR_CURSEG_PERSIST_TYPE; type++) {
+   err = f2fs_allocate_segment_for_resize(sbi, type, start, end);
+   if (err)
+   goto out;
+   }

 /* do GC to move out valid blocks in the range */
 err = f2fs_gc_range(sbi, start, end, dry_run, 0);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 22241aba6564..2bcf01fde143 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2863,7 +2863,7 @@ bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, 
int segno)
* This function always allocates a used segment(from dirty seglist) by SSR
* manner, so it should recover the existing segment information of valid 
blocks
*/
-static void change_curseg(struct f2fs_sb_info *sbi, int type)
+static int change_curseg(struct f2fs_sb_info *sbi, int type)
   {
 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
 struct curseg_info *curseg = CURSEG_I(sbi, type);
@@ -2888,21 +2888,24 @@ static void change_curseg(struct f2fs_sb_info *sbi, int 
type)
 if (IS_ERR(sum_page)) {
 /* GC won't be able to use stale summary pages by cp_error */
 memset(curseg->sum_blk, 0, SUM_ENTRY_SIZE);
-   return;
+   return PTR_ERR(sum_page);
 }
 sum_node = (struct f2fs_summary_block *)page_address(sum_page);
 memcpy(curseg->sum_blk, sum_node, SUM_ENTRY_SIZE);
 f2fs_put_page(sum_page, 1);
+
+   return 0;
   }

   static int get_ssr_segment(struct f2fs_sb_info *sbi, int type,
 int alloc_mode, unsigned long long age);

-static void get_atssr_segment(struct f2fs_sb_info *sbi, int type,
+static int get_atssr_segment(struct f2fs_sb_info *sbi, int type,
 int target_type, int alloc_mode,
 unsigned long long age)
   {
 struct curseg_info *curseg = CURSEG_I(sbi, type);
+   int ret;

 curseg->seg_type = target_type;