aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJiaying Zhang <jiayingz@google.com>2011-03-21 21:38:05 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-03-21 21:38:05 -0400
commit0562e0bad483d10e9651fbb8f21dc3d0bad57374 (patch)
tree19f6597f92c028badcb6df360ccac22240378e25 /fs/ext4
parent4596fe07679ff0fae904515691ea747467614871 (diff)
ext4: add more tracepoints and use dev_t in the trace buffer
- Add more ext4 tracepoints. - Change ext4 tracepoints to use dev_t field with MAJOR/MINOR macros so that we can save 4 bytes in the ring buffer on some platforms. - Add sync_mode to ext4_da_writepages, ext4_da_write_pages, and ext4_da_writepages_result tracepoints. Also remove for_reclaim field from ext4_da_writepages since it is usually not very useful. Signed-off-by: Jiaying Zhang <jiayingz@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/balloc.c3
-rw-r--r--fs/ext4/extents.c13
-rw-r--r--fs/ext4/fsync.c14
-rw-r--r--fs/ext4/ialloc.c1
-rw-r--r--fs/ext4/inode.c24
-rw-r--r--fs/ext4/namei.c3
6 files changed, 49 insertions, 9 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index adf96b822781..97b970e7dd13 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -21,6 +21,8 @@
21#include "ext4_jbd2.h" 21#include "ext4_jbd2.h"
22#include "mballoc.h" 22#include "mballoc.h"
23 23
24#include <trace/events/ext4.h>
25
24/* 26/*
25 * balloc.c contains the blocks allocation and deallocation routines 27 * balloc.c contains the blocks allocation and deallocation routines
26 */ 28 */
@@ -342,6 +344,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
342 * We do it here so the bitmap uptodate bit 344 * We do it here so the bitmap uptodate bit
343 * get set with buffer lock held. 345 * get set with buffer lock held.
344 */ 346 */
347 trace_ext4_read_block_bitmap_load(sb, block_group);
345 set_bitmap_uptodate(bh); 348 set_bitmap_uptodate(bh);
346 if (bh_submit_read(bh) < 0) { 349 if (bh_submit_read(bh) < 0) {
347 put_bh(bh); 350 put_bh(bh);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 9ea1bc64ca6d..f46f6e3c02d7 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -44,6 +44,8 @@
44#include "ext4_jbd2.h" 44#include "ext4_jbd2.h"
45#include "ext4_extents.h" 45#include "ext4_extents.h"
46 46
47#include <trace/events/ext4.h>
48
47static int ext4_ext_truncate_extend_restart(handle_t *handle, 49static int ext4_ext_truncate_extend_restart(handle_t *handle,
48 struct inode *inode, 50 struct inode *inode,
49 int needed) 51 int needed)
@@ -664,6 +666,8 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block,
664 if (unlikely(!bh)) 666 if (unlikely(!bh))
665 goto err; 667 goto err;
666 if (!bh_uptodate_or_lock(bh)) { 668 if (!bh_uptodate_or_lock(bh)) {
669 trace_ext4_ext_load_extent(inode, block,
670 path[ppos].p_block);
667 if (bh_submit_read(bh) < 0) { 671 if (bh_submit_read(bh) < 0) {
668 put_bh(bh); 672 put_bh(bh);
669 goto err; 673 goto err;
@@ -3297,7 +3301,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3297 struct ext4_ext_path *path = NULL; 3301 struct ext4_ext_path *path = NULL;
3298 struct ext4_extent_header *eh; 3302 struct ext4_extent_header *eh;
3299 struct ext4_extent newex, *ex; 3303 struct ext4_extent newex, *ex;
3300 ext4_fsblk_t newblock; 3304 ext4_fsblk_t newblock = 0;
3301 int err = 0, depth, ret; 3305 int err = 0, depth, ret;
3302 unsigned int allocated = 0; 3306 unsigned int allocated = 0;
3303 struct ext4_allocation_request ar; 3307 struct ext4_allocation_request ar;
@@ -3305,6 +3309,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3305 3309
3306 ext_debug("blocks %u/%u requested for inode %lu\n", 3310 ext_debug("blocks %u/%u requested for inode %lu\n",
3307 map->m_lblk, map->m_len, inode->i_ino); 3311 map->m_lblk, map->m_len, inode->i_ino);
3312 trace_ext4_ext_map_blocks_enter(inode, map->m_lblk, map->m_len, flags);
3308 3313
3309 /* check in cache */ 3314 /* check in cache */
3310 if (ext4_ext_in_cache(inode, map->m_lblk, &newex)) { 3315 if (ext4_ext_in_cache(inode, map->m_lblk, &newex)) {
@@ -3525,6 +3530,8 @@ out2:
3525 ext4_ext_drop_refs(path); 3530 ext4_ext_drop_refs(path);
3526 kfree(path); 3531 kfree(path);
3527 } 3532 }
3533 trace_ext4_ext_map_blocks_exit(inode, map->m_lblk,
3534 newblock, map->m_len, err ? err : allocated);
3528 return err ? err : allocated; 3535 return err ? err : allocated;
3529} 3536}
3530 3537
@@ -3658,6 +3665,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
3658 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 3665 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
3659 return -EOPNOTSUPP; 3666 return -EOPNOTSUPP;
3660 3667
3668 trace_ext4_fallocate_enter(inode, offset, len, mode);
3661 map.m_lblk = offset >> blkbits; 3669 map.m_lblk = offset >> blkbits;
3662 /* 3670 /*
3663 * We can't just convert len to max_blocks because 3671 * We can't just convert len to max_blocks because
@@ -3673,6 +3681,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
3673 ret = inode_newsize_ok(inode, (len + offset)); 3681 ret = inode_newsize_ok(inode, (len + offset));
3674 if (ret) { 3682 if (ret) {
3675 mutex_unlock(&inode->i_mutex); 3683 mutex_unlock(&inode->i_mutex);
3684 trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
3676 return ret; 3685 return ret;
3677 } 3686 }
3678retry: 3687retry:
@@ -3717,6 +3726,8 @@ retry:
3717 goto retry; 3726 goto retry;
3718 } 3727 }
3719 mutex_unlock(&inode->i_mutex); 3728 mutex_unlock(&inode->i_mutex);
3729 trace_ext4_fallocate_exit(inode, offset, max_blocks,
3730 ret > 0 ? ret2 : ret);
3720 return ret > 0 ? ret2 : ret; 3731 return ret > 0 ? ret2 : ret;
3721} 3732}
3722 3733
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 7829b287822a..7f74019d6d77 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -164,20 +164,20 @@ int ext4_sync_file(struct file *file, int datasync)
164 164
165 J_ASSERT(ext4_journal_current_handle() == NULL); 165 J_ASSERT(ext4_journal_current_handle() == NULL);
166 166
167 trace_ext4_sync_file(file, datasync); 167 trace_ext4_sync_file_enter(file, datasync);
168 168
169 if (inode->i_sb->s_flags & MS_RDONLY) 169 if (inode->i_sb->s_flags & MS_RDONLY)
170 return 0; 170 return 0;
171 171
172 ret = ext4_flush_completed_IO(inode); 172 ret = ext4_flush_completed_IO(inode);
173 if (ret < 0) 173 if (ret < 0)
174 return ret; 174 goto out;
175 175
176 if (!journal) { 176 if (!journal) {
177 ret = generic_file_fsync(file, datasync); 177 ret = generic_file_fsync(file, datasync);
178 if (!ret && !list_empty(&inode->i_dentry)) 178 if (!ret && !list_empty(&inode->i_dentry))
179 ext4_sync_parent(inode); 179 ext4_sync_parent(inode);
180 return ret; 180 goto out;
181 } 181 }
182 182
183 /* 183 /*
@@ -194,8 +194,10 @@ int ext4_sync_file(struct file *file, int datasync)
194 * (they were dirtied by commit). But that's OK - the blocks are 194 * (they were dirtied by commit). But that's OK - the blocks are
195 * safe in-journal, which is all fsync() needs to ensure. 195 * safe in-journal, which is all fsync() needs to ensure.
196 */ 196 */
197 if (ext4_should_journal_data(inode)) 197 if (ext4_should_journal_data(inode)) {
198 return ext4_force_commit(inode->i_sb); 198 ret = ext4_force_commit(inode->i_sb);
199 goto out;
200 }
199 201
200 commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid; 202 commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid;
201 if (jbd2_log_start_commit(journal, commit_tid)) { 203 if (jbd2_log_start_commit(journal, commit_tid)) {
@@ -215,5 +217,7 @@ int ext4_sync_file(struct file *file, int datasync)
215 ret = jbd2_log_wait_commit(journal, commit_tid); 217 ret = jbd2_log_wait_commit(journal, commit_tid);
216 } else if (journal->j_flags & JBD2_BARRIER) 218 } else if (journal->j_flags & JBD2_BARRIER)
217 blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); 219 blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
220 out:
221 trace_ext4_sync_file_exit(inode, ret);
218 return ret; 222 return ret;
219} 223}
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index a679a482c986..254e6b98b5b4 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -152,6 +152,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
152 * We do it here so the bitmap uptodate bit 152 * We do it here so the bitmap uptodate bit
153 * get set with buffer lock held. 153 * get set with buffer lock held.
154 */ 154 */
155 trace_ext4_load_inode_bitmap(sb, block_group);
155 set_bitmap_uptodate(bh); 156 set_bitmap_uptodate(bh);
156 if (bh_submit_read(bh) < 0) { 157 if (bh_submit_read(bh) < 0) {
157 put_bh(bh); 158 put_bh(bh);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fc8c0ce84315..f44307a21136 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -973,6 +973,7 @@ static int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
973 int count = 0; 973 int count = 0;
974 ext4_fsblk_t first_block = 0; 974 ext4_fsblk_t first_block = 0;
975 975
976 trace_ext4_ind_map_blocks_enter(inode, map->m_lblk, map->m_len, flags);
976 J_ASSERT(!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))); 977 J_ASSERT(!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)));
977 J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0); 978 J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0);
978 depth = ext4_block_to_path(inode, map->m_lblk, offsets, 979 depth = ext4_block_to_path(inode, map->m_lblk, offsets,
@@ -1058,6 +1059,8 @@ cleanup:
1058 partial--; 1059 partial--;
1059 } 1060 }
1060out: 1061out:
1062 trace_ext4_ind_map_blocks_exit(inode, map->m_lblk,
1063 map->m_pblk, map->m_len, err);
1061 return err; 1064 return err;
1062} 1065}
1063 1066
@@ -3379,6 +3382,7 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
3379 3382
3380static int ext4_readpage(struct file *file, struct page *page) 3383static int ext4_readpage(struct file *file, struct page *page)
3381{ 3384{
3385 trace_ext4_readpage(page);
3382 return mpage_readpage(page, ext4_get_block); 3386 return mpage_readpage(page, ext4_get_block);
3383} 3387}
3384 3388
@@ -3413,6 +3417,8 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset)
3413{ 3417{
3414 journal_t *journal = EXT4_JOURNAL(page->mapping->host); 3418 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
3415 3419
3420 trace_ext4_invalidatepage(page, offset);
3421
3416 /* 3422 /*
3417 * free any io_end structure allocated for buffers to be discarded 3423 * free any io_end structure allocated for buffers to be discarded
3418 */ 3424 */
@@ -3434,6 +3440,8 @@ static int ext4_releasepage(struct page *page, gfp_t wait)
3434{ 3440{
3435 journal_t *journal = EXT4_JOURNAL(page->mapping->host); 3441 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
3436 3442
3443 trace_ext4_releasepage(page);
3444
3437 WARN_ON(PageChecked(page)); 3445 WARN_ON(PageChecked(page));
3438 if (!page_has_buffers(page)) 3446 if (!page_has_buffers(page))
3439 return 0; 3447 return 0;
@@ -3792,11 +3800,16 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
3792{ 3800{
3793 struct file *file = iocb->ki_filp; 3801 struct file *file = iocb->ki_filp;
3794 struct inode *inode = file->f_mapping->host; 3802 struct inode *inode = file->f_mapping->host;
3803 ssize_t ret;
3795 3804
3805 trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw);
3796 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) 3806 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
3797 return ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs); 3807 ret = ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs);
3798 3808 else
3799 return ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs); 3809 ret = ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs);
3810 trace_ext4_direct_IO_exit(inode, offset,
3811 iov_length(iov, nr_segs), rw, ret);
3812 return ret;
3800} 3813}
3801 3814
3802/* 3815/*
@@ -4425,6 +4438,8 @@ void ext4_truncate(struct inode *inode)
4425 ext4_lblk_t last_block; 4438 ext4_lblk_t last_block;
4426 unsigned blocksize = inode->i_sb->s_blocksize; 4439 unsigned blocksize = inode->i_sb->s_blocksize;
4427 4440
4441 trace_ext4_truncate_enter(inode);
4442
4428 if (!ext4_can_truncate(inode)) 4443 if (!ext4_can_truncate(inode))
4429 return; 4444 return;
4430 4445
@@ -4435,6 +4450,7 @@ void ext4_truncate(struct inode *inode)
4435 4450
4436 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { 4451 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
4437 ext4_ext_truncate(inode); 4452 ext4_ext_truncate(inode);
4453 trace_ext4_truncate_exit(inode);
4438 return; 4454 return;
4439 } 4455 }
4440 4456
@@ -4564,6 +4580,7 @@ out_stop:
4564 ext4_orphan_del(handle, inode); 4580 ext4_orphan_del(handle, inode);
4565 4581
4566 ext4_journal_stop(handle); 4582 ext4_journal_stop(handle);
4583 trace_ext4_truncate_exit(inode);
4567} 4584}
4568 4585
4569/* 4586/*
@@ -4695,6 +4712,7 @@ make_io:
4695 * has in-inode xattrs, or we don't have this inode in memory. 4712 * has in-inode xattrs, or we don't have this inode in memory.
4696 * Read the block from disk. 4713 * Read the block from disk.
4697 */ 4714 */
4715 trace_ext4_load_inode(inode);
4698 get_bh(bh); 4716 get_bh(bh);
4699 bh->b_end_io = end_buffer_read_sync; 4717 bh->b_end_io = end_buffer_read_sync;
4700 submit_bh(READ_META, bh); 4718 submit_bh(READ_META, bh);
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index ad87584aa8d2..f9f83878843a 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -40,6 +40,7 @@
40#include "xattr.h" 40#include "xattr.h"
41#include "acl.h" 41#include "acl.h"
42 42
43#include <trace/events/ext4.h>
43/* 44/*
44 * define how far ahead to read directories while searching them. 45 * define how far ahead to read directories while searching them.
45 */ 46 */
@@ -2183,6 +2184,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2183 struct ext4_dir_entry_2 *de; 2184 struct ext4_dir_entry_2 *de;
2184 handle_t *handle; 2185 handle_t *handle;
2185 2186
2187 trace_ext4_unlink_enter(dir, dentry);
2186 /* Initialize quotas before so that eventual writes go 2188 /* Initialize quotas before so that eventual writes go
2187 * in separate transaction */ 2189 * in separate transaction */
2188 dquot_initialize(dir); 2190 dquot_initialize(dir);
@@ -2228,6 +2230,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2228end_unlink: 2230end_unlink:
2229 ext4_journal_stop(handle); 2231 ext4_journal_stop(handle);
2230 brelse(bh); 2232 brelse(bh);
2233 trace_ext4_unlink_exit(dentry, retval);
2231 return retval; 2234 return retval;
2232} 2235}
2233 2236