Skip to content

Commit

Permalink
ext4: convert instrumentation from markers to tracepoints
Browse files Browse the repository at this point in the history
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Theodore Ts'o committed Jun 17, 2009
1 parent 879c5e6 commit 9bffad1
Show file tree
Hide file tree
Showing 7 changed files with 774 additions and 121 deletions.
8 changes: 4 additions & 4 deletions fs/ext4/fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
#include <linux/writeback.h>
#include <linux/jbd2.h>
#include <linux/blkdev.h>
#include <linux/marker.h>

#include "ext4.h"
#include "ext4_jbd2.h"

#include <trace/events/ext4.h>

/*
* akpm: A new design for ext4_sync_file().
*
Expand All @@ -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:
Expand Down
15 changes: 6 additions & 9 deletions fs/ext4/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
#include <linux/bitops.h>
#include <linux/blkdev.h>
#include <asm/byteorder.h>

#include "ext4.h"
#include "ext4_jbd2.h"
#include "xattr.h"
#include "acl.h"

#include <trace/events/ext4.h>

/*
* ialloc.c contains the inodes allocation and deallocation routines
*/
Expand Down Expand Up @@ -208,11 +211,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,
Expand Down Expand Up @@ -815,8 +814,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)

sb = dir->i_sb;
ngroups = ext4_get_groups_count(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);
Expand Down Expand Up @@ -1047,8 +1045,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
}

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);
Expand Down
69 changes: 14 additions & 55 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@
#include <linux/namei.h>
#include <linux/uio.h>
#include <linux/bio.h>

#include "ext4_jbd2.h"
#include "xattr.h"
#include "acl.h"
#include "ext4_extents.h"

#include <trace/events/ext4.h>

#define MPAGE_DA_EXTENT_TAIL 0x01

static inline int ext4_begin_ordered_truncate(struct inode *inode,
Expand Down Expand Up @@ -1466,10 +1469,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
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);
/*
* Reserve one block more for addition to orphan list in case
* we allocate blocks but write fails for some reason
Expand Down Expand Up @@ -1611,10 +1611,7 @@ static int ext4_ordered_write_end(struct file *file,
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) {
Expand Down Expand Up @@ -1658,10 +1655,7 @@ static int ext4_writeback_write_end(struct file *file,
struct inode *inode = mapping->host;
int ret = 0, ret2;

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);
ret2 = ext4_generic_write_end(file, mapping, pos, len, copied,
page, fsdata);
copied = ret2;
Expand Down Expand Up @@ -1705,10 +1699,7 @@ static int ext4_journalled_write_end(struct file *file,
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;

Expand Down Expand Up @@ -2554,9 +2545,7 @@ static int ext4_da_writepage(struct page *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;
Expand Down Expand Up @@ -2667,19 +2656,7 @@ static int ext4_da_writepages(struct address_space *mapping,
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
Expand Down Expand Up @@ -2845,14 +2822,7 @@ static int ext4_da_writepages(struct address_space *mapping,
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;
}

Expand Down Expand Up @@ -2904,11 +2874,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
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
Expand Down Expand Up @@ -3001,10 +2967,7 @@ static int ext4_da_write_end(struct file *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;

Expand Down Expand Up @@ -3255,9 +3218,7 @@ static int ext4_normal_writepage(struct page *page,
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;
Expand Down Expand Up @@ -3343,9 +3304,7 @@ static int ext4_journalled_writepage(struct page *page,
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;
Expand Down
Loading

0 comments on commit 9bffad1

Please sign in to comment.