Messages in this thread Patch in this message | | | From | Yangtao Li <> | Subject | [PATCH] f2fs: show more debug info for discard pend list | Date | Fri, 21 Oct 2022 17:24:35 +0800 |
| |
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
| |