All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.o
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Theodore Tso <tytso@mit.edu>,
	"Stephen C. Tweedie" <sct@redhat.com>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: [RFC patch 40/41] EXT4: instrumentation with tracepoints
Date: Thu, 05 Mar 2009 17:48:08 -0500	[thread overview]
Message-ID: <20090305225520.692384747@polymtl.ca> (raw)
In-Reply-To: 20090305224728.947235917@polymtl.ca

[-- Attachment #1: ext4-move-from-markers-to-tracepoints.patch --]
[-- Type: text/plain, Size: 20781 bytes --]

Took the instrumentation from "ext4: Add markers for better debuggability" and
moved it to tracepoints.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Theodore Ts'o <tytso@mit.edu>
CC: Stephen C. Tweedie <sct@redhat.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Ext4 Developers List <linux-ext4@vger.kernel.org>
---
 fs/ext4/fsync.c      |    8 +--
 fs/ext4/ialloc.c     |   17 +++---
 fs/ext4/inode.c      |   79 +++++++++----------------------
 fs/ext4/mballoc.c    |   71 +++++++++-------------------
 fs/ext4/mballoc.h    |    2 
 fs/ext4/super.c      |    6 +-
 include/trace/ext4.h |  129 +++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 194 insertions(+), 118 deletions(-)

Index: linux-2.6-lttng/fs/ext4/fsync.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/fsync.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/fsync.c	2009-03-05 15:49:28.000000000 -0500
@@ -28,10 +28,12 @@
 #include <linux/writeback.h>
 #include <linux/jbd2.h>
 #include <linux/blkdev.h>
-#include <linux/marker.h>
+#include <trace/ext4.h>
 #include "ext4.h"
 #include "ext4_jbd2.h"
 
+DEFINE_TRACE(ext4_sync_file);
+
 /*
  * akpm: A new design for ext4_sync_file().
  *
@@ -52,9 +54,7 @@ int ext4_sync_file(struct file *file, st
 
 	J_ASSERT(ext4_journal_current_handle() == NULL);
 
-	trace_mark(ext4_sync_file, "dev %s datasync %d ino %ld parent %ld",
-		   inode->i_sb->s_id, datasync, inode->i_ino,
-		   dentry->d_parent->d_inode->i_ino);
+	trace_ext4_sync_file(file, dentry, datasync);
 
 	/*
 	 * data=writeback:
Index: linux-2.6-lttng/fs/ext4/ialloc.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/ialloc.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/ialloc.c	2009-03-05 15:49:28.000000000 -0500
@@ -22,6 +22,7 @@
 #include <linux/random.h>
 #include <linux/bitops.h>
 #include <linux/blkdev.h>
+#include <trace/ext4.h>
 #include <asm/byteorder.h>
 #include "ext4.h"
 #include "ext4_jbd2.h"
@@ -29,6 +30,10 @@
 #include "acl.h"
 #include "group.h"
 
+DEFINE_TRACE(ext4_free_inode);
+DEFINE_TRACE(ext4_request_inode);
+DEFINE_TRACE(ext4_allocate_inode);
+
 /*
  * ialloc.c contains the inodes allocation and deallocation routines
  */
@@ -210,11 +215,7 @@ void ext4_free_inode(handle_t *handle, s
 
 	ino = inode->i_ino;
 	ext4_debug("freeing inode %lu\n", ino);
-	trace_mark(ext4_free_inode,
-		   "dev %s ino %lu mode %d uid %lu gid %lu bocks %llu",
-		   sb->s_id, inode->i_ino, inode->i_mode,
-		   (unsigned long) inode->i_uid, (unsigned long) inode->i_gid,
-		   (unsigned long long) inode->i_blocks);
+	trace_ext4_free_inode(inode);
 
 	/*
 	 * Note: we must free any quota before locking the superblock,
@@ -703,8 +704,7 @@ struct inode *ext4_new_inode(handle_t *h
 		return ERR_PTR(-EPERM);
 
 	sb = dir->i_sb;
-	trace_mark(ext4_request_inode, "dev %s dir %lu mode %d", sb->s_id,
-		   dir->i_ino, mode);
+	trace_ext4_request_inode(dir, mode);
 	inode = new_inode(sb);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
@@ -939,8 +939,7 @@ got:
 	}
 
 	ext4_debug("allocating inode %lu\n", inode->i_ino);
-	trace_mark(ext4_allocate_inode, "dev %s ino %lu dir %lu mode %d",
-		   sb->s_id, inode->i_ino, dir->i_ino, mode);
+	trace_ext4_allocate_inode(inode, dir, mode);
 	goto really_out;
 fail:
 	ext4_std_error(sb, err);
Index: linux-2.6-lttng/fs/ext4/inode.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/inode.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/inode.c	2009-03-05 15:49:28.000000000 -0500
@@ -37,11 +37,24 @@
 #include <linux/namei.h>
 #include <linux/uio.h>
 #include <linux/bio.h>
+#include <trace/ext4.h>
 #include "ext4_jbd2.h"
 #include "xattr.h"
 #include "acl.h"
 #include "ext4_extents.h"
 
+DEFINE_TRACE(ext4_write_begin);
+DEFINE_TRACE(ext4_ordered_write_end);
+DEFINE_TRACE(ext4_writeback_write_end);
+DEFINE_TRACE(ext4_journalled_write_end);
+DEFINE_TRACE(ext4_da_writepage);
+DEFINE_TRACE(ext4_da_writepages);
+DEFINE_TRACE(ext4_da_writepages_result);
+DEFINE_TRACE(ext4_da_write_begin);
+DEFINE_TRACE(ext4_da_write_end);
+DEFINE_TRACE(ext4_normal_writepage);
+DEFINE_TRACE(ext4_journalled_writepage);
+
 #define MPAGE_DA_EXTENT_TAIL 0x01
 
 static inline int ext4_begin_ordered_truncate(struct inode *inode,
@@ -1353,10 +1366,7 @@ static int ext4_write_begin(struct file 
  	pgoff_t index;
 	unsigned from, to;
 
-	trace_mark(ext4_write_begin,
-		   "dev %s ino %lu pos %llu len %u flags %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, flags);
+	trace_ext4_write_begin(inode, pos, len, flags);
  	index = pos >> PAGE_CACHE_SHIFT;
 	from = pos & (PAGE_CACHE_SIZE - 1);
 	to = from + len;
@@ -1432,10 +1442,7 @@ static int ext4_ordered_write_end(struct
 	struct inode *inode = mapping->host;
 	int ret = 0, ret2;
 
-	trace_mark(ext4_ordered_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_ordered_write_end(inode, pos, len, copied);
 	ret = ext4_jbd2_file_inode(handle, inode);
 
 	if (ret == 0) {
@@ -1474,10 +1481,7 @@ static int ext4_writeback_write_end(stru
 	int ret = 0, ret2;
 	loff_t new_i_size;
 
-	trace_mark(ext4_writeback_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_writeback_write_end(inode, pos, len, copied);
 	new_i_size = pos + copied;
 	if (new_i_size > EXT4_I(inode)->i_disksize) {
 		ext4_update_i_disksize(inode, new_i_size);
@@ -1513,10 +1517,7 @@ static int ext4_journalled_write_end(str
 	unsigned from, to;
 	loff_t new_i_size;
 
-	trace_mark(ext4_journalled_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_journalled_write_end(inode, pos, len, copied);
 	from = pos & (PAGE_CACHE_SIZE - 1);
 	to = from + len;
 
@@ -2333,9 +2334,7 @@ static int ext4_da_writepage(struct page
 	struct buffer_head *page_bufs;
 	struct inode *inode = page->mapping->host;
 
-	trace_mark(ext4_da_writepage,
-		   "dev %s ino %lu page_index %lu",
-		   inode->i_sb->s_id, inode->i_ino, page->index);
+	trace_ext4_da_writepage(inode, page);
 	size = i_size_read(inode);
 	if (page->index == size >> PAGE_CACHE_SHIFT)
 		len = size & ~PAGE_CACHE_MASK;
@@ -2447,19 +2446,7 @@ static int ext4_da_writepages(struct add
 	int needed_blocks, ret = 0, nr_to_writebump = 0;
 	struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
 
-	trace_mark(ext4_da_writepages,
-		   "dev %s ino %lu nr_t_write %ld "
-		   "pages_skipped %ld range_start %llu "
-		   "range_end %llu nonblocking %d "
-		   "for_kupdate %d for_reclaim %d "
-		   "for_writepages %d range_cyclic %d",
-		   inode->i_sb->s_id, inode->i_ino,
-		   wbc->nr_to_write, wbc->pages_skipped,
-		   (unsigned long long) wbc->range_start,
-		   (unsigned long long) wbc->range_end,
-		   wbc->nonblocking, wbc->for_kupdate,
-		   wbc->for_reclaim, wbc->for_writepages,
-		   wbc->range_cyclic);
+	trace_ext4_da_writepages(inode, wbc);
 
 	/*
 	 * No pages to write? This is mainly a kludge to avoid starting
@@ -2595,14 +2582,7 @@ out_writepages:
 	if (!no_nrwrite_index_update)
 		wbc->no_nrwrite_index_update = 0;
 	wbc->nr_to_write -= nr_to_writebump;
-	trace_mark(ext4_da_writepage_result,
-		   "dev %s ino %lu ret %d pages_written %d "
-		   "pages_skipped %ld congestion %d "
-		   "more_io %d no_nrwrite_index_update %d",
-		   inode->i_sb->s_id, inode->i_ino, ret,
-		   pages_written, wbc->pages_skipped,
-		   wbc->encountered_congestion, wbc->more_io,
-		   wbc->no_nrwrite_index_update);
+	trace_ext4_da_writepages_result(inode, wbc, ret, pages_written);
 	return ret;
 }
 
@@ -2654,11 +2634,7 @@ static int ext4_da_write_begin(struct fi
 					len, flags, pagep, fsdata);
 	}
 	*fsdata = (void *)0;
-
-	trace_mark(ext4_da_write_begin,
-		   "dev %s ino %lu pos %llu len %u flags %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, flags);
+	trace_ext4_da_write_begin(inode, pos, len, flags);
 retry:
 	/*
 	 * With delayed allocation, we don't log the i_disksize update
@@ -2751,10 +2727,7 @@ static int ext4_da_write_end(struct file
 		}
 	}
 
-	trace_mark(ext4_da_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_da_write_end(inode, pos, len, copied);
 	start = pos & (PAGE_CACHE_SIZE - 1);
 	end = start + copied - 1;
 
@@ -2965,9 +2938,7 @@ static int ext4_normal_writepage(struct 
 	loff_t size = i_size_read(inode);
 	loff_t len;
 
-	trace_mark(ext4_normal_writepage,
-		   "dev %s ino %lu page_index %lu",
-		   inode->i_sb->s_id, inode->i_ino, page->index);
+	trace_ext4_normal_writepage(inode, page);
 	J_ASSERT(PageLocked(page));
 	if (page->index == size >> PAGE_CACHE_SHIFT)
 		len = size & ~PAGE_CACHE_MASK;
@@ -3053,9 +3024,7 @@ static int ext4_journalled_writepage(str
 	loff_t size = i_size_read(inode);
 	loff_t len;
 
-	trace_mark(ext4_journalled_writepage,
-		   "dev %s ino %lu page_index %lu",
-		   inode->i_sb->s_id, inode->i_ino, page->index);
+	trace_ext4_journalled_writepage(inode, page);
 	J_ASSERT(PageLocked(page));
 	if (page->index == size >> PAGE_CACHE_SHIFT)
 		len = size & ~PAGE_CACHE_MASK;
Index: linux-2.6-lttng/fs/ext4/mballoc.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/mballoc.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/mballoc.c	2009-03-05 15:49:28.000000000 -0500
@@ -343,6 +343,17 @@ static void release_blocks_on_commit(jou
 
 
 
+DEFINE_TRACE(ext4_discard_blocks);
+DEFINE_TRACE(ext4_mb_new_inode_pa);
+DEFINE_TRACE(ext4_mb_new_group_pa);
+DEFINE_TRACE(ext4_mb_release_inode_pa);
+DEFINE_TRACE(ext4_mb_release_group_pa);
+DEFINE_TRACE(ext4_discard_preallocations);
+DEFINE_TRACE(ext4_mb_discard_preallocations);
+DEFINE_TRACE(ext4_request_blocks);
+DEFINE_TRACE(ext4_allocate_blocks);
+DEFINE_TRACE(ext4_free_blocks);
+
 static inline void *mb_correct_addr_and_bit(int *bit, void *addr)
 {
 #if BITS_PER_LONG == 64
@@ -2878,9 +2889,8 @@ static void release_blocks_on_commit(jou
 		discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb)
 			+ entry->start_blk
 			+ le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
-		trace_mark(ext4_discard_blocks, "dev %s blk %llu count %u",
-			   sb->s_id, (unsigned long long) discard_block,
-			   entry->count);
+		trace_ext4_discard_blocks(sb, (unsigned long long)discard_block,
+					  entry);
 		sb_issue_discard(sb, discard_block, entry->count);
 
 		kmem_cache_free(ext4_free_ext_cachep, entry);
@@ -3700,10 +3710,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat
 
 	mb_debug("new inode pa %p: %llu/%u for %u\n", pa,
 			pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-	trace_mark(ext4_mb_new_inode_pa,
-		   "dev %s ino %lu pstart %llu len %u lstart %u",
-		   sb->s_id, ac->ac_inode->i_ino,
-		   pa->pa_pstart, pa->pa_len, pa->pa_lstart);
+	trace_ext4_mb_new_inode_pa(ac, pa);
 
 	ext4_mb_use_inode_pa(ac, pa);
 	atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated);
@@ -3762,9 +3769,8 @@ ext4_mb_new_group_pa(struct ext4_allocat
 	pa->pa_linear = 1;
 
 	mb_debug("new group pa %p: %llu/%u for %u\n", pa,
-		 pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-	trace_mark(ext4_mb_new_group_pa, "dev %s pstart %llu len %u lstart %u",
-		   sb->s_id, pa->pa_pstart, pa->pa_len, pa->pa_lstart);
+			pa->pa_pstart, pa->pa_len, pa->pa_lstart);
+	trace_ext4_mb_new_group_pa(ac, pa);
 
 	ext4_mb_use_group_pa(ac, pa);
 	atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated);
@@ -3854,10 +3860,8 @@ ext4_mb_release_inode_pa(struct ext4_bud
 			ext4_mb_store_history(ac);
 		}
 
-		trace_mark(ext4_mb_release_inode_pa,
-			   "dev %s ino %lu block %llu count %u",
-			   sb->s_id, pa->pa_inode->i_ino, grp_blk_start + bit,
-			   next - bit);
+		trace_ext4_mb_release_inode_pa(ac, pa, grp_blk_start + bit,
+					       next - bit);
 		mb_free_blocks(pa->pa_inode, e4b, bit, next - bit);
 		bit = next + 1;
 	}
@@ -3891,8 +3895,7 @@ ext4_mb_release_group_pa(struct ext4_bud
 	if (ac)
 		ac->ac_op = EXT4_MB_HISTORY_DISCARD;
 
-	trace_mark(ext4_mb_release_group_pa, "dev %s pstart %llu len %d",
-		   sb->s_id, pa->pa_pstart, pa->pa_len);
+	trace_ext4_mb_release_group_pa(ac, pa);
 	BUG_ON(pa->pa_deleted == 0);
 	ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
 	BUG_ON(group != e4b->bd_group && pa->pa_len != 0);
@@ -4058,8 +4061,7 @@ void ext4_discard_preallocations(struct 
 	}
 
 	mb_debug("discard preallocation for inode %lu\n", inode->i_ino);
-	trace_mark(ext4_discard_preallocations, "dev %s ino %lu", sb->s_id,
-		   inode->i_ino);
+	trace_ext4_discard_preallocations(inode);
 
 	INIT_LIST_HEAD(&list);
 
@@ -4515,8 +4517,7 @@ static int ext4_mb_discard_preallocation
 	int ret;
 	int freed = 0;
 
-	trace_mark(ext4_mb_discard_preallocations, "dev %s needed %d",
-		   sb->s_id, needed);
+	trace_ext4_mb_discard_preallocations(sb, needed);
 	for (i = 0; i < EXT4_SB(sb)->s_groups_count && needed > 0; i++) {
 		ret = ext4_mb_discard_group_preallocations(sb, i, needed);
 		freed += ret;
@@ -4545,17 +4546,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t
 	sb = ar->inode->i_sb;
 	sbi = EXT4_SB(sb);
 
-	trace_mark(ext4_request_blocks, "dev %s flags %u len %u ino %lu "
-		   "lblk %llu goal %llu lleft %llu lright %llu "
-		   "pleft %llu pright %llu ",
-		   sb->s_id, ar->flags, ar->len,
-		   ar->inode ? ar->inode->i_ino : 0,
-		   (unsigned long long) ar->logical,
-		   (unsigned long long) ar->goal,
-		   (unsigned long long) ar->lleft,
-		   (unsigned long long) ar->lright,
-		   (unsigned long long) ar->pleft,
-		   (unsigned long long) ar->pright);
+	trace_ext4_request_blocks(ar);
 
 	if (!EXT4_I(ar->inode)->i_delalloc_reserved_flag) {
 		/*
@@ -4659,18 +4650,7 @@ out3:
 						reserv_blks);
 	}
 
-	trace_mark(ext4_allocate_blocks,
-		   "dev %s block %llu flags %u len %u ino %lu "
-		   "logical %llu goal %llu lleft %llu lright %llu "
-		   "pleft %llu pright %llu ",
-		   sb->s_id, (unsigned long long) block,
-		   ar->flags, ar->len, ar->inode ? ar->inode->i_ino : 0,
-		   (unsigned long long) ar->logical,
-		   (unsigned long long) ar->goal,
-		   (unsigned long long) ar->lleft,
-		   (unsigned long long) ar->lright,
-		   (unsigned long long) ar->pleft,
-		   (unsigned long long) ar->pright);
+	trace_ext4_allocate_blocks(ar, (unsigned long long)block);
 
 	return block;
 }
@@ -4805,10 +4785,7 @@ void ext4_mb_free_blocks(handle_t *handl
 	}
 
 	ext4_debug("freeing block %lu\n", block);
-	trace_mark(ext4_free_blocks,
-		   "dev %s block %llu count %lu metadata %d ino %lu",
-		   sb->s_id, (unsigned long long) block, count, metadata,
-		   inode ? inode->i_ino : 0);
+	trace_ext4_free_blocks(inode, block, count, metadata);
 
 	ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS);
 	if (ac) {
Index: linux-2.6-lttng/fs/ext4/mballoc.h
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/mballoc.h	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/mballoc.h	2009-03-05 15:49:28.000000000 -0500
@@ -19,8 +19,8 @@
 #include <linux/seq_file.h>
 #include <linux/version.h>
 #include <linux/blkdev.h>
-#include <linux/marker.h>
 #include <linux/mutex.h>
+#include <trace/ext4.h>
 #include "ext4_jbd2.h"
 #include "ext4.h"
 #include "group.h"
Index: linux-2.6-lttng/fs/ext4/super.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/super.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/super.c	2009-03-05 15:49:28.000000000 -0500
@@ -35,9 +35,9 @@
 #include <linux/quotaops.h>
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
-#include <linux/marker.h>
 #include <linux/log2.h>
 #include <linux/crc16.h>
+#include <trace/ext4.h>
 #include <asm/uaccess.h>
 
 #include "ext4.h"
@@ -47,6 +47,8 @@
 #include "namei.h"
 #include "group.h"
 
+DEFINE_TRACE(ext4_sync_fs);
+
 struct proc_dir_entry *ext4_proc_root;
 
 static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
@@ -3048,7 +3050,7 @@ static int ext4_sync_fs(struct super_blo
 	int ret = 0;
 	tid_t target;
 
-	trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
+	trace_ext4_sync_fs(sb, wait);
 	sb->s_dirt = 0;
 	if (EXT4_SB(sb)->s_journal) {
 		if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal,
Index: linux-2.6-lttng/include/trace/ext4.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-lttng/include/trace/ext4.h	2009-03-05 15:49:28.000000000 -0500
@@ -0,0 +1,129 @@
+#ifndef _TRACE_EXT4_H
+#define _TRACE_EXT4_H
+
+#include <linux/tracepoint.h>
+
+struct ext4_free_data;
+struct ext4_prealloc_space;
+struct ext4_allocation_context;
+struct ext4_allocation_request;
+
+DECLARE_TRACE(ext4_free_inode,
+	TPPROTO(struct inode *inode),
+		TPARGS(inode));
+
+DECLARE_TRACE(ext4_request_inode,
+	TPPROTO(struct inode *dir, int mode),
+		TPARGS(dir, mode));
+
+DECLARE_TRACE(ext4_allocate_inode,
+	TPPROTO(struct inode *inode, struct inode *dir, int mode),
+		TPARGS(inode, dir, mode));
+
+DECLARE_TRACE(ext4_write_begin,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int flags),
+		TPARGS(inode, pos, len, flags));
+
+DECLARE_TRACE(ext4_ordered_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_writeback_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_journalled_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_da_writepage,
+	TPPROTO(struct inode *inode, struct page *page),
+		TPARGS(inode, page));
+
+DECLARE_TRACE(ext4_da_writepages,
+	TPPROTO(struct inode *inode, struct writeback_control *wbc),
+		TPARGS(inode, wbc));
+
+DECLARE_TRACE(ext4_da_writepages_result,
+	TPPROTO(struct inode *inode, struct writeback_control *wbc,
+			int ret, int pages_written),
+		TPARGS(inode, wbc, ret, pages_written));
+
+DECLARE_TRACE(ext4_da_write_begin,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int flags),
+		TPARGS(inode, pos, len, flags));
+
+DECLARE_TRACE(ext4_da_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_normal_writepage,
+	TPPROTO(struct inode *inode, struct page *page),
+		TPARGS(inode, page));
+
+DECLARE_TRACE(ext4_journalled_writepage,
+	TPPROTO(struct inode *inode, struct page *page),
+		TPARGS(inode, page));
+
+DECLARE_TRACE(ext4_discard_blocks,
+	TPPROTO(struct super_block *sb, unsigned long long blk,
+			struct ext4_free_data *entry),
+		TPARGS(sb, blk, entry));
+
+DECLARE_TRACE(ext4_mb_new_inode_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa),
+		TPARGS(ac, pa));
+
+DECLARE_TRACE(ext4_mb_new_group_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa),
+		TPARGS(ac, pa));
+
+DECLARE_TRACE(ext4_mb_release_inode_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa,
+			unsigned long long block, unsigned int count),
+		TPARGS(ac, pa, block, count));
+
+DECLARE_TRACE(ext4_mb_release_group_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa),
+		TPARGS(ac, pa));
+
+DECLARE_TRACE(ext4_discard_preallocations,
+	TPPROTO(struct inode *inode),
+		TPARGS(inode));
+
+DECLARE_TRACE(ext4_mb_discard_preallocations,
+	TPPROTO(struct super_block *sb, int needed),
+		TPARGS(sb, needed));
+
+DECLARE_TRACE(ext4_request_blocks,
+	TPPROTO(struct ext4_allocation_request *ar),
+		TPARGS(ar));
+
+DECLARE_TRACE(ext4_allocate_blocks,
+	TPPROTO(struct ext4_allocation_request *ar, unsigned long long block),
+		TPARGS(ar, block));
+
+DECLARE_TRACE(ext4_free_blocks,
+	TPPROTO(struct inode *inode, unsigned long block, unsigned long count,
+			int metadata),
+		TPARGS(inode, block, count, metadata));
+
+DECLARE_TRACE(ext4_sync_file,
+	TPPROTO(struct file *file, struct dentry *dentry, int datasync),
+		TPARGS(file, dentry, datasync));
+
+DECLARE_TRACE(ext4_sync_fs,
+	TPPROTO(struct super_block *sb, int wait),
+		TPARGS(sb, wait));
+
+#endif

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	ltt-dev@lists.casi.polymtl.ca,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Pekka Paalanen <pq@iki.fi>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Martin Bligh <mbligh@google.com>,
	"Frank Ch. Eigler" <fche@redhat.com>,
	Tom Zanussi <tzanussi@gmail.com>,
	Masami Hiramatsu <mhiramat@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Jason Baron <jbaron@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Jiaying Zhang <jiayingz@google.com>,
	Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>,
	mrubin@google.com, md@google.com
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Theodore Tso <tytso@mit.edu>,
	"Stephen C. Tweedie" <sct@redhat.com>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: [RFC patch 40/41] EXT4: instrumentation with tracepoints
Date: Thu, 05 Mar 2009 17:48:08 -0500	[thread overview]
Message-ID: <20090305225520.692384747@polymtl.ca> (raw)
In-Reply-To: 20090305224728.947235917@polymtl.ca

[-- Attachment #1: ext4-move-from-markers-to-tracepoints.patch --]
[-- Type: text/plain, Size: 20781 bytes --]

Took the instrumentation from "ext4: Add markers for better debuggability" and
moved it to tracepoints.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Theodore Ts'o <tytso@mit.edu>
CC: Stephen C. Tweedie <sct@redhat.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Ext4 Developers List <linux-ext4@vger.kernel.org>
---
 fs/ext4/fsync.c      |    8 +--
 fs/ext4/ialloc.c     |   17 +++---
 fs/ext4/inode.c      |   79 +++++++++----------------------
 fs/ext4/mballoc.c    |   71 +++++++++-------------------
 fs/ext4/mballoc.h    |    2 
 fs/ext4/super.c      |    6 +-
 include/trace/ext4.h |  129 +++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 194 insertions(+), 118 deletions(-)

Index: linux-2.6-lttng/fs/ext4/fsync.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/fsync.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/fsync.c	2009-03-05 15:49:28.000000000 -0500
@@ -28,10 +28,12 @@
 #include <linux/writeback.h>
 #include <linux/jbd2.h>
 #include <linux/blkdev.h>
-#include <linux/marker.h>
+#include <trace/ext4.h>
 #include "ext4.h"
 #include "ext4_jbd2.h"
 
+DEFINE_TRACE(ext4_sync_file);
+
 /*
  * akpm: A new design for ext4_sync_file().
  *
@@ -52,9 +54,7 @@ int ext4_sync_file(struct file *file, st
 
 	J_ASSERT(ext4_journal_current_handle() == NULL);
 
-	trace_mark(ext4_sync_file, "dev %s datasync %d ino %ld parent %ld",
-		   inode->i_sb->s_id, datasync, inode->i_ino,
-		   dentry->d_parent->d_inode->i_ino);
+	trace_ext4_sync_file(file, dentry, datasync);
 
 	/*
 	 * data=writeback:
Index: linux-2.6-lttng/fs/ext4/ialloc.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/ialloc.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/ialloc.c	2009-03-05 15:49:28.000000000 -0500
@@ -22,6 +22,7 @@
 #include <linux/random.h>
 #include <linux/bitops.h>
 #include <linux/blkdev.h>
+#include <trace/ext4.h>
 #include <asm/byteorder.h>
 #include "ext4.h"
 #include "ext4_jbd2.h"
@@ -29,6 +30,10 @@
 #include "acl.h"
 #include "group.h"
 
+DEFINE_TRACE(ext4_free_inode);
+DEFINE_TRACE(ext4_request_inode);
+DEFINE_TRACE(ext4_allocate_inode);
+
 /*
  * ialloc.c contains the inodes allocation and deallocation routines
  */
@@ -210,11 +215,7 @@ void ext4_free_inode(handle_t *handle, s
 
 	ino = inode->i_ino;
 	ext4_debug("freeing inode %lu\n", ino);
-	trace_mark(ext4_free_inode,
-		   "dev %s ino %lu mode %d uid %lu gid %lu bocks %llu",
-		   sb->s_id, inode->i_ino, inode->i_mode,
-		   (unsigned long) inode->i_uid, (unsigned long) inode->i_gid,
-		   (unsigned long long) inode->i_blocks);
+	trace_ext4_free_inode(inode);
 
 	/*
 	 * Note: we must free any quota before locking the superblock,
@@ -703,8 +704,7 @@ struct inode *ext4_new_inode(handle_t *h
 		return ERR_PTR(-EPERM);
 
 	sb = dir->i_sb;
-	trace_mark(ext4_request_inode, "dev %s dir %lu mode %d", sb->s_id,
-		   dir->i_ino, mode);
+	trace_ext4_request_inode(dir, mode);
 	inode = new_inode(sb);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
@@ -939,8 +939,7 @@ got:
 	}
 
 	ext4_debug("allocating inode %lu\n", inode->i_ino);
-	trace_mark(ext4_allocate_inode, "dev %s ino %lu dir %lu mode %d",
-		   sb->s_id, inode->i_ino, dir->i_ino, mode);
+	trace_ext4_allocate_inode(inode, dir, mode);
 	goto really_out;
 fail:
 	ext4_std_error(sb, err);
Index: linux-2.6-lttng/fs/ext4/inode.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/inode.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/inode.c	2009-03-05 15:49:28.000000000 -0500
@@ -37,11 +37,24 @@
 #include <linux/namei.h>
 #include <linux/uio.h>
 #include <linux/bio.h>
+#include <trace/ext4.h>
 #include "ext4_jbd2.h"
 #include "xattr.h"
 #include "acl.h"
 #include "ext4_extents.h"
 
+DEFINE_TRACE(ext4_write_begin);
+DEFINE_TRACE(ext4_ordered_write_end);
+DEFINE_TRACE(ext4_writeback_write_end);
+DEFINE_TRACE(ext4_journalled_write_end);
+DEFINE_TRACE(ext4_da_writepage);
+DEFINE_TRACE(ext4_da_writepages);
+DEFINE_TRACE(ext4_da_writepages_result);
+DEFINE_TRACE(ext4_da_write_begin);
+DEFINE_TRACE(ext4_da_write_end);
+DEFINE_TRACE(ext4_normal_writepage);
+DEFINE_TRACE(ext4_journalled_writepage);
+
 #define MPAGE_DA_EXTENT_TAIL 0x01
 
 static inline int ext4_begin_ordered_truncate(struct inode *inode,
@@ -1353,10 +1366,7 @@ static int ext4_write_begin(struct file 
  	pgoff_t index;
 	unsigned from, to;
 
-	trace_mark(ext4_write_begin,
-		   "dev %s ino %lu pos %llu len %u flags %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, flags);
+	trace_ext4_write_begin(inode, pos, len, flags);
  	index = pos >> PAGE_CACHE_SHIFT;
 	from = pos & (PAGE_CACHE_SIZE - 1);
 	to = from + len;
@@ -1432,10 +1442,7 @@ static int ext4_ordered_write_end(struct
 	struct inode *inode = mapping->host;
 	int ret = 0, ret2;
 
-	trace_mark(ext4_ordered_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_ordered_write_end(inode, pos, len, copied);
 	ret = ext4_jbd2_file_inode(handle, inode);
 
 	if (ret == 0) {
@@ -1474,10 +1481,7 @@ static int ext4_writeback_write_end(stru
 	int ret = 0, ret2;
 	loff_t new_i_size;
 
-	trace_mark(ext4_writeback_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_writeback_write_end(inode, pos, len, copied);
 	new_i_size = pos + copied;
 	if (new_i_size > EXT4_I(inode)->i_disksize) {
 		ext4_update_i_disksize(inode, new_i_size);
@@ -1513,10 +1517,7 @@ static int ext4_journalled_write_end(str
 	unsigned from, to;
 	loff_t new_i_size;
 
-	trace_mark(ext4_journalled_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_journalled_write_end(inode, pos, len, copied);
 	from = pos & (PAGE_CACHE_SIZE - 1);
 	to = from + len;
 
@@ -2333,9 +2334,7 @@ static int ext4_da_writepage(struct page
 	struct buffer_head *page_bufs;
 	struct inode *inode = page->mapping->host;
 
-	trace_mark(ext4_da_writepage,
-		   "dev %s ino %lu page_index %lu",
-		   inode->i_sb->s_id, inode->i_ino, page->index);
+	trace_ext4_da_writepage(inode, page);
 	size = i_size_read(inode);
 	if (page->index == size >> PAGE_CACHE_SHIFT)
 		len = size & ~PAGE_CACHE_MASK;
@@ -2447,19 +2446,7 @@ static int ext4_da_writepages(struct add
 	int needed_blocks, ret = 0, nr_to_writebump = 0;
 	struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
 
-	trace_mark(ext4_da_writepages,
-		   "dev %s ino %lu nr_t_write %ld "
-		   "pages_skipped %ld range_start %llu "
-		   "range_end %llu nonblocking %d "
-		   "for_kupdate %d for_reclaim %d "
-		   "for_writepages %d range_cyclic %d",
-		   inode->i_sb->s_id, inode->i_ino,
-		   wbc->nr_to_write, wbc->pages_skipped,
-		   (unsigned long long) wbc->range_start,
-		   (unsigned long long) wbc->range_end,
-		   wbc->nonblocking, wbc->for_kupdate,
-		   wbc->for_reclaim, wbc->for_writepages,
-		   wbc->range_cyclic);
+	trace_ext4_da_writepages(inode, wbc);
 
 	/*
 	 * No pages to write? This is mainly a kludge to avoid starting
@@ -2595,14 +2582,7 @@ out_writepages:
 	if (!no_nrwrite_index_update)
 		wbc->no_nrwrite_index_update = 0;
 	wbc->nr_to_write -= nr_to_writebump;
-	trace_mark(ext4_da_writepage_result,
-		   "dev %s ino %lu ret %d pages_written %d "
-		   "pages_skipped %ld congestion %d "
-		   "more_io %d no_nrwrite_index_update %d",
-		   inode->i_sb->s_id, inode->i_ino, ret,
-		   pages_written, wbc->pages_skipped,
-		   wbc->encountered_congestion, wbc->more_io,
-		   wbc->no_nrwrite_index_update);
+	trace_ext4_da_writepages_result(inode, wbc, ret, pages_written);
 	return ret;
 }
 
@@ -2654,11 +2634,7 @@ static int ext4_da_write_begin(struct fi
 					len, flags, pagep, fsdata);
 	}
 	*fsdata = (void *)0;
-
-	trace_mark(ext4_da_write_begin,
-		   "dev %s ino %lu pos %llu len %u flags %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, flags);
+	trace_ext4_da_write_begin(inode, pos, len, flags);
 retry:
 	/*
 	 * With delayed allocation, we don't log the i_disksize update
@@ -2751,10 +2727,7 @@ static int ext4_da_write_end(struct file
 		}
 	}
 
-	trace_mark(ext4_da_write_end,
-		   "dev %s ino %lu pos %llu len %u copied %u",
-		   inode->i_sb->s_id, inode->i_ino,
-		   (unsigned long long) pos, len, copied);
+	trace_ext4_da_write_end(inode, pos, len, copied);
 	start = pos & (PAGE_CACHE_SIZE - 1);
 	end = start + copied - 1;
 
@@ -2965,9 +2938,7 @@ static int ext4_normal_writepage(struct 
 	loff_t size = i_size_read(inode);
 	loff_t len;
 
-	trace_mark(ext4_normal_writepage,
-		   "dev %s ino %lu page_index %lu",
-		   inode->i_sb->s_id, inode->i_ino, page->index);
+	trace_ext4_normal_writepage(inode, page);
 	J_ASSERT(PageLocked(page));
 	if (page->index == size >> PAGE_CACHE_SHIFT)
 		len = size & ~PAGE_CACHE_MASK;
@@ -3053,9 +3024,7 @@ static int ext4_journalled_writepage(str
 	loff_t size = i_size_read(inode);
 	loff_t len;
 
-	trace_mark(ext4_journalled_writepage,
-		   "dev %s ino %lu page_index %lu",
-		   inode->i_sb->s_id, inode->i_ino, page->index);
+	trace_ext4_journalled_writepage(inode, page);
 	J_ASSERT(PageLocked(page));
 	if (page->index == size >> PAGE_CACHE_SHIFT)
 		len = size & ~PAGE_CACHE_MASK;
Index: linux-2.6-lttng/fs/ext4/mballoc.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/mballoc.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/mballoc.c	2009-03-05 15:49:28.000000000 -0500
@@ -343,6 +343,17 @@ static void release_blocks_on_commit(jou
 
 
 
+DEFINE_TRACE(ext4_discard_blocks);
+DEFINE_TRACE(ext4_mb_new_inode_pa);
+DEFINE_TRACE(ext4_mb_new_group_pa);
+DEFINE_TRACE(ext4_mb_release_inode_pa);
+DEFINE_TRACE(ext4_mb_release_group_pa);
+DEFINE_TRACE(ext4_discard_preallocations);
+DEFINE_TRACE(ext4_mb_discard_preallocations);
+DEFINE_TRACE(ext4_request_blocks);
+DEFINE_TRACE(ext4_allocate_blocks);
+DEFINE_TRACE(ext4_free_blocks);
+
 static inline void *mb_correct_addr_and_bit(int *bit, void *addr)
 {
 #if BITS_PER_LONG == 64
@@ -2878,9 +2889,8 @@ static void release_blocks_on_commit(jou
 		discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb)
 			+ entry->start_blk
 			+ le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
-		trace_mark(ext4_discard_blocks, "dev %s blk %llu count %u",
-			   sb->s_id, (unsigned long long) discard_block,
-			   entry->count);
+		trace_ext4_discard_blocks(sb, (unsigned long long)discard_block,
+					  entry);
 		sb_issue_discard(sb, discard_block, entry->count);
 
 		kmem_cache_free(ext4_free_ext_cachep, entry);
@@ -3700,10 +3710,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat
 
 	mb_debug("new inode pa %p: %llu/%u for %u\n", pa,
 			pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-	trace_mark(ext4_mb_new_inode_pa,
-		   "dev %s ino %lu pstart %llu len %u lstart %u",
-		   sb->s_id, ac->ac_inode->i_ino,
-		   pa->pa_pstart, pa->pa_len, pa->pa_lstart);
+	trace_ext4_mb_new_inode_pa(ac, pa);
 
 	ext4_mb_use_inode_pa(ac, pa);
 	atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated);
@@ -3762,9 +3769,8 @@ ext4_mb_new_group_pa(struct ext4_allocat
 	pa->pa_linear = 1;
 
 	mb_debug("new group pa %p: %llu/%u for %u\n", pa,
-		 pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-	trace_mark(ext4_mb_new_group_pa, "dev %s pstart %llu len %u lstart %u",
-		   sb->s_id, pa->pa_pstart, pa->pa_len, pa->pa_lstart);
+			pa->pa_pstart, pa->pa_len, pa->pa_lstart);
+	trace_ext4_mb_new_group_pa(ac, pa);
 
 	ext4_mb_use_group_pa(ac, pa);
 	atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated);
@@ -3854,10 +3860,8 @@ ext4_mb_release_inode_pa(struct ext4_bud
 			ext4_mb_store_history(ac);
 		}
 
-		trace_mark(ext4_mb_release_inode_pa,
-			   "dev %s ino %lu block %llu count %u",
-			   sb->s_id, pa->pa_inode->i_ino, grp_blk_start + bit,
-			   next - bit);
+		trace_ext4_mb_release_inode_pa(ac, pa, grp_blk_start + bit,
+					       next - bit);
 		mb_free_blocks(pa->pa_inode, e4b, bit, next - bit);
 		bit = next + 1;
 	}
@@ -3891,8 +3895,7 @@ ext4_mb_release_group_pa(struct ext4_bud
 	if (ac)
 		ac->ac_op = EXT4_MB_HISTORY_DISCARD;
 
-	trace_mark(ext4_mb_release_group_pa, "dev %s pstart %llu len %d",
-		   sb->s_id, pa->pa_pstart, pa->pa_len);
+	trace_ext4_mb_release_group_pa(ac, pa);
 	BUG_ON(pa->pa_deleted == 0);
 	ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
 	BUG_ON(group != e4b->bd_group && pa->pa_len != 0);
@@ -4058,8 +4061,7 @@ void ext4_discard_preallocations(struct 
 	}
 
 	mb_debug("discard preallocation for inode %lu\n", inode->i_ino);
-	trace_mark(ext4_discard_preallocations, "dev %s ino %lu", sb->s_id,
-		   inode->i_ino);
+	trace_ext4_discard_preallocations(inode);
 
 	INIT_LIST_HEAD(&list);
 
@@ -4515,8 +4517,7 @@ static int ext4_mb_discard_preallocation
 	int ret;
 	int freed = 0;
 
-	trace_mark(ext4_mb_discard_preallocations, "dev %s needed %d",
-		   sb->s_id, needed);
+	trace_ext4_mb_discard_preallocations(sb, needed);
 	for (i = 0; i < EXT4_SB(sb)->s_groups_count && needed > 0; i++) {
 		ret = ext4_mb_discard_group_preallocations(sb, i, needed);
 		freed += ret;
@@ -4545,17 +4546,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t
 	sb = ar->inode->i_sb;
 	sbi = EXT4_SB(sb);
 
-	trace_mark(ext4_request_blocks, "dev %s flags %u len %u ino %lu "
-		   "lblk %llu goal %llu lleft %llu lright %llu "
-		   "pleft %llu pright %llu ",
-		   sb->s_id, ar->flags, ar->len,
-		   ar->inode ? ar->inode->i_ino : 0,
-		   (unsigned long long) ar->logical,
-		   (unsigned long long) ar->goal,
-		   (unsigned long long) ar->lleft,
-		   (unsigned long long) ar->lright,
-		   (unsigned long long) ar->pleft,
-		   (unsigned long long) ar->pright);
+	trace_ext4_request_blocks(ar);
 
 	if (!EXT4_I(ar->inode)->i_delalloc_reserved_flag) {
 		/*
@@ -4659,18 +4650,7 @@ out3:
 						reserv_blks);
 	}
 
-	trace_mark(ext4_allocate_blocks,
-		   "dev %s block %llu flags %u len %u ino %lu "
-		   "logical %llu goal %llu lleft %llu lright %llu "
-		   "pleft %llu pright %llu ",
-		   sb->s_id, (unsigned long long) block,
-		   ar->flags, ar->len, ar->inode ? ar->inode->i_ino : 0,
-		   (unsigned long long) ar->logical,
-		   (unsigned long long) ar->goal,
-		   (unsigned long long) ar->lleft,
-		   (unsigned long long) ar->lright,
-		   (unsigned long long) ar->pleft,
-		   (unsigned long long) ar->pright);
+	trace_ext4_allocate_blocks(ar, (unsigned long long)block);
 
 	return block;
 }
@@ -4805,10 +4785,7 @@ void ext4_mb_free_blocks(handle_t *handl
 	}
 
 	ext4_debug("freeing block %lu\n", block);
-	trace_mark(ext4_free_blocks,
-		   "dev %s block %llu count %lu metadata %d ino %lu",
-		   sb->s_id, (unsigned long long) block, count, metadata,
-		   inode ? inode->i_ino : 0);
+	trace_ext4_free_blocks(inode, block, count, metadata);
 
 	ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS);
 	if (ac) {
Index: linux-2.6-lttng/fs/ext4/mballoc.h
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/mballoc.h	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/mballoc.h	2009-03-05 15:49:28.000000000 -0500
@@ -19,8 +19,8 @@
 #include <linux/seq_file.h>
 #include <linux/version.h>
 #include <linux/blkdev.h>
-#include <linux/marker.h>
 #include <linux/mutex.h>
+#include <trace/ext4.h>
 #include "ext4_jbd2.h"
 #include "ext4.h"
 #include "group.h"
Index: linux-2.6-lttng/fs/ext4/super.c
===================================================================
--- linux-2.6-lttng.orig/fs/ext4/super.c	2009-03-05 15:21:54.000000000 -0500
+++ linux-2.6-lttng/fs/ext4/super.c	2009-03-05 15:49:28.000000000 -0500
@@ -35,9 +35,9 @@
 #include <linux/quotaops.h>
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
-#include <linux/marker.h>
 #include <linux/log2.h>
 #include <linux/crc16.h>
+#include <trace/ext4.h>
 #include <asm/uaccess.h>
 
 #include "ext4.h"
@@ -47,6 +47,8 @@
 #include "namei.h"
 #include "group.h"
 
+DEFINE_TRACE(ext4_sync_fs);
+
 struct proc_dir_entry *ext4_proc_root;
 
 static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
@@ -3048,7 +3050,7 @@ static int ext4_sync_fs(struct super_blo
 	int ret = 0;
 	tid_t target;
 
-	trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
+	trace_ext4_sync_fs(sb, wait);
 	sb->s_dirt = 0;
 	if (EXT4_SB(sb)->s_journal) {
 		if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal,
Index: linux-2.6-lttng/include/trace/ext4.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-lttng/include/trace/ext4.h	2009-03-05 15:49:28.000000000 -0500
@@ -0,0 +1,129 @@
+#ifndef _TRACE_EXT4_H
+#define _TRACE_EXT4_H
+
+#include <linux/tracepoint.h>
+
+struct ext4_free_data;
+struct ext4_prealloc_space;
+struct ext4_allocation_context;
+struct ext4_allocation_request;
+
+DECLARE_TRACE(ext4_free_inode,
+	TPPROTO(struct inode *inode),
+		TPARGS(inode));
+
+DECLARE_TRACE(ext4_request_inode,
+	TPPROTO(struct inode *dir, int mode),
+		TPARGS(dir, mode));
+
+DECLARE_TRACE(ext4_allocate_inode,
+	TPPROTO(struct inode *inode, struct inode *dir, int mode),
+		TPARGS(inode, dir, mode));
+
+DECLARE_TRACE(ext4_write_begin,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int flags),
+		TPARGS(inode, pos, len, flags));
+
+DECLARE_TRACE(ext4_ordered_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_writeback_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_journalled_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_da_writepage,
+	TPPROTO(struct inode *inode, struct page *page),
+		TPARGS(inode, page));
+
+DECLARE_TRACE(ext4_da_writepages,
+	TPPROTO(struct inode *inode, struct writeback_control *wbc),
+		TPARGS(inode, wbc));
+
+DECLARE_TRACE(ext4_da_writepages_result,
+	TPPROTO(struct inode *inode, struct writeback_control *wbc,
+			int ret, int pages_written),
+		TPARGS(inode, wbc, ret, pages_written));
+
+DECLARE_TRACE(ext4_da_write_begin,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int flags),
+		TPARGS(inode, pos, len, flags));
+
+DECLARE_TRACE(ext4_da_write_end,
+	TPPROTO(struct inode *inode, loff_t pos, unsigned int len,
+			unsigned int copied),
+		TPARGS(inode, pos, len, copied));
+
+DECLARE_TRACE(ext4_normal_writepage,
+	TPPROTO(struct inode *inode, struct page *page),
+		TPARGS(inode, page));
+
+DECLARE_TRACE(ext4_journalled_writepage,
+	TPPROTO(struct inode *inode, struct page *page),
+		TPARGS(inode, page));
+
+DECLARE_TRACE(ext4_discard_blocks,
+	TPPROTO(struct super_block *sb, unsigned long long blk,
+			struct ext4_free_data *entry),
+		TPARGS(sb, blk, entry));
+
+DECLARE_TRACE(ext4_mb_new_inode_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa),
+		TPARGS(ac, pa));
+
+DECLARE_TRACE(ext4_mb_new_group_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa),
+		TPARGS(ac, pa));
+
+DECLARE_TRACE(ext4_mb_release_inode_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa,
+			unsigned long long block, unsigned int count),
+		TPARGS(ac, pa, block, count));
+
+DECLARE_TRACE(ext4_mb_release_group_pa,
+	TPPROTO(struct ext4_allocation_context *ac,
+			struct ext4_prealloc_space *pa),
+		TPARGS(ac, pa));
+
+DECLARE_TRACE(ext4_discard_preallocations,
+	TPPROTO(struct inode *inode),
+		TPARGS(inode));
+
+DECLARE_TRACE(ext4_mb_discard_preallocations,
+	TPPROTO(struct super_block *sb, int needed),
+		TPARGS(sb, needed));
+
+DECLARE_TRACE(ext4_request_blocks,
+	TPPROTO(struct ext4_allocation_request *ar),
+		TPARGS(ar));
+
+DECLARE_TRACE(ext4_allocate_blocks,
+	TPPROTO(struct ext4_allocation_request *ar, unsigned long long block),
+		TPARGS(ar, block));
+
+DECLARE_TRACE(ext4_free_blocks,
+	TPPROTO(struct inode *inode, unsigned long block, unsigned long count,
+			int metadata),
+		TPARGS(inode, block, count, metadata));
+
+DECLARE_TRACE(ext4_sync_file,
+	TPPROTO(struct file *file, struct dentry *dentry, int datasync),
+		TPARGS(file, dentry, datasync));
+
+DECLARE_TRACE(ext4_sync_fs,
+	TPPROTO(struct super_block *sb, int wait),
+		TPARGS(sb, wait));
+
+#endif

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  parent reply	other threads:[~2009-03-05 23:38 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05 22:47 [RFC patch 00/41] LTTng 0.105 core for Linux 2.6.27-rc9 Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 01/41] LTTng - core header Mathieu Desnoyers
2009-03-06 18:37   ` Steven Rostedt
2009-03-05 22:47 ` [RFC patch 02/41] LTTng - core data structures Mathieu Desnoyers
2009-03-06 18:41   ` Steven Rostedt
2009-03-05 22:47 ` [RFC patch 03/41] LTTng core x86 Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 04/41] LTTng core powerpc Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 05/41] LTTng relay buffer allocation, read, write Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 06/41] LTTng optimize write to page function Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 07/41] LTTng dynamic channels Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 08/41] LTTng - tracer header Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 09/41] LTTng optimize write to page function deal with unaligned access Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 10/41] lttng-optimize-write-to-page-function-remove-some-memcpy-calls Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 11/41] ltt-relay: cache pages address Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 12/41] x86 : export vmalloc_sync_all() Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 13/41] LTTng - tracer code Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 14/41] Splice and pipe : export pipe buf operations for GPL modules Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 15/41] Poll : add poll_wait_set_exclusive Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 16/41] LTTng Transport Locked Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 17/41] LTTng - serialization Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 18/41] Seq_file add support for sorted list Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 19/41] Sort module list by pointer address to get coherent sleepable seq_file iterators Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 20/41] Linux Kernel Markers - Iterator Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 21/41] LTTng probes specialized tracepoints Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 22/41] LTTng marker control Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 23/41] Immediate Values Stub header Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 24/41] Linux Kernel Markers - Use Immediate Values Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 25/41] Markers Support for Proprierary Modules Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 26/41] Marers remove old comment Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 27/41] Markers use dynamic channels Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 28/41] LTT trace control Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 29/41] LTTng menus Mathieu Desnoyers
2009-03-05 23:35   ` Randy Dunlap
2009-03-05 23:47     ` Mathieu Desnoyers
2009-03-05 23:51       ` Randy Dunlap
2009-03-06  0:01         ` [ltt-dev] " Mathieu Desnoyers
2009-03-06  0:12           ` Randy Dunlap
2009-03-05 22:47 ` [RFC patch 30/41] LTTng build Mathieu Desnoyers
2009-03-05 22:47 ` [RFC patch 31/41] LTTng userspace event v2 Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 32/41] LTTng filter Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 33/41] LTTng dynamic tracing support with kprobes Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 34/41] Marker header API update Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 35/41] Marker " Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 36/41] kvm markers " Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 37/41] Markers : multi-probes test Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 38/41] Markers examples API update Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 39/41] SPUFS markers " Mathieu Desnoyers
2009-03-05 22:48 ` Mathieu Desnoyers [this message]
2009-03-05 22:48   ` [RFC patch 40/41] EXT4: instrumentation with tracepoints Mathieu Desnoyers
2009-03-05 22:48 ` [RFC patch 41/41] JBD2: use tracepoints for instrumentation Mathieu Desnoyers
2009-03-05 22:48   ` Mathieu Desnoyers
2009-03-06 10:11 ` [RFC patch 00/41] LTTng 0.105 core for Linux 2.6.27-rc9 Ingo Molnar
2009-03-06 19:02   ` Mathieu Desnoyers
2009-03-11 18:32     ` Ingo Molnar
2009-03-13 16:18       ` Mathieu Desnoyers
2009-03-14 16:43         ` Ingo Molnar
2009-03-14 16:59           ` [ltt-dev] " Mathieu Desnoyers
2009-03-06 18:34 ` Steven Rostedt
2009-03-06 19:01   ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090305225520.692384747@polymtl.ca \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.o \
    --cc=sct@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.