aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorLiu Bo <liubo2009@cn.fujitsu.com>2012-03-29 09:57:44 -0400
committerChris Mason <chris.mason@oracle.com>2012-03-29 09:57:44 -0400
commit2bcc0328c3a043880796a602c75fbeb1537aa1e1 (patch)
treeed18c3244abeda587b56498ca5da5609f3555d99 /fs/btrfs/extent-tree.c
parent7ca4be45a0255ac8f08c05491c6add2dd87dd4f8 (diff)
Btrfs: show useful info in space reservation tracepoint
o For space info, the type of space info is useful for debug. o For transaction handle, its transid is useful. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 8fe517bd8521..7c233407beee 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3363,8 +3363,7 @@ commit_trans:
3363 } 3363 }
3364 data_sinfo->bytes_may_use += bytes; 3364 data_sinfo->bytes_may_use += bytes;
3365 trace_btrfs_space_reservation(root->fs_info, "space_info", 3365 trace_btrfs_space_reservation(root->fs_info, "space_info",
3366 (u64)(unsigned long)data_sinfo, 3366 data_sinfo->flags, bytes, 1);
3367 bytes, 1);
3368 spin_unlock(&data_sinfo->lock); 3367 spin_unlock(&data_sinfo->lock);
3369 3368
3370 return 0; 3369 return 0;
@@ -3385,8 +3384,7 @@ void btrfs_free_reserved_data_space(struct inode *inode, u64 bytes)
3385 spin_lock(&data_sinfo->lock); 3384 spin_lock(&data_sinfo->lock);
3386 data_sinfo->bytes_may_use -= bytes; 3385 data_sinfo->bytes_may_use -= bytes;
3387 trace_btrfs_space_reservation(root->fs_info, "space_info", 3386 trace_btrfs_space_reservation(root->fs_info, "space_info",
3388 (u64)(unsigned long)data_sinfo, 3387 data_sinfo->flags, bytes, 0);
3389 bytes, 0);
3390 spin_unlock(&data_sinfo->lock); 3388 spin_unlock(&data_sinfo->lock);
3391} 3389}
3392 3390
@@ -3751,9 +3749,7 @@ again:
3751 if (used + orig_bytes <= space_info->total_bytes) { 3749 if (used + orig_bytes <= space_info->total_bytes) {
3752 space_info->bytes_may_use += orig_bytes; 3750 space_info->bytes_may_use += orig_bytes;
3753 trace_btrfs_space_reservation(root->fs_info, 3751 trace_btrfs_space_reservation(root->fs_info,
3754 "space_info", 3752 "space_info", space_info->flags, orig_bytes, 1);
3755 (u64)(unsigned long)space_info,
3756 orig_bytes, 1);
3757 ret = 0; 3753 ret = 0;
3758 } else { 3754 } else {
3759 /* 3755 /*
@@ -3822,9 +3818,7 @@ again:
3822 if (used + num_bytes < space_info->total_bytes + avail) { 3818 if (used + num_bytes < space_info->total_bytes + avail) {
3823 space_info->bytes_may_use += orig_bytes; 3819 space_info->bytes_may_use += orig_bytes;
3824 trace_btrfs_space_reservation(root->fs_info, 3820 trace_btrfs_space_reservation(root->fs_info,
3825 "space_info", 3821 "space_info", space_info->flags, orig_bytes, 1);
3826 (u64)(unsigned long)space_info,
3827 orig_bytes, 1);
3828 ret = 0; 3822 ret = 0;
3829 } else { 3823 } else {
3830 wait_ordered = true; 3824 wait_ordered = true;
@@ -3970,8 +3964,7 @@ static void block_rsv_release_bytes(struct btrfs_fs_info *fs_info,
3970 spin_lock(&space_info->lock); 3964 spin_lock(&space_info->lock);
3971 space_info->bytes_may_use -= num_bytes; 3965 space_info->bytes_may_use -= num_bytes;
3972 trace_btrfs_space_reservation(fs_info, "space_info", 3966 trace_btrfs_space_reservation(fs_info, "space_info",
3973 (u64)(unsigned long)space_info, 3967 space_info->flags, num_bytes, 0);
3974 num_bytes, 0);
3975 space_info->reservation_progress++; 3968 space_info->reservation_progress++;
3976 spin_unlock(&space_info->lock); 3969 spin_unlock(&space_info->lock);
3977 } 3970 }
@@ -4189,14 +4182,14 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info)
4189 block_rsv->reserved += num_bytes; 4182 block_rsv->reserved += num_bytes;
4190 sinfo->bytes_may_use += num_bytes; 4183 sinfo->bytes_may_use += num_bytes;
4191 trace_btrfs_space_reservation(fs_info, "space_info", 4184 trace_btrfs_space_reservation(fs_info, "space_info",
4192 (u64)(unsigned long)sinfo, num_bytes, 1); 4185 sinfo->flags, num_bytes, 1);
4193 } 4186 }
4194 4187
4195 if (block_rsv->reserved >= block_rsv->size) { 4188 if (block_rsv->reserved >= block_rsv->size) {
4196 num_bytes = block_rsv->reserved - block_rsv->size; 4189 num_bytes = block_rsv->reserved - block_rsv->size;
4197 sinfo->bytes_may_use -= num_bytes; 4190 sinfo->bytes_may_use -= num_bytes;
4198 trace_btrfs_space_reservation(fs_info, "space_info", 4191 trace_btrfs_space_reservation(fs_info, "space_info",
4199 (u64)(unsigned long)sinfo, num_bytes, 0); 4192 sinfo->flags, num_bytes, 0);
4200 sinfo->reservation_progress++; 4193 sinfo->reservation_progress++;
4201 block_rsv->reserved = block_rsv->size; 4194 block_rsv->reserved = block_rsv->size;
4202 block_rsv->full = 1; 4195 block_rsv->full = 1;
@@ -4250,8 +4243,7 @@ void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
4250 return; 4243 return;
4251 4244
4252 trace_btrfs_space_reservation(root->fs_info, "transaction", 4245 trace_btrfs_space_reservation(root->fs_info, "transaction",
4253 (u64)(unsigned long)trans, 4246 trans->transid, trans->bytes_reserved, 0);
4254 trans->bytes_reserved, 0);
4255 btrfs_block_rsv_release(root, trans->block_rsv, trans->bytes_reserved); 4247 btrfs_block_rsv_release(root, trans->block_rsv, trans->bytes_reserved);
4256 trans->bytes_reserved = 0; 4248 trans->bytes_reserved = 0;
4257} 4249}
@@ -4770,9 +4762,8 @@ static int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache,
4770 space_info->bytes_reserved += num_bytes; 4762 space_info->bytes_reserved += num_bytes;
4771 if (reserve == RESERVE_ALLOC) { 4763 if (reserve == RESERVE_ALLOC) {
4772 trace_btrfs_space_reservation(cache->fs_info, 4764 trace_btrfs_space_reservation(cache->fs_info,
4773 "space_info", 4765 "space_info", space_info->flags,
4774 (u64)(unsigned long)space_info, 4766 num_bytes, 0);
4775 num_bytes, 0);
4776 space_info->bytes_may_use -= num_bytes; 4767 space_info->bytes_may_use -= num_bytes;
4777 } 4768 }
4778 } 4769 }