Commit b5eb34c3 authored by Li Zefan's avatar Li Zefan Committed by Ingo Molnar

tracing: Convert some ext4 events to DEFINE_TRACE

Use DECLARE_EVENT_CLASS to remove duplicate code:

   text    data     bss     dec     hex filename
 294695    6104     340  301139   49853 fs/ext4/ext4.o.old
 289983    6104     324  296411   485db fs/ext4/ext4.o

5 events are convertd:

  ext4__write_begin: ext4_write_begin, ext4_da_write_begin
  ext4__write_end: ext4_{ordered, writeback, journalled}_write_end

No change in functionality.
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4B0E2938.2040708@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 071688f3
...@@ -90,7 +90,7 @@ TRACE_EVENT(ext4_allocate_inode, ...@@ -90,7 +90,7 @@ TRACE_EVENT(ext4_allocate_inode,
(unsigned long) __entry->dir, __entry->mode) (unsigned long) __entry->dir, __entry->mode)
); );
TRACE_EVENT(ext4_write_begin, DECLARE_EVENT_CLASS(ext4__write_begin,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int flags), unsigned int flags),
...@@ -118,7 +118,23 @@ TRACE_EVENT(ext4_write_begin, ...@@ -118,7 +118,23 @@ TRACE_EVENT(ext4_write_begin,
__entry->pos, __entry->len, __entry->flags) __entry->pos, __entry->len, __entry->flags)
); );
TRACE_EVENT(ext4_ordered_write_end, DEFINE_EVENT(ext4__write_begin, ext4_write_begin,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int flags),
TP_ARGS(inode, pos, len, flags)
);
DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int flags),
TP_ARGS(inode, pos, len, flags)
);
DECLARE_EVENT_CLASS(ext4__write_end,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int copied), unsigned int copied),
...@@ -145,57 +161,36 @@ TRACE_EVENT(ext4_ordered_write_end, ...@@ -145,57 +161,36 @@ TRACE_EVENT(ext4_ordered_write_end,
__entry->pos, __entry->len, __entry->copied) __entry->pos, __entry->len, __entry->copied)
); );
TRACE_EVENT(ext4_writeback_write_end, DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int copied), unsigned int copied),
TP_ARGS(inode, pos, len, copied), TP_ARGS(inode, pos, len, copied)
);
TP_STRUCT__entry( DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
__field( dev_t, dev )
__field( ino_t, ino )
__field( loff_t, pos )
__field( unsigned int, len )
__field( unsigned int, copied )
),
TP_fast_assign( TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
__entry->dev = inode->i_sb->s_dev; unsigned int copied),
__entry->ino = inode->i_ino;
__entry->pos = pos;
__entry->len = len;
__entry->copied = copied;
),
TP_printk("dev %s ino %lu pos %llu len %u copied %u", TP_ARGS(inode, pos, len, copied)
jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
__entry->pos, __entry->len, __entry->copied)
); );
TRACE_EVENT(ext4_journalled_write_end, DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int copied), unsigned int copied),
TP_ARGS(inode, pos, len, copied),
TP_STRUCT__entry( TP_ARGS(inode, pos, len, copied)
__field( dev_t, dev ) );
__field( ino_t, ino )
__field( loff_t, pos )
__field( unsigned int, len )
__field( unsigned int, copied )
),
TP_fast_assign( DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
__entry->dev = inode->i_sb->s_dev;
__entry->ino = inode->i_ino;
__entry->pos = pos;
__entry->len = len;
__entry->copied = copied;
),
TP_printk("dev %s ino %lu pos %llu len %u copied %u", TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, unsigned int copied),
__entry->pos, __entry->len, __entry->copied)
TP_ARGS(inode, pos, len, copied)
); );
TRACE_EVENT(ext4_writepage, TRACE_EVENT(ext4_writepage,
...@@ -337,60 +332,6 @@ TRACE_EVENT(ext4_da_writepages_result, ...@@ -337,60 +332,6 @@ TRACE_EVENT(ext4_da_writepages_result,
(unsigned long) __entry->writeback_index) (unsigned long) __entry->writeback_index)
); );
TRACE_EVENT(ext4_da_write_begin,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int flags),
TP_ARGS(inode, pos, len, flags),
TP_STRUCT__entry(
__field( dev_t, dev )
__field( ino_t, ino )
__field( loff_t, pos )
__field( unsigned int, len )
__field( unsigned int, flags )
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->ino = inode->i_ino;
__entry->pos = pos;
__entry->len = len;
__entry->flags = flags;
),
TP_printk("dev %s ino %lu pos %llu len %u flags %u",
jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
__entry->pos, __entry->len, __entry->flags)
);
TRACE_EVENT(ext4_da_write_end,
TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
unsigned int copied),
TP_ARGS(inode, pos, len, copied),
TP_STRUCT__entry(
__field( dev_t, dev )
__field( ino_t, ino )
__field( loff_t, pos )
__field( unsigned int, len )
__field( unsigned int, copied )
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->ino = inode->i_ino;
__entry->pos = pos;
__entry->len = len;
__entry->copied = copied;
),
TP_printk("dev %s ino %lu pos %llu len %u copied %u",
jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
__entry->pos, __entry->len, __entry->copied)
);
TRACE_EVENT(ext4_discard_blocks, TRACE_EVENT(ext4_discard_blocks,
TP_PROTO(struct super_block *sb, unsigned long long blk, TP_PROTO(struct super_block *sb, unsigned long long blk,
unsigned long long count), unsigned long long count),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment