Skip to contentSkip to conversation

jbd2: Convert instrumentation from markers to tracepoints

RFC PATCH In review Theodore Ts'o 3 participants 4 messages Apr 11, 2009 – Apr 13, 2009

Subsystems (3)
lore
Share & tools
lore

Theodore Ts'o

author maintainer
#0 lore raw

RFC PATCH 1/2 jbd2: Convert instrumentation from markers to tracepoints

---
 fs/jbd2/checkpoint.c              |    7 ++-
 fs/jbd2/commit.c                  |   14 +++--
 include/trace/jbd2.h              |    9 ++++
 include/trace/jbd2_event_types.h  |   93 +++++++++++++++++++++++++++++++++++++
 include/trace/trace_event_types.h |    1 +
 include/trace/trace_events.h      |    1 +
 6 files changed, 116 insertions(+), 9 deletions(-)
 create mode 100644 include/trace/jbd2.h
 create mode 100644 include/trace/jbd2_event_types.h
fs/jbd2/checkpoint.c +4 -3
index 17159ca..2b794d9 100644
@@ -20,9 +20,11 @@
 #include <linux/time.h>
 #include <linux/fs.h>
 #include <linux/jbd2.h>
-#include <linux/marker.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
+#include <trace/jbd2.h>
+
+DEFINE_TRACE(jbd2_checkpoint);
 
 /*
  * Unlink a buffer from a transaction checkpoint list.
@@ -358,8 +360,7 @@ int jbd2_log_do_checkpoint(journal_t *journal)
 	 * journal straight away.
 	 */
 	result = jbd2_cleanup_journal_tail(journal);
-	trace_mark(jbd2_checkpoint, "dev %s need_checkpoint %d",
-		   journal->j_devname, result);
+	trace_jbd2_checkpoint(journal, result);
 	jbd_debug(1, "cleanup_journal_tail returned %d\n", result);
 	if (result <= 0)
 		return result;
fs/jbd2/commit.c +8 -6
index 073c8c3..21462a8 100644
@@ -16,7 +16,6 @@
 #include <linux/time.h>
 #include <linux/fs.h>
 #include <linux/jbd2.h>
-#include <linux/marker.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
@@ -26,6 +25,11 @@
 #include <linux/writeback.h>
 #include <linux/backing-dev.h>
 #include <linux/bio.h>
+#include <trace/jbd2.h>
+
+DEFINE_TRACE(jbd2_start_commit);
+DEFINE_TRACE(jbd2_end_commit);
+DEFINE_TRACE(jbd2_submit_inode_data);
 
 /*
  * Default IO end handler for temporary BJ_IO buffer_heads.
@@ -253,6 +257,7 @@ static int journal_submit_data_buffers(journal_t *journal,
 		 * block allocation  with delalloc. We need to write
 		 * only allocated blocks here.
 		 */
+		trace_jbd2_submit_inode_data(jinode->i_vfs_inode);
 		err = journal_submit_inode_data_buffers(mapping);
 		if (!ret)
 			ret = err;
@@ -394,8 +399,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
 	commit_transaction = journal->j_running_transaction;
 	J_ASSERT(commit_transaction->t_state == T_RUNNING);
 
-	trace_mark(jbd2_start_commit, "dev %s transaction %d",
-		   journal->j_devname, commit_transaction->t_tid);
+	trace_jbd2_start_commit(journal, commit_transaction);
 	jbd_debug(1, "JBD: starting commit of transaction %d\n",
 			commit_transaction->t_tid);
 
@@ -1053,9 +1057,7 @@ restart_loop:
 	if (journal->j_commit_callback)
 		journal->j_commit_callback(journal, commit_transaction);
 
-	trace_mark(jbd2_end_commit, "dev %s transaction %d head %d",
-		   journal->j_devname, commit_transaction->t_tid,
-		   journal->j_tail_sequence);
+	trace_jbd2_end_commit(journal, commit_transaction);
 	jbd_debug(1, "JBD: commit %d complete, head %d\n",
 		  journal->j_commit_sequence, journal->j_tail_sequence);
 	if (to_free)
include/trace/jbd2.h new file +9 -0
new file mode 100644
index 0000000..68a93a5
@@ -0,0 +1,9 @@
+#ifndef _TRACE_JBD2_H
+#define _TRACE_JBD2_H
+
+#include <linux/jbd2.h>
+#include <linux/tracepoint.h>
+
+#include <trace/jbd2_event_types.h>
+
+#endif
include/trace/jbd2_event_types.h new file +93 -0

93 lines not on this page · raw message

include/trace/trace_event_types.h +1 -0
index df56f56..bd26f4d 100644
@@ -3,3 +3,4 @@
 #include <trace/sched_event_types.h>
 #include <trace/irq_event_types.h>
 #include <trace/lockdep_event_types.h>
+#include <trace/jbd2_event_types.h>
include/trace/trace_events.h +1 -0
index fd13750..2a9b970 100644
@@ -3,3 +3,4 @@
 #include <trace/sched.h>
 #include <trace/irq.h>
 #include <trace/lockdep.h>
+#include <trace/jbd2.h>
Signature · 1 line
1.5.6.3
author maintainer
#1 lore raw

RFC PATCH 2/2 ext4: Convert instrumentation from markers to tracepoints

---
 fs/ext4/ext4.h                    |   22 +--
 fs/ext4/ext4_i.h                  |   12 -
 fs/ext4/fsync.c                   |    8 +-
 fs/ext4/ialloc.c                  |   17 +-
 fs/ext4/inode.c                   |   79 ++---
 fs/ext4/mballoc.c                 |   84 ++---
 fs/ext4/mballoc.h                 |   68 +----
 fs/ext4/super.c                   |    6 +-
 include/linux/ext4_trace_types.h  |  108 ++++++
 include/trace/ext4.h              |    8 +
 include/trace/ext4_event_types.h  |  690 +++++++++++++++++++++++++++++++++++++
 include/trace/trace_event_types.h |    1 +
 include/trace/trace_events.h      |    1 +
 13 files changed, 886 insertions(+), 218 deletions(-)
 create mode 100644 include/linux/ext4_trace_types.h
 create mode 100644 include/trace/ext4.h
 create mode 100644 include/trace/ext4_event_types.h
fs/ext4/ext4.h +1 -21
index d0f15ef..791da89 100644
@@ -21,6 +21,7 @@
 #include <linux/magic.h>
 #include <linux/jbd2.h>
 #include <linux/quota.h>
+#include <linux/ext4_trace_types.h>
 #include "ext4_i.h"
 
 /*
@@ -70,27 +71,6 @@
 #define EXT4_MB_DELALLOC_RESERVED      1024
 
 
-struct ext4_allocation_request {
-	/* target inode for block we're allocating */
-	struct inode *inode;
-	/* logical block in target inode */
-	ext4_lblk_t logical;
-	/* phys. target (a hint) */
-	ext4_fsblk_t goal;
-	/* the closest logical allocated block to the left */
-	ext4_lblk_t lleft;
-	/* phys. block for ^^^ */
-	ext4_fsblk_t pleft;
-	/* the closest logical allocated block to the right */
-	ext4_lblk_t lright;
-	/* phys. block for ^^^ */
-	ext4_fsblk_t pright;
-	/* how many blocks we want to allocate */
-	unsigned int len;
-	/* flags. see above EXT4_MB_HINT_* */
-	unsigned int flags;
-};
-
 /*
  * Special inodes numbers
  */
fs/ext4/ext4_i.h +0 -12
index 4ce2187..48bf4bd 100644
@@ -21,18 +21,6 @@
 #include <linux/seqlock.h>
 #include <linux/mutex.h>
 
-/* data type for block offset of block group */
-typedef int ext4_grpblk_t;
-
-/* data type for filesystem-wide blocks number */
-typedef unsigned long long ext4_fsblk_t;
-
-/* data type for file logical block number */
-typedef __u32 ext4_lblk_t;
-
-/* data type for block group number */
-typedef unsigned int ext4_group_t;
-
 /*
  * storage for cached extent
  */
fs/ext4/fsync.c +4 -4
index 5afe437..783efcb 100644
@@ -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, struct dentry *dentry, int datasync)
 
 	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:
fs/ext4/ialloc.c +8 -9
index 47b84e8..80288de 100644
@@ -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
  */
@@ -209,11 +214,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
 
 	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,
@@ -817,8 +818,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
 		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);
@@ -1050,8 +1050,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);
fs/ext4/inode.c +24 -55

156 lines not on this page · raw message

fs/ext4/mballoc.c +36 -48

172 lines not on this page · raw message

fs/ext4/mballoc.h +1 -67

92 lines not on this page · raw message

fs/ext4/super.c +4 -2
index 2958f4e..9b77dd1 100644
@@ -36,9 +36,9 @@
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
 #include <linux/ctype.h>
-#include <linux/marker.h>
 #include <linux/log2.h>
 #include <linux/crc16.h>
+#include <trace/ext4.h>
 #include <asm/uaccess.h>
 
 #include "ext4.h"
@@ -48,6 +48,8 @@
 #include "namei.h"
 #include "group.h"
 
+DEFINE_TRACE(ext4_sync_fs);
+
 struct proc_dir_entry *ext4_proc_root;
 static struct kset *ext4_kset;
 
@@ -3287,7 +3289,7 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
 	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,
include/linux/ext4_trace_types.h new file +108 -0

108 lines not on this page · raw message

include/trace/ext4.h new file +8 -0
new file mode 100644
index 0000000..e8d647a
@@ -0,0 +1,8 @@
+#ifndef _TRACE_EXT4_H
+#define _TRACE_EXT4_H
+
+#include <linux/tracepoint.h>
+
+#include <trace/ext4_event_types.h>
+
+#endif
include/trace/ext4_event_types.h new file +690 -0

690 lines not on this page · raw message

include/trace/trace_event_types.h +1 -0
index bd26f4d..26d7aee 100644
@@ -4,3 +4,4 @@
 #include <trace/irq_event_types.h>
 #include <trace/lockdep_event_types.h>
 #include <trace/jbd2_event_types.h>
+#include <trace/ext4_event_types.h>
include/trace/trace_events.h +1 -0
index 2a9b970..ad8f6eb 100644
@@ -4,3 +4,4 @@
 #include <trace/irq.h>
 #include <trace/lockdep.h>
 #include <trace/jbd2.h>
+#include <trace/ext4.h>
Signature · 1 line
1.5.6.3
#2 lore raw

Re: [PATCH, RFC 2/2] ext4: Convert instrumentation from markers to tracepoints

On Sat, Apr 11, 2009 at 03:46:07PM -0400, Theodore Ts'o wrote:
.....
......

Quoted 104 lines
include/linux/ext4_trace_types.h new file +98 -0
new file mode 100644
index 0000000..229a2dd
@@ -0,0 +1,108 @@
+/*
+ * ext4_trace_types.h -- these data structures are needed by the
+ *	tracing infrastructure
+ */
+
+#ifndef _EXT4_TRACE_TYPES_H
+#define _EXT4_TRACE_TYPES_H
+
+/* data type for block offset of block group */
+typedef int ext4_grpblk_t;
+
+/* data type for filesystem-wide blocks number */
+typedef unsigned long long ext4_fsblk_t;
+
+/* data type for file logical block number */
+typedef __u32 ext4_lblk_t;
+
+/* data type for block group number */
+typedef unsigned int ext4_group_t;
+
+struct ext4_allocation_request {
+	/* target inode for block we're allocating */
+	struct inode *inode;
+	/* logical block in target inode */
+	ext4_lblk_t logical;
+	/* phys. target (a hint) */
+	ext4_fsblk_t goal;
+	/* the closest logical allocated block to the left */
+	ext4_lblk_t lleft;
+	/* phys. block for ^^^ */
+	ext4_fsblk_t pleft;
+	/* the closest logical allocated block to the right */
+	ext4_lblk_t lright;
+	/* phys. block for ^^^ */
+	ext4_fsblk_t pright;
+	/* how many blocks we want to allocate */
+	unsigned int len;
+	/* flags. see above EXT4_MB_HINT_* */
+	unsigned int flags;
+};
+
+struct ext4_free_extent {
+	ext4_lblk_t fe_logical;
+	ext4_grpblk_t fe_start;
+	ext4_group_t fe_group;
+	int fe_len;
+};
+
+struct ext4_allocation_context {
+	struct inode *ac_inode;
+	struct super_block *ac_sb;
+
+	/* original request */
+	struct ext4_free_extent ac_o_ex;
+
+	/* goal request (after normalization) */
+	struct ext4_free_extent ac_g_ex;
+
+	/* the best found extent */
+	struct ext4_free_extent ac_b_ex;
+
+	/* copy of the bext found extent taken before preallocation efforts */
+	struct ext4_free_extent ac_f_ex;
+
+	/* number of iterations done. we have to track to limit searching */
+	unsigned long ac_ex_scanned;
+	__u16 ac_groups_scanned;
+	__u16 ac_found;
+	__u16 ac_tail;
+	__u16 ac_buddy;
+	__u16 ac_flags;		/* allocation hints */
+	__u8 ac_status;
+	__u8 ac_criteria;
+	__u8 ac_repeats;
+	__u8 ac_2order;		/* if request is to allocate 2^N blocks and
+				 * N > 0, the field stores N, otherwise 0 */
+	__u8 ac_op;		/* operation, for history only */
+	struct page *ac_bitmap_page;
+	struct page *ac_buddy_page;
+	/*
+	 * pointer to the held semaphore upon successful
+	 * block allocation
+	 */
+	struct rw_semaphore *alloc_semp;
+	struct ext4_prealloc_space *ac_pa;
+	struct ext4_locality_group *ac_lg;
+};
+
+struct ext4_prealloc_space {
+	struct list_head	pa_inode_list;
+	struct list_head	pa_group_list;
+	union {
+		struct list_head pa_tmp_list;
+		struct rcu_head	pa_rcu;
+	} u;
+	spinlock_t		pa_lock;
+	atomic_t		pa_count;
+	unsigned		pa_deleted;

include/linux/ext4_trace_types.h line 108

Quoted 10 lines
include/linux/ext4_trace_types.h new file +10 -0
+	ext4_fsblk_t		pa_pstart;	/* phys. block */
+	ext4_lblk_t		pa_lstart;	/* log. block */
+	unsigned short		pa_len;		/* len of preallocated chunk */
+	unsigned short		pa_free;	/* how many blocks are free */
+	unsigned short		pa_type;	/* pa type. inode or group */
+	spinlock_t		*pa_obj_lock;
+	struct inode		*pa_inode;	/* hack, for history only */
+};
+
+#endif /* _EXT4_TRACE_TYPES_H */

We moved all the ext4 headers to fs/ext4/ Can this be fs/ext4/ext4_trace_types.h ?

-aneesh

#3 lore raw

Re: [PATCH, RFC 2/2] ext4: Convert instrumentation from markers to tracepoints

Quoted 2 lines · Aneesh Kumar K.V

We moved all the ext4 headers to fs/ext4/ Can this be fs/ext4/ext4_trace_types.h ?

With the current event tracer in mainline those files get included into kernel/trace/events.o so it is required to be global. Steve has some patches in his queue to allow TRACE_EVENT to work in modules which losens that requirement. Last time I talked to him he still wants to have the headers in include/trace/ as a policy but I hope we can get away from that.