aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/balloc.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/balloc.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/balloc.c')
-rw-r--r--fs/ext3/balloc.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index fe52297e31ad..f7d111e499ad 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -21,6 +21,7 @@
21#include <linux/quotaops.h> 21#include <linux/quotaops.h>
22#include <linux/buffer_head.h> 22#include <linux/buffer_head.h>
23#include <linux/blkdev.h> 23#include <linux/blkdev.h>
24#include <trace/events/ext3.h>
24 25
25/* 26/*
26 * balloc.c contains the blocks allocation and deallocation routines 27 * balloc.c contains the blocks allocation and deallocation routines
@@ -161,6 +162,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
161 desc = ext3_get_group_desc(sb, block_group, NULL); 162 desc = ext3_get_group_desc(sb, block_group, NULL);
162 if (!desc) 163 if (!desc)
163 return NULL; 164 return NULL;
165 trace_ext3_read_block_bitmap(sb, block_group);
164 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); 166 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
165 bh = sb_getblk(sb, bitmap_blk); 167 bh = sb_getblk(sb, bitmap_blk);
166 if (unlikely(!bh)) { 168 if (unlikely(!bh)) {
@@ -351,6 +353,7 @@ void ext3_rsv_window_add(struct super_block *sb,
351 struct rb_node * parent = NULL; 353 struct rb_node * parent = NULL;
352 struct ext3_reserve_window_node *this; 354 struct ext3_reserve_window_node *this;
353 355
356 trace_ext3_rsv_window_add(sb, rsv);
354 while (*p) 357 while (*p)
355 { 358 {
356 parent = *p; 359 parent = *p;
@@ -476,8 +479,10 @@ void ext3_discard_reservation(struct inode *inode)
476 rsv = &block_i->rsv_window_node; 479 rsv = &block_i->rsv_window_node;
477 if (!rsv_is_empty(&rsv->rsv_window)) { 480 if (!rsv_is_empty(&rsv->rsv_window)) {
478 spin_lock(rsv_lock); 481 spin_lock(rsv_lock);
479 if (!rsv_is_empty(&rsv->rsv_window)) 482 if (!rsv_is_empty(&rsv->rsv_window)) {
483 trace_ext3_discard_reservation(inode, rsv);
480 rsv_window_remove(inode->i_sb, rsv); 484 rsv_window_remove(inode->i_sb, rsv);
485 }
481 spin_unlock(rsv_lock); 486 spin_unlock(rsv_lock);
482 } 487 }
483} 488}
@@ -683,14 +688,10 @@ error_return:
683void ext3_free_blocks(handle_t *handle, struct inode *inode, 688void ext3_free_blocks(handle_t *handle, struct inode *inode,
684 ext3_fsblk_t block, unsigned long count) 689 ext3_fsblk_t block, unsigned long count)
685{ 690{
686 struct super_block * sb; 691 struct super_block *sb = inode->i_sb;
687 unsigned long dquot_freed_blocks; 692 unsigned long dquot_freed_blocks;
688 693
689 sb = inode->i_sb; 694 trace_ext3_free_blocks(inode, block, count);
690 if (!sb) {
691 printk ("ext3_free_blocks: nonexistent device");
692 return;
693 }
694 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks); 695 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
695 if (dquot_freed_blocks) 696 if (dquot_freed_blocks)
696 dquot_free_block(inode, dquot_freed_blocks); 697 dquot_free_block(inode, dquot_freed_blocks);
@@ -1136,6 +1137,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
1136 else 1137 else
1137 start_block = grp_goal + group_first_block; 1138 start_block = grp_goal + group_first_block;
1138 1139
1140 trace_ext3_alloc_new_reservation(sb, start_block);
1139 size = my_rsv->rsv_goal_size; 1141 size = my_rsv->rsv_goal_size;
1140 1142
1141 if (!rsv_is_empty(&my_rsv->rsv_window)) { 1143 if (!rsv_is_empty(&my_rsv->rsv_window)) {
@@ -1230,8 +1232,11 @@ retry:
1230 * check if the first free block is within the 1232 * check if the first free block is within the
1231 * free space we just reserved 1233 * free space we just reserved
1232 */ 1234 */
1233 if (start_block >= my_rsv->rsv_start && start_block <= my_rsv->rsv_end) 1235 if (start_block >= my_rsv->rsv_start &&
1236 start_block <= my_rsv->rsv_end) {
1237 trace_ext3_reserved(sb, start_block, my_rsv);
1234 return 0; /* success */ 1238 return 0; /* success */
1239 }
1235 /* 1240 /*
1236 * if the first free bit we found is out of the reservable space 1241 * if the first free bit we found is out of the reservable space
1237 * continue search for next reservable space, 1242 * continue search for next reservable space,
@@ -1514,10 +1519,6 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
1514 1519
1515 *errp = -ENOSPC; 1520 *errp = -ENOSPC;
1516 sb = inode->i_sb; 1521 sb = inode->i_sb;
1517 if (!sb) {
1518 printk("ext3_new_block: nonexistent device");
1519 return 0;
1520 }
1521 1522
1522 /* 1523 /*
1523 * Check quota for allocation of this block. 1524 * Check quota for allocation of this block.
@@ -1528,8 +1529,10 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
1528 return 0; 1529 return 0;
1529 } 1530 }
1530 1531
1532 trace_ext3_request_blocks(inode, goal, num);
1533
1531 sbi = EXT3_SB(sb); 1534 sbi = EXT3_SB(sb);
1532 es = EXT3_SB(sb)->s_es; 1535 es = sbi->s_es;
1533 ext3_debug("goal=%lu.\n", goal); 1536 ext3_debug("goal=%lu.\n", goal);
1534 /* 1537 /*
1535 * Allocate a block from reservation only when 1538 * Allocate a block from reservation only when
@@ -1742,6 +1745,10 @@ allocated:
1742 brelse(bitmap_bh); 1745 brelse(bitmap_bh);
1743 dquot_free_block(inode, *count-num); 1746 dquot_free_block(inode, *count-num);
1744 *count = num; 1747 *count = num;
1748
1749 trace_ext3_allocate_blocks(inode, goal, num,
1750 (unsigned long long)ret_block);
1751
1745 return ret_block; 1752 return ret_block;
1746 1753
1747io_error: 1754io_error:
@@ -1996,6 +2003,7 @@ ext3_grpblk_t ext3_trim_all_free(struct super_block *sb, unsigned int group,
1996 if ((next - start) < minblocks) 2003 if ((next - start) < minblocks)
1997 goto free_extent; 2004 goto free_extent;
1998 2005
2006 trace_ext3_discard_blocks(sb, discard_block, next - start);
1999 /* Send the TRIM command down to the device */ 2007 /* Send the TRIM command down to the device */
2000 err = sb_issue_discard(sb, discard_block, next - start, 2008 err = sb_issue_discard(sb, discard_block, next - start,
2001 GFP_NOFS, 0); 2009 GFP_NOFS, 0);