Commit 10fca35ff12ad2a7017bce6567cffe9da443d7a2
Committed by
Joel Becker
1 parent
55e67872b6
Exists in
master
and in
39 other branches
ocfs2: Add trace event for trim.
Add the corresponding trace event for trim. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: Joel Becker <jlbec@evilplan.org>
Showing 2 changed files with 32 additions and 0 deletions Side-by-side Diff
fs/ocfs2/alloc.c
... | ... | @@ -7196,6 +7196,8 @@ |
7196 | 7196 | discard = le64_to_cpu(gd->bg_blkno) + |
7197 | 7197 | ocfs2_clusters_to_blocks(sb, start); |
7198 | 7198 | |
7199 | + trace_ocfs2_trim_extent(sb, (unsigned long long)discard, bcount); | |
7200 | + | |
7199 | 7201 | return sb_issue_discard(sb, discard, bcount, GFP_NOFS, 0); |
7200 | 7202 | } |
7201 | 7203 | |
... | ... | @@ -7209,6 +7211,9 @@ |
7209 | 7211 | if (le16_to_cpu(gd->bg_free_bits_count) < minbits) |
7210 | 7212 | return 0; |
7211 | 7213 | |
7214 | + trace_ocfs2_trim_group((unsigned long long)le64_to_cpu(gd->bg_blkno), | |
7215 | + start, max, minbits); | |
7216 | + | |
7212 | 7217 | while (start < max) { |
7213 | 7218 | start = ocfs2_find_next_zero_bit(bitmap, max, start); |
7214 | 7219 | if (start >= max) |
... | ... | @@ -7291,6 +7296,8 @@ |
7291 | 7296 | |
7292 | 7297 | if (start + len > le32_to_cpu(main_bm->i_clusters)) |
7293 | 7298 | len = le32_to_cpu(main_bm->i_clusters) - start; |
7299 | + | |
7300 | + trace_ocfs2_trim_fs(start, len, minlen); | |
7294 | 7301 | |
7295 | 7302 | /* Determine first and last group to examine based on start and len */ |
7296 | 7303 | first_group = ocfs2_which_cluster_group(main_bm_inode, start); |
fs/ocfs2/ocfs2_trace.h
... | ... | @@ -688,6 +688,31 @@ |
688 | 688 | __entry->blkno, __entry->bit) |
689 | 689 | ); |
690 | 690 | |
691 | +TRACE_EVENT(ocfs2_trim_extent, | |
692 | + TP_PROTO(struct super_block *sb, unsigned long long blk, | |
693 | + unsigned long long count), | |
694 | + TP_ARGS(sb, blk, count), | |
695 | + TP_STRUCT__entry( | |
696 | + __field(int, dev_major) | |
697 | + __field(int, dev_minor) | |
698 | + __field(unsigned long long, blk) | |
699 | + __field(__u64, count) | |
700 | + ), | |
701 | + TP_fast_assign( | |
702 | + __entry->dev_major = MAJOR(sb->s_dev); | |
703 | + __entry->dev_minor = MINOR(sb->s_dev); | |
704 | + __entry->blk = blk; | |
705 | + __entry->count = count; | |
706 | + ), | |
707 | + TP_printk("%d %d %llu %llu", | |
708 | + __entry->dev_major, __entry->dev_minor, | |
709 | + __entry->blk, __entry->count) | |
710 | +); | |
711 | + | |
712 | +DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_trim_group); | |
713 | + | |
714 | +DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_trim_fs); | |
715 | + | |
691 | 716 | /* End of trace events for fs/ocfs2/alloc.c. */ |
692 | 717 | |
693 | 718 | /* Trace events for fs/ocfs2/localalloc.c. */ |