@@ -1839,6 +1839,9 @@ static int issue_discard_thread(void *data)
if (!atomic_read(&dcc->discard_cmd_cnt))
wait_ms = dpolicy.max_interval;
+ trace_f2fs_discard_thread(sbi->sb, wait_ms, dcc->undiscard_blks,
+ atomic_read(&dcc->discard_cmd_cnt));
+
sb_end_intwrite(sbi->sb);
} while (!kthread_should_stop());
@@ -1512,6 +1512,34 @@ DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
TP_ARGS(dev, blkstart, blklen)
);
+TRACE_EVENT(f2fs_discard_thread,
+
+ TP_PROTO(struct super_block *sb, unsigned int wait_ms,
+ unsigned int undiscard_blks, unsigned int discard_cmd_cnt),
+
+ TP_ARGS(sb, wait_ms, undiscard_blks, discard_cmd_cnt),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(unsigned int, wait_ms)
+ __field(unsigned int, undiscard_blks)
+ __field(unsigned int, discard_cmd_cnt)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = sb->s_dev;
+ __entry->wait_ms = wait_ms;
+ __entry->undiscard_blks = undiscard_blks;
+ __entry->discard_cmd_cnt = discard_cmd_cnt;
+ ),
+
+ TP_printk("dev = (%d,%d), wait_ms = %u, undiscard_blks = %u, discard_cmd_cnt = %u",
+ show_dev(__entry->dev),
+ __entry->wait_ms,
+ __entry->undiscard_blks,
+ __entry->discard_cmd_cnt)
+);
+
TRACE_EVENT(f2fs_issue_reset_zone,
TP_PROTO(struct block_device *dev, block_t blkstart),
This patch introduces a tracepoint to monitor discard thread behaviors. Signed-off-by: Yangtao Li <frank.li@vivo.com> --- fs/f2fs/segment.c | 3 +++ include/trace/events/f2fs.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)