Skip to contentSkip to conversation

ocfs2: add trace event log to alloc.c

PATCH New Wengang Wang 2 participants 3 messages Nov 26, 2009 – Dec 16, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ocfs2: add trace event log to alloc.c

this patche adds trace event log to alloc.c.

---
 fs/ocfs2/alloc.c             |   47 +++++-----
 include/trace/events/ocfs2.h |  202 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 224 insertions(+), 25 deletions(-)
fs/ocfs2/alloc.c +22 -25
index 38a42f5..1ccae54 100644
@@ -53,6 +53,9 @@
 
 #include "buffer_head_io.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/ocfs2.h>
+
 enum ocfs2_contig_type {
 	CONTIG_NONE = 0,
 	CONTIG_LEFT,
@@ -1204,8 +1207,8 @@ static int ocfs2_add_branch(handle_t *handle,
 	 * from new_cpos).
 	 */
 	if (root_end > new_cpos) {
-		mlog(0, "adjust the cluster end from %u to %u\n",
-		     root_end, new_cpos);
+		trace_ocfs2_add_branch(root_end, new_cpos);
+
 		status = ocfs2_adjust_rightmost_branch(handle, et);
 		if (status) {
 			mlog_errno(status);
@@ -1564,7 +1567,7 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et,
 	 * another tree level */
 	if (shift) {
 		BUG_ON(bh);
-		mlog(0, "need to shift tree depth (current = %d)\n", depth);
+		trace_ocfs2_grow_tree(depth);
 
 		/* ocfs2_shift_tree_depth will return us a buffer with
 		 * the new extent block (so we can pass that to
@@ -2463,8 +2466,7 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
 	 * rotating subtrees.
 	 */
 	while (cpos && insert_cpos <= cpos) {
-		mlog(0, "Rotating a tree: ins. cpos: %u, left path cpos: %u\n",
-		     insert_cpos, cpos);
+		trace_ocfs2_rotate_tree_right(insert_cpos, cpos);
 
 		ret = ocfs2_find_path(et->et_ci, left_path, cpos);
 		if (ret) {
@@ -4779,11 +4781,9 @@ int ocfs2_insert_extent(handle_t *handle,
 		goto bail;
 	}
 
-	mlog(0, "Insert.appending: %u, Insert.Contig: %u, "
-	     "Insert.contig_index: %d, Insert.free_records: %d, "
-	     "Insert.tree_depth: %d\n",
-	     insert.ins_appending, insert.ins_contig, insert.ins_contig_index,
-	     free_records, insert.ins_tree_depth);
+	trace_ocfs2_insert_extent(insert.ins_appending, insert.ins_contig,
+				  insert.ins_contig_index, free_records,
+				  insert.ins_tree_depth);
 
 	if (insert.ins_contig == CONTIG_NONE && free_records == 0) {
 		status = ocfs2_grow_tree(handle, et,
@@ -5139,9 +5139,8 @@ int ocfs2_split_extent(handle_t *handle,
 
 	ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]);
 
-	mlog(0, "index: %d, contig: %u, has_empty: %u, split_covers: %u\n",
-	     split_index, ctxt.c_contig_type, ctxt.c_has_empty_extent,
-	     ctxt.c_split_covers_rec);
+	trace_ocfs2_split_extent(split_index, ctxt.c_contig_type,
+			   ctxt.c_has_empty_extent, ctxt.c_split_covers_rec);
 
 	if (ctxt.c_contig_type == CONTIG_NONE) {
 		if (ctxt.c_split_covers_rec)
@@ -5595,11 +5594,9 @@ int ocfs2_remove_extent(handle_t *handle,
 
 	BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range);
 
-	mlog(0, "Owner %llu, remove (cpos %u, len %u). Existing index %d "
-	     "(cpos %u, len %u)\n",
-	     (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
-	     cpos, len, index,
-	     le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec));
+	trace_ocfs2_remove_extent((unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
+				  cpos, len, index, le32_to_cpu(rec->e_cpos),
+				  ocfs2_rec_clusters(el, rec));
 
 	if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) {
 		ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
@@ -5828,9 +5825,9 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
 		goto bail;
 	}
 
-	mlog(0, "Log truncate of %u clusters starting at cluster %u to "
-	     "%llu (index = %d)\n", num_clusters, start_cluster,
-	     (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index);
+	trace_ocfs2_truncate_log_append(num_clusters, start_cluster,
+					(unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
+					index);
 
 	if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) {
 		/*
@@ -7455,8 +7452,8 @@ start:
 		goto bail;
 	}
 
-	mlog(0, "inode->ip_clusters = %u, tree_depth = %u\n",
-	     OCFS2_I(inode)->ip_clusters, path->p_tree_depth);
+	trace_ocfs2_commit_truncate_1(OCFS2_I(inode)->ip_clusters,
+				      path->p_tree_depth);
 
 	/*
 	 * By now, el will point to the extent list on the bottom most
@@ -7500,8 +7497,8 @@ start:
 		goto bail;
 	}
 
-	mlog(0, "clusters_to_del = %u in this pass, tail blk=%llu\n",
-	     clusters_to_del, (unsigned long long)path_leaf_bh(path)->b_blocknr);
+	trace_ocfs2_commit_truncate_2(clusters_to_del,
+				      (unsigned long long)path_leaf_bh(path)->b_blocknr);
 
 	if (el->l_recs[i].e_flags & OCFS2_EXT_REFCOUNTED && clusters_to_del) {
 		BUG_ON(!(OCFS2_I(inode)->ip_dyn_features &
include/trace/events/ocfs2.h +202 -0

212 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 2/2 ocfs2: add trace event log to alloc.c

Quoted 3 lines · Wengang Wang

this patche adds trace event log to alloc.c.

Hey Wengang,
Sorry I didn't respond sooner and left you hanging. This is
good work. Thank you for taking this on.
Unfortunately, it brought up another problem. The tracing
infrastructure is not on el5. If we apply your patches to mainline, we'll have an awful time backporting anything to 1.6, because mainline will have trace_* functions and 1.6 will have mlog functions. Not your fault, of course.
The easy solution is to hold off until el6 comes out. el6 will
have the tracing code. Another possibility is to fake the tracing infrastructure in 1.6. We haven't come up with a sane way to do that yet. So for now, we're going to hold off.
Please keep these patches handy. We'll be using them when the
time comes.

Joel

Signature · 9 lines
Life's Little Instruction Book #30

	"Never buy a house without a fireplace."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
#2 lore raw

PATCH 2/2 ocfs2: add trace event log to alloc.c

Hi Joel,

Quoted 5 lines · Joel Becker
Quoted 3 lines · Wengang Wang

this patche adds trace event log to alloc.c.

Quoted 15 lines

Hey Wengang,
Sorry I didn't respond sooner and left you hanging. This is
good work. Thank you for taking this on.
Unfortunately, it brought up another problem. The tracing
infrastructure is not on el5. If we apply your patches to mainline, we'll have an awful time backporting anything to 1.6, because mainline will have trace_* functions and 1.6 will have mlog functions. Not your fault, of course.
The easy solution is to hold off until el6 comes out. el6 will
have the tracing code. Another possibility is to fake the tracing infrastructure in 1.6. We haven't come up with a sane way to do that yet. So for now, we're going to hold off.
Please keep these patches handy. We'll be using them when the
time comes.

Understand. I will keep the patches handy.

regards,
wengang.