aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/inode.c
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2011-05-23 12:33:01 -0400
committerJan Kara <jack@suse.cz>2011-06-25 11:29:51 -0400
commit785c4bcc0d88ff006a0b2120815a71e86ecf21ce (patch)
tree573607ada555ca3d6136a9ec7f922ee6fef1eda3 /fs/ext3/inode.c
parent5220cc9382e11ca955ce946ee6a5bac577bb14ff (diff)
ext3: Add fixed tracepoints
This commit adds fixed tracepoints to the ext3 code. It is based on ext4 tracepoints, however due to the differences of both file systems, there are some tracepoints missing (those for delaloc and for multi-block allocator) and there are some ext3 specific as well (for reservation windows). Here is a list: ext3_free_inode ext3_request_inode ext3_allocate_inode ext3_evict_inode ext3_drop_inode ext3_mark_inode_dirty ext3_write_begin ext3_ordered_write_end ext3_writeback_write_end ext3_journalled_write_end ext3_ordered_writepage ext3_writeback_writepage ext3_journalled_writepage ext3_readpage ext3_releasepage ext3_invalidatepage ext3_discard_blocks ext3_request_blocks ext3_allocate_blocks ext3_free_blocks ext3_sync_file_enter ext3_sync_file_exit ext3_sync_fs ext3_rsv_window_add ext3_discard_reservation ext3_alloc_new_reservation ext3_reserved ext3_forget ext3_read_block_bitmap ext3_direct_IO_enter ext3_direct_IO_exit ext3_unlink_enter ext3_unlink_exit ext3_truncate_enter ext3_truncate_exit ext3_get_blocks_enter ext3_get_blocks_exit ext3_load_inode Signed-off-by: Lukas Czerner <lczerner@redhat.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r--fs/ext3/inode.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 3451d23c3bae..3aa05eebe0b8 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -38,6 +38,7 @@
38#include <linux/bio.h> 38#include <linux/bio.h>
39#include <linux/fiemap.h> 39#include <linux/fiemap.h>
40#include <linux/namei.h> 40#include <linux/namei.h>
41#include <trace/events/ext3.h>
41#include "xattr.h" 42#include "xattr.h"
42#include "acl.h" 43#include "acl.h"
43 44
@@ -70,6 +71,7 @@ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
70 71
71 might_sleep(); 72 might_sleep();
72 73
74 trace_ext3_forget(inode, is_metadata, blocknr);
73 BUFFER_TRACE(bh, "enter"); 75 BUFFER_TRACE(bh, "enter");
74 76
75 jbd_debug(4, "forgetting bh %p: is_metadata = %d, mode %o, " 77 jbd_debug(4, "forgetting bh %p: is_metadata = %d, mode %o, "
@@ -198,6 +200,7 @@ void ext3_evict_inode (struct inode *inode)
198 handle_t *handle; 200 handle_t *handle;
199 int want_delete = 0; 201 int want_delete = 0;
200 202
203 trace_ext3_evict_inode(inode);
201 if (!inode->i_nlink && !is_bad_inode(inode)) { 204 if (!inode->i_nlink && !is_bad_inode(inode)) {
202 dquot_initialize(inode); 205 dquot_initialize(inode);
203 want_delete = 1; 206 want_delete = 1;
@@ -842,6 +845,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
842 ext3_fsblk_t first_block = 0; 845 ext3_fsblk_t first_block = 0;
843 846
844 847
848 trace_ext3_get_blocks_enter(inode, iblock, maxblocks, create);
845 J_ASSERT(handle != NULL || create == 0); 849 J_ASSERT(handle != NULL || create == 0);
846 depth = ext3_block_to_path(inode,iblock,offsets,&blocks_to_boundary); 850 depth = ext3_block_to_path(inode,iblock,offsets,&blocks_to_boundary);
847 851
@@ -970,6 +974,9 @@ cleanup:
970 } 974 }
971 BUFFER_TRACE(bh_result, "returned"); 975 BUFFER_TRACE(bh_result, "returned");
972out: 976out:
977 trace_ext3_get_blocks_exit(inode, iblock,
978 depth ? le32_to_cpu(chain[depth-1].key) : 0,
979 count, err);
973 return err; 980 return err;
974} 981}
975 982
@@ -1217,6 +1224,8 @@ static int ext3_write_begin(struct file *file, struct address_space *mapping,
1217 * we allocate blocks but write fails for some reason */ 1224 * we allocate blocks but write fails for some reason */
1218 int needed_blocks = ext3_writepage_trans_blocks(inode) + 1; 1225 int needed_blocks = ext3_writepage_trans_blocks(inode) + 1;
1219 1226
1227 trace_ext3_write_begin(inode, pos, len, flags);
1228
1220 index = pos >> PAGE_CACHE_SHIFT; 1229 index = pos >> PAGE_CACHE_SHIFT;
1221 from = pos & (PAGE_CACHE_SIZE - 1); 1230 from = pos & (PAGE_CACHE_SIZE - 1);
1222 to = from + len; 1231 to = from + len;
@@ -1332,6 +1341,7 @@ static int ext3_ordered_write_end(struct file *file,
1332 unsigned from, to; 1341 unsigned from, to;
1333 int ret = 0, ret2; 1342 int ret = 0, ret2;
1334 1343
1344 trace_ext3_ordered_write_end(inode, pos, len, copied);
1335 copied = block_write_end(file, mapping, pos, len, copied, page, fsdata); 1345 copied = block_write_end(file, mapping, pos, len, copied, page, fsdata);
1336 1346
1337 from = pos & (PAGE_CACHE_SIZE - 1); 1347 from = pos & (PAGE_CACHE_SIZE - 1);
@@ -1367,6 +1377,7 @@ static int ext3_writeback_write_end(struct file *file,
1367 struct inode *inode = file->f_mapping->host; 1377 struct inode *inode = file->f_mapping->host;
1368 int ret; 1378 int ret;
1369 1379
1380 trace_ext3_writeback_write_end(inode, pos, len, copied);
1370 copied = block_write_end(file, mapping, pos, len, copied, page, fsdata); 1381 copied = block_write_end(file, mapping, pos, len, copied, page, fsdata);
1371 update_file_sizes(inode, pos, copied); 1382 update_file_sizes(inode, pos, copied);
1372 /* 1383 /*
@@ -1395,6 +1406,7 @@ static int ext3_journalled_write_end(struct file *file,
1395 int partial = 0; 1406 int partial = 0;
1396 unsigned from, to; 1407 unsigned from, to;
1397 1408
1409 trace_ext3_journalled_write_end(inode, pos, len, copied);
1398 from = pos & (PAGE_CACHE_SIZE - 1); 1410 from = pos & (PAGE_CACHE_SIZE - 1);
1399 to = from + len; 1411 to = from + len;
1400 1412
@@ -1577,6 +1589,7 @@ static int ext3_ordered_writepage(struct page *page,
1577 if (ext3_journal_current_handle()) 1589 if (ext3_journal_current_handle())
1578 goto out_fail; 1590 goto out_fail;
1579 1591
1592 trace_ext3_ordered_writepage(page);
1580 if (!page_has_buffers(page)) { 1593 if (!page_has_buffers(page)) {
1581 create_empty_buffers(page, inode->i_sb->s_blocksize, 1594 create_empty_buffers(page, inode->i_sb->s_blocksize,
1582 (1 << BH_Dirty)|(1 << BH_Uptodate)); 1595 (1 << BH_Dirty)|(1 << BH_Uptodate));
@@ -1647,6 +1660,7 @@ static int ext3_writeback_writepage(struct page *page,
1647 if (ext3_journal_current_handle()) 1660 if (ext3_journal_current_handle())
1648 goto out_fail; 1661 goto out_fail;
1649 1662
1663 trace_ext3_writeback_writepage(page);
1650 if (page_has_buffers(page)) { 1664 if (page_has_buffers(page)) {
1651 if (!walk_page_buffers(NULL, page_buffers(page), 0, 1665 if (!walk_page_buffers(NULL, page_buffers(page), 0,
1652 PAGE_CACHE_SIZE, NULL, buffer_unmapped)) { 1666 PAGE_CACHE_SIZE, NULL, buffer_unmapped)) {
@@ -1689,6 +1703,7 @@ static int ext3_journalled_writepage(struct page *page,
1689 if (ext3_journal_current_handle()) 1703 if (ext3_journal_current_handle())
1690 goto no_write; 1704 goto no_write;
1691 1705
1706 trace_ext3_journalled_writepage(page);
1692 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); 1707 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode));
1693 if (IS_ERR(handle)) { 1708 if (IS_ERR(handle)) {
1694 ret = PTR_ERR(handle); 1709 ret = PTR_ERR(handle);
@@ -1739,6 +1754,7 @@ out_unlock:
1739 1754
1740static int ext3_readpage(struct file *file, struct page *page) 1755static int ext3_readpage(struct file *file, struct page *page)
1741{ 1756{
1757 trace_ext3_readpage(page);
1742 return mpage_readpage(page, ext3_get_block); 1758 return mpage_readpage(page, ext3_get_block);
1743} 1759}
1744 1760
@@ -1753,6 +1769,8 @@ static void ext3_invalidatepage(struct page *page, unsigned long offset)
1753{ 1769{
1754 journal_t *journal = EXT3_JOURNAL(page->mapping->host); 1770 journal_t *journal = EXT3_JOURNAL(page->mapping->host);
1755 1771
1772 trace_ext3_invalidatepage(page, offset);
1773
1756 /* 1774 /*
1757 * If it's a full truncate we just forget about the pending dirtying 1775 * If it's a full truncate we just forget about the pending dirtying
1758 */ 1776 */
@@ -1766,6 +1784,7 @@ static int ext3_releasepage(struct page *page, gfp_t wait)
1766{ 1784{
1767 journal_t *journal = EXT3_JOURNAL(page->mapping->host); 1785 journal_t *journal = EXT3_JOURNAL(page->mapping->host);
1768 1786
1787 trace_ext3_releasepage(page);
1769 WARN_ON(PageChecked(page)); 1788 WARN_ON(PageChecked(page));
1770 if (!page_has_buffers(page)) 1789 if (!page_has_buffers(page))
1771 return 0; 1790 return 0;
@@ -1794,6 +1813,8 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
1794 size_t count = iov_length(iov, nr_segs); 1813 size_t count = iov_length(iov, nr_segs);
1795 int retries = 0; 1814 int retries = 0;
1796 1815
1816 trace_ext3_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw);
1817
1797 if (rw == WRITE) { 1818 if (rw == WRITE) {
1798 loff_t final_size = offset + count; 1819 loff_t final_size = offset + count;
1799 1820
@@ -1868,6 +1889,8 @@ retry:
1868 ret = err; 1889 ret = err;
1869 } 1890 }
1870out: 1891out:
1892 trace_ext3_direct_IO_exit(inode, offset,
1893 iov_length(iov, nr_segs), rw, ret);
1871 return ret; 1894 return ret;
1872} 1895}
1873 1896
@@ -2446,6 +2469,8 @@ void ext3_truncate(struct inode *inode)
2446 unsigned blocksize = inode->i_sb->s_blocksize; 2469 unsigned blocksize = inode->i_sb->s_blocksize;
2447 struct page *page; 2470 struct page *page;
2448 2471
2472 trace_ext3_truncate_enter(inode);
2473
2449 if (!ext3_can_truncate(inode)) 2474 if (!ext3_can_truncate(inode))
2450 goto out_notrans; 2475 goto out_notrans;
2451 2476
@@ -2597,6 +2622,7 @@ out_stop:
2597 ext3_orphan_del(handle, inode); 2622 ext3_orphan_del(handle, inode);
2598 2623
2599 ext3_journal_stop(handle); 2624 ext3_journal_stop(handle);
2625 trace_ext3_truncate_exit(inode);
2600 return; 2626 return;
2601out_notrans: 2627out_notrans:
2602 /* 2628 /*
@@ -2605,6 +2631,7 @@ out_notrans:
2605 */ 2631 */
2606 if (inode->i_nlink) 2632 if (inode->i_nlink)
2607 ext3_orphan_del(NULL, inode); 2633 ext3_orphan_del(NULL, inode);
2634 trace_ext3_truncate_exit(inode);
2608} 2635}
2609 2636
2610static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, 2637static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
@@ -2746,6 +2773,7 @@ make_io:
2746 * has in-inode xattrs, or we don't have this inode in memory. 2773 * has in-inode xattrs, or we don't have this inode in memory.
2747 * Read the block from disk. 2774 * Read the block from disk.
2748 */ 2775 */
2776 trace_ext3_load_inode(inode);
2749 get_bh(bh); 2777 get_bh(bh);
2750 bh->b_end_io = end_buffer_read_sync; 2778 bh->b_end_io = end_buffer_read_sync;
2751 submit_bh(READ_META, bh); 2779 submit_bh(READ_META, bh);
@@ -3372,6 +3400,7 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode)
3372 int err; 3400 int err;
3373 3401
3374 might_sleep(); 3402 might_sleep();
3403 trace_ext3_mark_inode_dirty(inode, _RET_IP_);
3375 err = ext3_reserve_inode_write(handle, inode, &iloc); 3404 err = ext3_reserve_inode_write(handle, inode, &iloc);
3376 if (!err) 3405 if (!err)
3377 err = ext3_mark_iloc_dirty(handle, inode, &iloc); 3406 err = ext3_mark_iloc_dirty(handle, inode, &iloc);