* [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs
@ 2023-02-13 14:18 Yangtao Li via Linux-f2fs-devel
2023-02-13 14:18 ` [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() Yangtao Li via Linux-f2fs-devel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2023-02-13 14:18 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel
Export ipu_policy as a string in debugfs for better readability and
it can help us better understand some strategies of the file system.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
v3:
- remove unnecessary '\n'
fs/f2fs/debug.c | 24 ++++++++++++++++++++++++
fs/f2fs/segment.h | 1 +
2 files changed, 25 insertions(+)
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 32af4f0c5735..ff5995cb9560 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -354,6 +354,17 @@ static char *s_flag[] = {
[SBI_IS_FREEZING] = " freezefs",
};
+static const char *ipu_mode_names[F2FS_IPU_MAX] = {
+ [F2FS_IPU_FORCE] = "FORCE",
+ [F2FS_IPU_SSR] = "SSR",
+ [F2FS_IPU_UTIL] = "UTIL",
+ [F2FS_IPU_SSR_UTIL] = "SSR_UTIL",
+ [F2FS_IPU_FSYNC] = "FSYNC",
+ [F2FS_IPU_ASYNC] = "ASYNC",
+ [F2FS_IPU_NOCACHE] = "NOCACHE",
+ [F2FS_IPU_HONOR_OPU_WRITE] = "HONOR_OPU_WRITE",
+};
+
static int stat_show(struct seq_file *s, void *v)
{
struct f2fs_stat_info *si;
@@ -384,6 +395,19 @@ static int stat_show(struct seq_file *s, void *v)
seq_printf(s, "Current Time Sec: %llu / Mounted Time Sec: %llu\n\n",
ktime_get_boottime_seconds(),
SIT_I(si->sbi)->mounted_time);
+
+ seq_puts(s, "Policy:\n");
+ seq_puts(s, " - IPU: [");
+ if (IS_F2FS_IPU_DISABLE(si->sbi)) {
+ seq_puts(s, " DISABLE");
+ } else {
+ unsigned long policy = SM_I(si->sbi)->ipu_policy;
+
+ for_each_set_bit(j, &policy, F2FS_IPU_MAX)
+ seq_printf(s, " %s", ipu_mode_names[j]);
+ }
+ seq_puts(s, " ]\n\n");
+
if (test_opt(si->sbi, DISCARD))
seq_printf(s, "Utilization: %u%% (%u valid blocks, %u discard blocks)\n",
si->utilization, si->valid_count, si->discard_blks);
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 6003fbaf4b7d..7230d0c6c138 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -672,6 +672,7 @@ static inline int utilization(struct f2fs_sb_info *sbi)
#define F2FS_IPU_DISABLE 0
+/* Modification on enum should be synchronized with ipu_mode_names array */
enum {
F2FS_IPU_FORCE,
F2FS_IPU_SSR,
--
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() 2023-02-13 14:18 [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Yangtao Li via Linux-f2fs-devel @ 2023-02-13 14:18 ` Yangtao Li via Linux-f2fs-devel 2023-02-14 1:29 ` Chao Yu 2023-02-14 1:28 ` [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Chao Yu 2023-02-14 18:10 ` patchwork-bot+f2fs 2 siblings, 1 reply; 5+ messages in thread From: Yangtao Li via Linux-f2fs-devel @ 2023-02-13 14:18 UTC (permalink / raw) To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel For each loop add a local f2fs_sb_info pointer insted of looking it up. Signed-off-by: Yangtao Li <frank.li@vivo.com> --- fs/f2fs/debug.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index ff5995cb9560..30a77936e3c5 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -373,16 +373,18 @@ static int stat_show(struct seq_file *s, void *v) raw_spin_lock_irqsave(&f2fs_stat_lock, flags); list_for_each_entry(si, &f2fs_stat_list, stat_list) { - update_general_status(si->sbi); + struct f2fs_sb_info *sbi = si->sbi; + + update_general_status(sbi); seq_printf(s, "\n=====[ partition info(%pg). #%d, %s, CP: %s]=====\n", - si->sbi->sb->s_bdev, i++, - f2fs_readonly(si->sbi->sb) ? "RO" : "RW", - is_set_ckpt_flags(si->sbi, CP_DISABLED_FLAG) ? - "Disabled" : (f2fs_cp_error(si->sbi) ? "Error" : "Good")); - if (si->sbi->s_flag) { + sbi->sb->s_bdev, i++, + f2fs_readonly(sbi->sb) ? "RO" : "RW", + is_set_ckpt_flags(sbi, CP_DISABLED_FLAG) ? + "Disabled" : (f2fs_cp_error(sbi) ? "Error" : "Good")); + if (sbi->s_flag) { seq_puts(s, "[SBI:"); - for_each_set_bit(j, &si->sbi->s_flag, 32) + for_each_set_bit(j, &sbi->s_flag, 32) seq_puts(s, s_flag[j]); seq_puts(s, "]\n"); } @@ -394,21 +396,21 @@ static int stat_show(struct seq_file *s, void *v) si->overp_segs, si->rsvd_segs); seq_printf(s, "Current Time Sec: %llu / Mounted Time Sec: %llu\n\n", ktime_get_boottime_seconds(), - SIT_I(si->sbi)->mounted_time); + SIT_I(sbi)->mounted_time); seq_puts(s, "Policy:\n"); seq_puts(s, " - IPU: ["); - if (IS_F2FS_IPU_DISABLE(si->sbi)) { + if (IS_F2FS_IPU_DISABLE(sbi)) { seq_puts(s, " DISABLE"); } else { - unsigned long policy = SM_I(si->sbi)->ipu_policy; + unsigned long policy = SM_I(sbi)->ipu_policy; for_each_set_bit(j, &policy, F2FS_IPU_MAX) seq_printf(s, " %s", ipu_mode_names[j]); } seq_puts(s, " ]\n\n"); - if (test_opt(si->sbi, DISCARD)) + if (test_opt(sbi, DISCARD)) seq_printf(s, "Utilization: %u%% (%u valid blocks, %u discard blocks)\n", si->utilization, si->valid_count, si->discard_blks); else @@ -515,15 +517,15 @@ static int stat_show(struct seq_file *s, void *v) seq_printf(s, " - node segments : %d (%d)\n", si->node_segs, si->bg_node_segs); seq_puts(s, " - Reclaimed segs :\n"); - seq_printf(s, " - Normal : %d\n", si->sbi->gc_reclaimed_segs[GC_NORMAL]); - seq_printf(s, " - Idle CB : %d\n", si->sbi->gc_reclaimed_segs[GC_IDLE_CB]); + seq_printf(s, " - Normal : %d\n", sbi->gc_reclaimed_segs[GC_NORMAL]); + seq_printf(s, " - Idle CB : %d\n", sbi->gc_reclaimed_segs[GC_IDLE_CB]); seq_printf(s, " - Idle Greedy : %d\n", - si->sbi->gc_reclaimed_segs[GC_IDLE_GREEDY]); - seq_printf(s, " - Idle AT : %d\n", si->sbi->gc_reclaimed_segs[GC_IDLE_AT]); + sbi->gc_reclaimed_segs[GC_IDLE_GREEDY]); + seq_printf(s, " - Idle AT : %d\n", sbi->gc_reclaimed_segs[GC_IDLE_AT]); seq_printf(s, " - Urgent High : %d\n", - si->sbi->gc_reclaimed_segs[GC_URGENT_HIGH]); - seq_printf(s, " - Urgent Mid : %d\n", si->sbi->gc_reclaimed_segs[GC_URGENT_MID]); - seq_printf(s, " - Urgent Low : %d\n", si->sbi->gc_reclaimed_segs[GC_URGENT_LOW]); + sbi->gc_reclaimed_segs[GC_URGENT_HIGH]); + seq_printf(s, " - Urgent Mid : %d\n", sbi->gc_reclaimed_segs[GC_URGENT_MID]); + seq_printf(s, " - Urgent Low : %d\n", sbi->gc_reclaimed_segs[GC_URGENT_LOW]); seq_printf(s, "Try to move %d blocks (BG: %d)\n", si->tot_blks, si->bg_data_blks + si->bg_node_blks); seq_printf(s, " - data blocks : %d (%d)\n", si->data_blks, @@ -589,7 +591,7 @@ static int stat_show(struct seq_file *s, void *v) si->ndirty_imeta); seq_printf(s, " - fsync mark: %4lld\n", percpu_counter_sum_positive( - &si->sbi->rf_node_block_count)); + &sbi->rf_node_block_count)); seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n", si->dirty_nats, si->nats, si->dirty_sits, si->sits); seq_printf(s, " - free_nids: %9d/%9d\n - alloc_nids: %9d\n", @@ -616,12 +618,12 @@ static int stat_show(struct seq_file *s, void *v) si->block_count[LFS], si->segment_count[LFS]); /* segment usage info */ - f2fs_update_sit_info(si->sbi); + f2fs_update_sit_info(sbi); seq_printf(s, "\nBDF: %u, avg. vblocks: %u\n", si->bimodal, si->avg_vblocks); /* memory footprint */ - update_mem_info(si->sbi); + update_mem_info(sbi); seq_printf(s, "\nMemory: %llu KB\n", (si->base_mem + si->cache_mem + si->page_mem) >> 10); seq_printf(s, " - static: %llu KB\n", -- 2.25.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() 2023-02-13 14:18 ` [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() Yangtao Li via Linux-f2fs-devel @ 2023-02-14 1:29 ` Chao Yu 0 siblings, 0 replies; 5+ messages in thread From: Chao Yu @ 2023-02-14 1:29 UTC (permalink / raw) To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel On 2023/2/13 22:18, Yangtao Li wrote: > For each loop add a local f2fs_sb_info pointer insted of looking it up. > > Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs 2023-02-13 14:18 [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Yangtao Li via Linux-f2fs-devel 2023-02-13 14:18 ` [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() Yangtao Li via Linux-f2fs-devel @ 2023-02-14 1:28 ` Chao Yu 2023-02-14 18:10 ` patchwork-bot+f2fs 2 siblings, 0 replies; 5+ messages in thread From: Chao Yu @ 2023-02-14 1:28 UTC (permalink / raw) To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel On 2023/2/13 22:18, Yangtao Li wrote: > Export ipu_policy as a string in debugfs for better readability and > it can help us better understand some strategies of the file system. > > Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs 2023-02-13 14:18 [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Yangtao Li via Linux-f2fs-devel 2023-02-13 14:18 ` [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() Yangtao Li via Linux-f2fs-devel 2023-02-14 1:28 ` [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Chao Yu @ 2023-02-14 18:10 ` patchwork-bot+f2fs 2 siblings, 0 replies; 5+ messages in thread From: patchwork-bot+f2fs @ 2023-02-14 18:10 UTC (permalink / raw) To: Yangtao Li; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel Hello: This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <jaegeuk@kernel.org>: On Mon, 13 Feb 2023 22:18:24 +0800 you wrote: > Export ipu_policy as a string in debugfs for better readability and > it can help us better understand some strategies of the file system. > > Signed-off-by: Yangtao Li <frank.li@vivo.com> > --- > v3: > - remove unnecessary '\n' > fs/f2fs/debug.c | 24 ++++++++++++++++++++++++ > fs/f2fs/segment.h | 1 + > 2 files changed, 25 insertions(+) Here is the summary with links: - [f2fs-dev,v3,1/2] f2fs: export ipu policy in debugfs https://git.kernel.org/jaegeuk/f2fs/c/f2e357893cb7 - [f2fs-dev,v3,2/2] f2fs: replace si->sbi w/ sbi in stat_show() https://git.kernel.org/jaegeuk/f2fs/c/dda7d77bcd42 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-14 18:10 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-02-13 14:18 [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Yangtao Li via Linux-f2fs-devel 2023-02-13 14:18 ` [f2fs-dev] [PATCH v3 2/2] f2fs: replace si->sbi w/ sbi in stat_show() Yangtao Li via Linux-f2fs-devel 2023-02-14 1:29 ` Chao Yu 2023-02-14 1:28 ` [f2fs-dev] [PATCH v3 1/2] f2fs: export ipu policy in debugfs Chao Yu 2023-02-14 18:10 ` patchwork-bot+f2fs
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).