f2fs: add trace for rb-tree extent cache ops

This patch adds trace for lookup/update/shrink/destroy ops in rb-tree extent cache.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index acdc076..d7ff4ca 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -533,6 +533,8 @@
 	if (is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT))
 		return false;
 
+	trace_f2fs_lookup_extent_tree_start(inode, pgofs);
+
 	down_read(&sbi->extent_tree_lock);
 	et = radix_tree_lookup(&sbi->extent_tree_root, inode->i_ino);
 	if (!et) {
@@ -555,6 +557,8 @@
 	stat_inc_total_hit(sbi->sb);
 	read_unlock(&et->lock);
 
+	trace_f2fs_lookup_extent_tree_end(inode, pgofs, en);
+
 	atomic_dec(&et->refcount);
 	return en ? true : false;
 }
@@ -573,6 +577,8 @@
 	if (is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT))
 		return;
 
+	trace_f2fs_update_extent_tree(inode, fofs, blkaddr);
+
 	down_write(&sbi->extent_tree_lock);
 	et = radix_tree_lookup(&sbi->extent_tree_root, ino);
 	if (!et) {
@@ -665,6 +671,7 @@
 	struct radix_tree_iter iter;
 	void **slot;
 	unsigned int found;
+	unsigned int node_cnt = 0, tree_cnt = 0;
 
 	if (!test_opt(sbi, EXTENT_CACHE))
 		return;
@@ -691,7 +698,7 @@
 
 			atomic_inc(&et->refcount);
 			write_lock(&et->lock);
-			__free_extent_tree(sbi, et, false);
+			node_cnt += __free_extent_tree(sbi, et, false);
 			write_unlock(&et->lock);
 			atomic_dec(&et->refcount);
 		}
@@ -707,15 +714,19 @@
 			radix_tree_delete(&sbi->extent_tree_root, et->ino);
 			kmem_cache_free(extent_tree_slab, et);
 			sbi->total_ext_tree--;
+			tree_cnt++;
 		}
 	}
 	up_write(&sbi->extent_tree_lock);
+
+	trace_f2fs_shrink_extent_tree(sbi, node_cnt, tree_cnt);
 }
 
 void f2fs_destroy_extent_tree(struct inode *inode)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
 	struct extent_tree *et;
+	unsigned int node_cnt = 0;
 
 	if (!test_opt(sbi, EXTENT_CACHE))
 		return;
@@ -731,7 +742,7 @@
 
 	/* free all extent info belong to this extent tree */
 	write_lock(&et->lock);
-	__free_extent_tree(sbi, et, true);
+	node_cnt = __free_extent_tree(sbi, et, true);
 	write_unlock(&et->lock);
 
 	atomic_dec(&et->refcount);
@@ -749,6 +760,7 @@
 	sbi->total_ext_tree--;
 	up_write(&sbi->extent_tree_lock);
 out:
+	trace_f2fs_destroy_extent_tree(inode, node_cnt);
 	return;
 }