From 10fca35ff12ad2a7017bce6567cffe9da443d7a2 Mon Sep 17 00:00:00 2001
From: Tao Ma <boyu.mt@taobao.com>
Date: Mon, 23 May 2011 10:36:45 +0800
Subject: 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>
---
 fs/ocfs2/alloc.c | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'fs/ocfs2/alloc.c')

diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index ae3ea783dad7..ed553c60de82 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -7196,6 +7196,8 @@ static int ocfs2_trim_extent(struct super_block *sb,
 	discard = le64_to_cpu(gd->bg_blkno) +
 			ocfs2_clusters_to_blocks(sb, start);
 
+	trace_ocfs2_trim_extent(sb, (unsigned long long)discard, bcount);
+
 	return sb_issue_discard(sb, discard, bcount, GFP_NOFS, 0);
 }
 
@@ -7209,6 +7211,9 @@ static int ocfs2_trim_group(struct super_block *sb,
 	if (le16_to_cpu(gd->bg_free_bits_count) < minbits)
 		return 0;
 
+	trace_ocfs2_trim_group((unsigned long long)le64_to_cpu(gd->bg_blkno),
+			       start, max, minbits);
+
 	while (start < max) {
 		start = ocfs2_find_next_zero_bit(bitmap, max, start);
 		if (start >= max)
@@ -7292,6 +7297,8 @@ int ocfs2_trim_fs(struct super_block *sb, struct fstrim_range *range)
 	if (start + len > le32_to_cpu(main_bm->i_clusters))
 		len = le32_to_cpu(main_bm->i_clusters) - start;
 
+	trace_ocfs2_trim_fs(start, len, minlen);
+
 	/* Determine first and last group to examine based on start and len */
 	first_group = ocfs2_which_cluster_group(main_bm_inode, start);
 	if (first_group == osb->first_cluster_group_blkno)
-- 
cgit v1.2.3-70-g09d2