diff options
author | Aditya Kali <adityakali@google.com> | 2011-09-09 19:18:51 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-09 19:18:51 -0400 |
commit | d8990240d8c911064447f8aa5a440f9345a6d692 (patch) | |
tree | c12cda27583eb9616d91ec38fdfd79c6eb490bd5 /fs/ext4 | |
parent | df55c99dc8ee4c3c886a5edc8a4aa6b131c95afc (diff) |
ext4: add some tracepoints in ext4/extents.c
This patch adds some tracepoints in ext4/extents.c and updates a tracepoint in
ext4/inode.c.
Tested: Built and ran the kernel and verified that these tracepoints work.
Also ran xfstests.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 2 | ||||
-rw-r--r-- | fs/ext4/extents.c | 44 | ||||
-rw-r--r-- | fs/ext4/inode.c | 3 | ||||
-rw-r--r-- | fs/ext4/migrate.c | 1 | ||||
-rw-r--r-- | fs/ext4/move_extent.c | 1 |
5 files changed, 42 insertions, 9 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 21ea65d8bd46..751277a4890c 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2339,4 +2339,6 @@ extern void ext4_resize_end(struct super_block *sb); | |||
2339 | 2339 | ||
2340 | #endif /* __KERNEL__ */ | 2340 | #endif /* __KERNEL__ */ |
2341 | 2341 | ||
2342 | #include "ext4_extents.h" | ||
2343 | |||
2342 | #endif /* _EXT4_H */ | 2344 | #endif /* _EXT4_H */ |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c4e005864534..9b119308daea 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #include <linux/fiemap.h> | 43 | #include <linux/fiemap.h> |
44 | #include "ext4_jbd2.h" | 44 | #include "ext4_jbd2.h" |
45 | #include "ext4_extents.h" | ||
46 | 45 | ||
47 | #include <trace/events/ext4.h> | 46 | #include <trace/events/ext4.h> |
48 | 47 | ||
@@ -1969,6 +1968,7 @@ ext4_ext_put_in_cache(struct inode *inode, ext4_lblk_t block, | |||
1969 | struct ext4_ext_cache *cex; | 1968 | struct ext4_ext_cache *cex; |
1970 | BUG_ON(len == 0); | 1969 | BUG_ON(len == 0); |
1971 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 1970 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); |
1971 | trace_ext4_ext_put_in_cache(inode, block, len, start); | ||
1972 | cex = &EXT4_I(inode)->i_cached_extent; | 1972 | cex = &EXT4_I(inode)->i_cached_extent; |
1973 | cex->ec_block = block; | 1973 | cex->ec_block = block; |
1974 | cex->ec_len = len; | 1974 | cex->ec_len = len; |
@@ -2070,6 +2070,7 @@ errout: | |||
2070 | sbi->extent_cache_misses++; | 2070 | sbi->extent_cache_misses++; |
2071 | else | 2071 | else |
2072 | sbi->extent_cache_hits++; | 2072 | sbi->extent_cache_hits++; |
2073 | trace_ext4_ext_in_cache(inode, block, ret); | ||
2073 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 2074 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
2074 | return ret; | 2075 | return ret; |
2075 | } | 2076 | } |
@@ -2137,6 +2138,8 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, | |||
2137 | if (err) | 2138 | if (err) |
2138 | return err; | 2139 | return err; |
2139 | ext_debug("index is empty, remove it, free block %llu\n", leaf); | 2140 | ext_debug("index is empty, remove it, free block %llu\n", leaf); |
2141 | trace_ext4_ext_rm_idx(inode, leaf); | ||
2142 | |||
2140 | ext4_free_blocks(handle, inode, NULL, leaf, 1, | 2143 | ext4_free_blocks(handle, inode, NULL, leaf, 1, |
2141 | EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); | 2144 | EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); |
2142 | return err; | 2145 | return err; |
@@ -2222,6 +2225,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode, | |||
2222 | */ | 2225 | */ |
2223 | flags |= EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER; | 2226 | flags |= EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER; |
2224 | 2227 | ||
2228 | trace_ext4_remove_blocks(inode, ex, from, to, *partial_cluster); | ||
2225 | /* | 2229 | /* |
2226 | * If we have a partial cluster, and it's different from the | 2230 | * If we have a partial cluster, and it's different from the |
2227 | * cluster of the last block, we need to explicitly free the | 2231 | * cluster of the last block, we need to explicitly free the |
@@ -2336,6 +2340,8 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | |||
2336 | ex_ee_block = le32_to_cpu(ex->ee_block); | 2340 | ex_ee_block = le32_to_cpu(ex->ee_block); |
2337 | ex_ee_len = ext4_ext_get_actual_len(ex); | 2341 | ex_ee_len = ext4_ext_get_actual_len(ex); |
2338 | 2342 | ||
2343 | trace_ext4_ext_rm_leaf(inode, start, ex, *partial_cluster); | ||
2344 | |||
2339 | while (ex >= EXT_FIRST_EXTENT(eh) && | 2345 | while (ex >= EXT_FIRST_EXTENT(eh) && |
2340 | ex_ee_block + ex_ee_len > start) { | 2346 | ex_ee_block + ex_ee_len > start) { |
2341 | 2347 | ||
@@ -2591,6 +2597,8 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start) | |||
2591 | again: | 2597 | again: |
2592 | ext4_ext_invalidate_cache(inode); | 2598 | ext4_ext_invalidate_cache(inode); |
2593 | 2599 | ||
2600 | trace_ext4_ext_remove_space(inode, start, depth); | ||
2601 | |||
2594 | /* | 2602 | /* |
2595 | * We start scanning from right side, freeing all the blocks | 2603 | * We start scanning from right side, freeing all the blocks |
2596 | * after i_size and walking into the tree depth-wise. | 2604 | * after i_size and walking into the tree depth-wise. |
@@ -2686,6 +2694,9 @@ again: | |||
2686 | } | 2694 | } |
2687 | } | 2695 | } |
2688 | 2696 | ||
2697 | trace_ext4_ext_remove_space_done(inode, start, depth, partial_cluster, | ||
2698 | path->p_hdr->eh_entries); | ||
2699 | |||
2689 | /* If we still have something in the partial cluster and we have removed | 2700 | /* If we still have something in the partial cluster and we have removed |
2690 | * even the first extent, then we should free the blocks in the partial | 2701 | * even the first extent, then we should free the blocks in the partial |
2691 | * cluster as well. */ | 2702 | * cluster as well. */ |
@@ -3300,6 +3311,10 @@ static int ext4_find_delalloc_range(struct inode *inode, | |||
3300 | * detect that here. | 3311 | * detect that here. |
3301 | */ | 3312 | */ |
3302 | page_cache_release(page); | 3313 | page_cache_release(page); |
3314 | trace_ext4_find_delalloc_range(inode, | ||
3315 | lblk_start, lblk_end, | ||
3316 | search_hint_reverse, | ||
3317 | 0, i); | ||
3303 | return 0; | 3318 | return 0; |
3304 | } | 3319 | } |
3305 | 3320 | ||
@@ -3327,6 +3342,10 @@ static int ext4_find_delalloc_range(struct inode *inode, | |||
3327 | 3342 | ||
3328 | if (buffer_delay(bh)) { | 3343 | if (buffer_delay(bh)) { |
3329 | page_cache_release(page); | 3344 | page_cache_release(page); |
3345 | trace_ext4_find_delalloc_range(inode, | ||
3346 | lblk_start, lblk_end, | ||
3347 | search_hint_reverse, | ||
3348 | 1, i); | ||
3330 | return 1; | 3349 | return 1; |
3331 | } | 3350 | } |
3332 | if (search_hint_reverse) | 3351 | if (search_hint_reverse) |
@@ -3349,6 +3368,8 @@ nextpage: | |||
3349 | i = index << (PAGE_CACHE_SHIFT - inode->i_blkbits); | 3368 | i = index << (PAGE_CACHE_SHIFT - inode->i_blkbits); |
3350 | } | 3369 | } |
3351 | 3370 | ||
3371 | trace_ext4_find_delalloc_range(inode, lblk_start, lblk_end, | ||
3372 | search_hint_reverse, 0, 0); | ||
3352 | return 0; | 3373 | return 0; |
3353 | } | 3374 | } |
3354 | 3375 | ||
@@ -3414,6 +3435,8 @@ get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start, | |||
3414 | /* max possible clusters for this allocation */ | 3435 | /* max possible clusters for this allocation */ |
3415 | allocated_clusters = alloc_cluster_end - alloc_cluster_start + 1; | 3436 | allocated_clusters = alloc_cluster_end - alloc_cluster_start + 1; |
3416 | 3437 | ||
3438 | trace_ext4_get_reserved_cluster_alloc(inode, lblk_start, num_blks); | ||
3439 | |||
3417 | /* Check towards left side */ | 3440 | /* Check towards left side */ |
3418 | c_offset = lblk_start & (sbi->s_cluster_ratio - 1); | 3441 | c_offset = lblk_start & (sbi->s_cluster_ratio - 1); |
3419 | if (c_offset) { | 3442 | if (c_offset) { |
@@ -3453,6 +3476,9 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3453 | flags, allocated); | 3476 | flags, allocated); |
3454 | ext4_ext_show_leaf(inode, path); | 3477 | ext4_ext_show_leaf(inode, path); |
3455 | 3478 | ||
3479 | trace_ext4_ext_handle_uninitialized_extents(inode, map, allocated, | ||
3480 | newblock); | ||
3481 | |||
3456 | /* get_block() before submit the IO, split the extent */ | 3482 | /* get_block() before submit the IO, split the extent */ |
3457 | if ((flags & EXT4_GET_BLOCKS_PRE_IO)) { | 3483 | if ((flags & EXT4_GET_BLOCKS_PRE_IO)) { |
3458 | ret = ext4_split_unwritten_extents(handle, inode, map, | 3484 | ret = ext4_split_unwritten_extents(handle, inode, map, |
@@ -3572,7 +3598,7 @@ out2: | |||
3572 | * get_implied_cluster_alloc - check to see if the requested | 3598 | * get_implied_cluster_alloc - check to see if the requested |
3573 | * allocation (in the map structure) overlaps with a cluster already | 3599 | * allocation (in the map structure) overlaps with a cluster already |
3574 | * allocated in an extent. | 3600 | * allocated in an extent. |
3575 | * @sbi The ext4-specific superblock structure | 3601 | * @sb The filesystem superblock structure |
3576 | * @map The requested lblk->pblk mapping | 3602 | * @map The requested lblk->pblk mapping |
3577 | * @ex The extent structure which might contain an implied | 3603 | * @ex The extent structure which might contain an implied |
3578 | * cluster allocation | 3604 | * cluster allocation |
@@ -3609,11 +3635,12 @@ out2: | |||
3609 | * ext4_ext_map_blocks() will then allocate one or more new clusters | 3635 | * ext4_ext_map_blocks() will then allocate one or more new clusters |
3610 | * by calling ext4_mb_new_blocks(). | 3636 | * by calling ext4_mb_new_blocks(). |
3611 | */ | 3637 | */ |
3612 | static int get_implied_cluster_alloc(struct ext4_sb_info *sbi, | 3638 | static int get_implied_cluster_alloc(struct super_block *sb, |
3613 | struct ext4_map_blocks *map, | 3639 | struct ext4_map_blocks *map, |
3614 | struct ext4_extent *ex, | 3640 | struct ext4_extent *ex, |
3615 | struct ext4_ext_path *path) | 3641 | struct ext4_ext_path *path) |
3616 | { | 3642 | { |
3643 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
3617 | ext4_lblk_t c_offset = map->m_lblk & (sbi->s_cluster_ratio-1); | 3644 | ext4_lblk_t c_offset = map->m_lblk & (sbi->s_cluster_ratio-1); |
3618 | ext4_lblk_t ex_cluster_start, ex_cluster_end; | 3645 | ext4_lblk_t ex_cluster_start, ex_cluster_end; |
3619 | ext4_lblk_t rr_cluster_start, rr_cluster_end; | 3646 | ext4_lblk_t rr_cluster_start, rr_cluster_end; |
@@ -3662,8 +3689,12 @@ static int get_implied_cluster_alloc(struct ext4_sb_info *sbi, | |||
3662 | ext4_lblk_t next = ext4_ext_next_allocated_block(path); | 3689 | ext4_lblk_t next = ext4_ext_next_allocated_block(path); |
3663 | map->m_len = min(map->m_len, next - map->m_lblk); | 3690 | map->m_len = min(map->m_len, next - map->m_lblk); |
3664 | } | 3691 | } |
3692 | |||
3693 | trace_ext4_get_implied_cluster_alloc_exit(sb, map, 1); | ||
3665 | return 1; | 3694 | return 1; |
3666 | } | 3695 | } |
3696 | |||
3697 | trace_ext4_get_implied_cluster_alloc_exit(sb, map, 0); | ||
3667 | return 0; | 3698 | return 0; |
3668 | } | 3699 | } |
3669 | 3700 | ||
@@ -3772,6 +3803,9 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
3772 | * we split out initialized portions during a write. | 3803 | * we split out initialized portions during a write. |
3773 | */ | 3804 | */ |
3774 | ee_len = ext4_ext_get_actual_len(ex); | 3805 | ee_len = ext4_ext_get_actual_len(ex); |
3806 | |||
3807 | trace_ext4_ext_show_extent(inode, ee_block, ee_start, ee_len); | ||
3808 | |||
3775 | /* if found extent covers block, simply return it */ | 3809 | /* if found extent covers block, simply return it */ |
3776 | if (in_range(map->m_lblk, ee_block, ee_len)) { | 3810 | if (in_range(map->m_lblk, ee_block, ee_len)) { |
3777 | ext4_fsblk_t partial_cluster = 0; | 3811 | ext4_fsblk_t partial_cluster = 0; |
@@ -3912,7 +3946,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
3912 | * by ext4_ext_find_extent() implies a cluster we can use. | 3946 | * by ext4_ext_find_extent() implies a cluster we can use. |
3913 | */ | 3947 | */ |
3914 | if (cluster_offset && ex && | 3948 | if (cluster_offset && ex && |
3915 | get_implied_cluster_alloc(sbi, map, ex, path)) { | 3949 | get_implied_cluster_alloc(inode->i_sb, map, ex, path)) { |
3916 | ar.len = allocated = map->m_len; | 3950 | ar.len = allocated = map->m_len; |
3917 | newblock = map->m_pblk; | 3951 | newblock = map->m_pblk; |
3918 | map->m_flags |= EXT4_MAP_FROM_CLUSTER; | 3952 | map->m_flags |= EXT4_MAP_FROM_CLUSTER; |
@@ -3933,7 +3967,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
3933 | /* Check if the extent after searching to the right implies a | 3967 | /* Check if the extent after searching to the right implies a |
3934 | * cluster we can use. */ | 3968 | * cluster we can use. */ |
3935 | if ((sbi->s_cluster_ratio > 1) && ex2 && | 3969 | if ((sbi->s_cluster_ratio > 1) && ex2 && |
3936 | get_implied_cluster_alloc(sbi, map, ex2, path)) { | 3970 | get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) { |
3937 | ar.len = allocated = map->m_len; | 3971 | ar.len = allocated = map->m_len; |
3938 | newblock = map->m_pblk; | 3972 | newblock = map->m_pblk; |
3939 | map->m_flags |= EXT4_MAP_FROM_CLUSTER; | 3973 | map->m_flags |= EXT4_MAP_FROM_CLUSTER; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 88dc63a01756..2dcd4fed96ec 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include "ext4_jbd2.h" | 42 | #include "ext4_jbd2.h" |
43 | #include "xattr.h" | 43 | #include "xattr.h" |
44 | #include "acl.h" | 44 | #include "acl.h" |
45 | #include "ext4_extents.h" | ||
46 | #include "truncate.h" | 45 | #include "truncate.h" |
47 | 46 | ||
48 | #include <trace/events/ext4.h> | 47 | #include <trace/events/ext4.h> |
@@ -268,7 +267,7 @@ void ext4_da_update_reserve_space(struct inode *inode, | |||
268 | struct ext4_inode_info *ei = EXT4_I(inode); | 267 | struct ext4_inode_info *ei = EXT4_I(inode); |
269 | 268 | ||
270 | spin_lock(&ei->i_block_reservation_lock); | 269 | spin_lock(&ei->i_block_reservation_lock); |
271 | trace_ext4_da_update_reserve_space(inode, used); | 270 | trace_ext4_da_update_reserve_space(inode, used, quota_claim); |
272 | if (unlikely(used > ei->i_reserved_data_blocks)) { | 271 | if (unlikely(used > ei->i_reserved_data_blocks)) { |
273 | ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d " | 272 | ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d " |
274 | "with only %d reserved data blocks\n", | 273 | "with only %d reserved data blocks\n", |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index b57b98fb44d1..6f07a06f2437 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include "ext4_jbd2.h" | 17 | #include "ext4_jbd2.h" |
18 | #include "ext4_extents.h" | ||
19 | 18 | ||
20 | /* | 19 | /* |
21 | * The contiguous blocks details which can be | 20 | * The contiguous blocks details which can be |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index f57455a1b1b2..c5826c623e7a 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/quotaops.h> | 17 | #include <linux/quotaops.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include "ext4_jbd2.h" | 19 | #include "ext4_jbd2.h" |
20 | #include "ext4_extents.h" | ||
21 | #include "ext4.h" | 20 | #include "ext4.h" |
22 | 21 | ||
23 | /** | 22 | /** |