diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-01-03 20:03:21 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-03 20:03:21 -0500 |
commit | ba80b1019aa722b24506db1ee755e0bb2f513022 (patch) | |
tree | 0c9a7dfd3af0f5991f3eaaeb65d735b11e9cf777 /fs/ext4/mballoc.c | |
parent | c31910672376dfb8d020e32afa7249763bcd924a (diff) |
ext4: Add markers for better debuggability
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 05d9f81956c6..918aec0c8a11 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2878,8 +2878,9 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2878 | discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb) | 2878 | discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb) |
2879 | + entry->start_blk | 2879 | + entry->start_blk |
2880 | + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); | 2880 | + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); |
2881 | trace_mark(ext4_discard_blocks, "dev %s blk %llu count %u", sb->s_id, | 2881 | trace_mark(ext4_discard_blocks, "dev %s blk %llu count %u", |
2882 | (unsigned long long) discard_block, entry->count); | 2882 | sb->s_id, (unsigned long long) discard_block, |
2883 | entry->count); | ||
2883 | sb_issue_discard(sb, discard_block, entry->count); | 2884 | sb_issue_discard(sb, discard_block, entry->count); |
2884 | 2885 | ||
2885 | kmem_cache_free(ext4_free_ext_cachep, entry); | 2886 | kmem_cache_free(ext4_free_ext_cachep, entry); |
@@ -3697,6 +3698,10 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) | |||
3697 | 3698 | ||
3698 | mb_debug("new inode pa %p: %llu/%u for %u\n", pa, | 3699 | mb_debug("new inode pa %p: %llu/%u for %u\n", pa, |
3699 | pa->pa_pstart, pa->pa_len, pa->pa_lstart); | 3700 | pa->pa_pstart, pa->pa_len, pa->pa_lstart); |
3701 | trace_mark(ext4_mb_new_inode_pa, | ||
3702 | "dev %s ino %lu pstart %llu len %u lstart %u", | ||
3703 | sb->s_id, ac->ac_inode->i_ino, | ||
3704 | pa->pa_pstart, pa->pa_len, pa->pa_lstart); | ||
3700 | 3705 | ||
3701 | ext4_mb_use_inode_pa(ac, pa); | 3706 | ext4_mb_use_inode_pa(ac, pa); |
3702 | atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated); | 3707 | atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated); |
@@ -3754,7 +3759,9 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac) | |||
3754 | pa->pa_linear = 1; | 3759 | pa->pa_linear = 1; |
3755 | 3760 | ||
3756 | mb_debug("new group pa %p: %llu/%u for %u\n", pa, | 3761 | mb_debug("new group pa %p: %llu/%u for %u\n", pa, |
3757 | pa->pa_pstart, pa->pa_len, pa->pa_lstart); | 3762 | pa->pa_pstart, pa->pa_len, pa->pa_lstart); |
3763 | trace_mark(ext4_mb_new_group_pa, "dev %s pstart %llu len %u lstart %u", | ||
3764 | sb->s_id, pa->pa_pstart, pa->pa_len, pa->pa_lstart); | ||
3758 | 3765 | ||
3759 | ext4_mb_use_group_pa(ac, pa); | 3766 | ext4_mb_use_group_pa(ac, pa); |
3760 | atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated); | 3767 | atomic_add(pa->pa_free, &EXT4_SB(sb)->s_mb_preallocated); |
@@ -3807,12 +3814,14 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, | |||
3807 | unsigned int next; | 3814 | unsigned int next; |
3808 | ext4_group_t group; | 3815 | ext4_group_t group; |
3809 | ext4_grpblk_t bit; | 3816 | ext4_grpblk_t bit; |
3817 | unsigned long long grp_blk_start; | ||
3810 | sector_t start; | 3818 | sector_t start; |
3811 | int err = 0; | 3819 | int err = 0; |
3812 | int free = 0; | 3820 | int free = 0; |
3813 | 3821 | ||
3814 | BUG_ON(pa->pa_deleted == 0); | 3822 | BUG_ON(pa->pa_deleted == 0); |
3815 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); | 3823 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); |
3824 | grp_blk_start = pa->pa_pstart - bit; | ||
3816 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); | 3825 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); |
3817 | end = bit + pa->pa_len; | 3826 | end = bit + pa->pa_len; |
3818 | 3827 | ||
@@ -3842,6 +3851,10 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, | |||
3842 | ext4_mb_store_history(ac); | 3851 | ext4_mb_store_history(ac); |
3843 | } | 3852 | } |
3844 | 3853 | ||
3854 | trace_mark(ext4_mb_release_inode_pa, | ||
3855 | "dev %s ino %lu block %llu count %u", | ||
3856 | sb->s_id, pa->pa_inode->i_ino, grp_blk_start + bit, | ||
3857 | next - bit); | ||
3845 | mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); | 3858 | mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); |
3846 | bit = next + 1; | 3859 | bit = next + 1; |
3847 | } | 3860 | } |
@@ -3875,6 +3888,8 @@ ext4_mb_release_group_pa(struct ext4_buddy *e4b, | |||
3875 | if (ac) | 3888 | if (ac) |
3876 | ac->ac_op = EXT4_MB_HISTORY_DISCARD; | 3889 | ac->ac_op = EXT4_MB_HISTORY_DISCARD; |
3877 | 3890 | ||
3891 | trace_mark(ext4_mb_release_group_pa, "dev %s pstart %llu len %d", | ||
3892 | sb->s_id, pa->pa_pstart, pa->pa_len); | ||
3878 | BUG_ON(pa->pa_deleted == 0); | 3893 | BUG_ON(pa->pa_deleted == 0); |
3879 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); | 3894 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); |
3880 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); | 3895 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); |
@@ -4040,6 +4055,8 @@ void ext4_discard_preallocations(struct inode *inode) | |||
4040 | } | 4055 | } |
4041 | 4056 | ||
4042 | mb_debug("discard preallocation for inode %lu\n", inode->i_ino); | 4057 | mb_debug("discard preallocation for inode %lu\n", inode->i_ino); |
4058 | trace_mark(ext4_discard_preallocations, "dev %s ino %lu", sb->s_id, | ||
4059 | inode->i_ino); | ||
4043 | 4060 | ||
4044 | INIT_LIST_HEAD(&list); | 4061 | INIT_LIST_HEAD(&list); |
4045 | 4062 | ||
@@ -4492,6 +4509,8 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed) | |||
4492 | int ret; | 4509 | int ret; |
4493 | int freed = 0; | 4510 | int freed = 0; |
4494 | 4511 | ||
4512 | trace_mark(ext4_mb_discard_preallocations, "dev %s needed %d", | ||
4513 | sb->s_id, needed); | ||
4495 | for (i = 0; i < EXT4_SB(sb)->s_groups_count && needed > 0; i++) { | 4514 | for (i = 0; i < EXT4_SB(sb)->s_groups_count && needed > 0; i++) { |
4496 | ret = ext4_mb_discard_group_preallocations(sb, i, needed); | 4515 | ret = ext4_mb_discard_group_preallocations(sb, i, needed); |
4497 | freed += ret; | 4516 | freed += ret; |
@@ -4520,6 +4539,18 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4520 | sb = ar->inode->i_sb; | 4539 | sb = ar->inode->i_sb; |
4521 | sbi = EXT4_SB(sb); | 4540 | sbi = EXT4_SB(sb); |
4522 | 4541 | ||
4542 | trace_mark(ext4_request_blocks, "dev %s flags %u len %u ino %lu " | ||
4543 | "lblk %llu goal %llu lleft %llu lright %llu " | ||
4544 | "pleft %llu pright %llu ", | ||
4545 | sb->s_id, ar->flags, ar->len, | ||
4546 | ar->inode ? ar->inode->i_ino : 0, | ||
4547 | (unsigned long long) ar->logical, | ||
4548 | (unsigned long long) ar->goal, | ||
4549 | (unsigned long long) ar->lleft, | ||
4550 | (unsigned long long) ar->lright, | ||
4551 | (unsigned long long) ar->pleft, | ||
4552 | (unsigned long long) ar->pright); | ||
4553 | |||
4523 | if (!EXT4_I(ar->inode)->i_delalloc_reserved_flag) { | 4554 | if (!EXT4_I(ar->inode)->i_delalloc_reserved_flag) { |
4524 | /* | 4555 | /* |
4525 | * With delalloc we already reserved the blocks | 4556 | * With delalloc we already reserved the blocks |
@@ -4622,6 +4653,19 @@ out3: | |||
4622 | reserv_blks); | 4653 | reserv_blks); |
4623 | } | 4654 | } |
4624 | 4655 | ||
4656 | trace_mark(ext4_allocate_blocks, | ||
4657 | "dev %s block %llu flags %u len %u ino %lu " | ||
4658 | "logical %llu goal %llu lleft %llu lright %llu " | ||
4659 | "pleft %llu pright %llu ", | ||
4660 | sb->s_id, (unsigned long long) block, | ||
4661 | ar->flags, ar->len, ar->inode ? ar->inode->i_ino : 0, | ||
4662 | (unsigned long long) ar->logical, | ||
4663 | (unsigned long long) ar->goal, | ||
4664 | (unsigned long long) ar->lleft, | ||
4665 | (unsigned long long) ar->lright, | ||
4666 | (unsigned long long) ar->pleft, | ||
4667 | (unsigned long long) ar->pright); | ||
4668 | |||
4625 | return block; | 4669 | return block; |
4626 | } | 4670 | } |
4627 | 4671 | ||
@@ -4755,6 +4799,10 @@ void ext4_mb_free_blocks(handle_t *handle, struct inode *inode, | |||
4755 | } | 4799 | } |
4756 | 4800 | ||
4757 | ext4_debug("freeing block %lu\n", block); | 4801 | ext4_debug("freeing block %lu\n", block); |
4802 | trace_mark(ext4_free_blocks, | ||
4803 | "dev %s block %llu count %lu metadata %d ino %lu", | ||
4804 | sb->s_id, (unsigned long long) block, count, metadata, | ||
4805 | inode ? inode->i_ino : 0); | ||
4758 | 4806 | ||
4759 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); | 4807 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); |
4760 | if (ac) { | 4808 | if (ac) { |