* [PATCH] f2fs: show more debug info for discard pend list
@ 2022-10-21 9:24 Yangtao Li
2022-10-25 1:45 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2022-10-21 9:24 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li
This patch shows the discard pend list information:
Discard pend list(X:exist .:not exist):
0 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
32 X X X X . X X . X X X X X X X X X X X X . X X . X X . X X . X X
64 . . X X . X X . . X . . . X X . X . X . X X . X . X X . . . X .
96 . X . . . . X . . . . X . . . X X . . . . . . . . . X . . X X .
128 . X . . . X . . X X X . . . . . X X X . . X . . . . . . . X . X
160 . . X . . . . . X . . . . . . . . . X . . . X X . . . X . X . .
192 . . . . . . . . . . . . . . . . X . . . . . . . . . . . . . . .
224 . X . . . . X . . X . . . . . . . X . . . . . . . X . . . X . .
256 . . . . . . X . . . . . . . . . . . . . . . . . . . . . . . X .
288 . . . . . . . . . . X . . . . . . . X . . . . . . . . . . . . .
320 . . . . . . X X . . X . . . X X . . . . . . . X . . . . . . . .
352 . . . . . X . . . . . . . . . . . . . . X . . . . . . . . X . .
384 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
416 X . . . . X . . . . . . . . . . . . . . . . . . . . . . . . . .
448 . . . . . . . . X . . . . . . . . . . . . . . . . X . . . . . .
480 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/debug.c | 23 +++++++++++++++++++++++
fs/f2fs/f2fs.h | 1 +
2 files changed, 24 insertions(+)
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index a216dcdf6941..343e0fa3b1be 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -109,6 +109,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
llist_empty(&SM_I(sbi)->fcc_info->issue_list);
}
if (SM_I(sbi)->dcc_info) {
+ struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
si->nr_discarded =
atomic_read(&SM_I(sbi)->dcc_info->issued_discard);
si->nr_discarding =
@@ -116,6 +117,14 @@ static void update_general_status(struct f2fs_sb_info *sbi)
si->nr_discard_cmd =
atomic_read(&SM_I(sbi)->dcc_info->discard_cmd_cnt);
si->undiscard_blks = SM_I(sbi)->dcc_info->undiscard_blks;
+ mutex_lock(&dcc->cmd_lock);
+ for (i = 0; i < MAX_PLIST_NUM; i++) {
+ if (!list_empty(&dcc->pend_list[i]))
+ si->discard_pend_list_exist[i] = true;
+ else
+ si->discard_pend_list_exist[i] = false;
+ }
+ mutex_unlock(&dcc->cmd_lock);
}
si->nr_issued_ckpt = atomic_read(&sbi->cprc_info.issued_ckpt);
si->nr_total_ckpt = atomic_read(&sbi->cprc_info.total_ckpt);
@@ -549,6 +558,20 @@ static int stat_show(struct seq_file *s, void *v)
for (j = 0; j < si->util_free; j++)
seq_putc(s, '-');
seq_puts(s, "]\n\n");
+
+ /* Discard pend list info */
+ if (SM_I(si->sbi)->dcc_info) {
+ seq_puts(s, "Discard pend list(X:exist .:not exist):\n");
+ for (j = 0; j < MAX_PLIST_NUM; j++) {
+ if (j % 32 == 0)
+ seq_printf(s, " %-3d", j);
+ seq_printf(s, " %c", si->discard_pend_list_exist[j] ? 'X' : '.');
+ if (j % 32 == 31)
+ seq_putc(s, '\n');
+ }
+ seq_putc(s, '\n');
+ }
+
seq_printf(s, "IPU: %u blocks\n", si->inplace_count);
seq_printf(s, "SSR: %u blocks in %u segments\n",
si->block_count[SSR], si->segment_count[SSR]);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 2f33d6f23a26..c444f3f86608 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3875,6 +3875,7 @@ struct f2fs_stat_info {
int nr_discarding, nr_discarded;
int nr_discard_cmd;
unsigned int undiscard_blks;
+ bool discard_pend_list_exist[MAX_PLIST_NUM];
int nr_issued_ckpt, nr_total_ckpt, nr_queued_ckpt;
unsigned int cur_ckpt_time, peak_ckpt_time;
int inline_xattr, inline_inode, inline_dir, append, update, orphans;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] f2fs: show more debug info for discard pend list
2022-10-21 9:24 [PATCH] f2fs: show more debug info for discard pend list Yangtao Li
@ 2022-10-25 1:45 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2022-10-25 1:45 UTC (permalink / raw)
To: Yangtao Li, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel
On 2022/10/21 17:24, Yangtao Li wrote:
> This patch shows the discard pend list information:
>
> Discard pend list(X:exist .:not exist):
> 0 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
> 32 X X X X . X X . X X X X X X X X X X X X . X X . X X . X X . X X
> 64 . . X X . X X . . X . . . X X . X . X . X X . X . X X . . . X .
> 96 . X . . . . X . . . . X . . . X X . . . . . . . . . X . . X X .
> 128 . X . . . X . . X X X . . . . . X X X . . X . . . . . . . X . X
> 160 . . X . . . . . X . . . . . . . . . X . . . X X . . . X . X . .
> 192 . . . . . . . . . . . . . . . . X . . . . . . . . . . . . . . .
> 224 . X . . . . X . . X . . . . . . . X . . . . . . . X . . . X . .
> 256 . . . . . . X . . . . . . . . . . . . . . . . . . . . . . . X .
> 288 . . . . . . . . . . X . . . . . . . X . . . . . . . . . . . . .
> 320 . . . . . . X X . . X . . . X X . . . . . . . X . . . . . . . .
> 352 . . . . . X . . . . . . . . . . . . . . X . . . . . . . . X . .
> 384 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
> 416 X . . . . X . . . . . . . . . . . . . . . . . . . . . . . . . .
> 448 . . . . . . . . X . . . . . . . . . . . . . . . . X . . . . . .
> 480 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
How about adding this into a procfs entry?
Thanks,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-25 1:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 9:24 [PATCH] f2fs: show more debug info for discard pend list Yangtao Li
2022-10-25 1:45 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®