Commit 0be5dc67 authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

Btrfs: fixup reserved trace points

In trying to track down where we were leaking reserved space I noticed our
reserve extent tracepoints are a little off.  First we were saying that the
reserved space had been alloced in btrfs_reserve_extent, which isn't the case,
this needs to be triggered when we actually allocate the space when we run the
delayed ref.  We were also missing a few places where we should have been
tracing the btrfs_reserve_extent_free tracepoint.  With these in place I was
able to put together where we were leaking reserved space.  Thanks,
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 2b1360da
...@@ -5262,6 +5262,8 @@ static int pin_down_extent(struct btrfs_root *root, ...@@ -5262,6 +5262,8 @@ static int pin_down_extent(struct btrfs_root *root,
set_extent_dirty(root->fs_info->pinned_extents, bytenr, set_extent_dirty(root->fs_info->pinned_extents, bytenr,
bytenr + num_bytes - 1, GFP_NOFS | __GFP_NOFAIL); bytenr + num_bytes - 1, GFP_NOFS | __GFP_NOFAIL);
if (reserved)
trace_btrfs_reserved_extent_free(root, bytenr, num_bytes);
return 0; return 0;
} }
...@@ -5965,6 +5967,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, ...@@ -5965,6 +5967,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
btrfs_add_free_space(cache, buf->start, buf->len); btrfs_add_free_space(cache, buf->start, buf->len);
btrfs_update_reserved_bytes(cache, buf->len, RESERVE_FREE); btrfs_update_reserved_bytes(cache, buf->len, RESERVE_FREE);
trace_btrfs_reserved_extent_free(root, buf->start, buf->len);
pin = 0; pin = 0;
} }
out: out:
...@@ -6592,8 +6595,6 @@ int btrfs_reserve_extent(struct btrfs_root *root, ...@@ -6592,8 +6595,6 @@ int btrfs_reserve_extent(struct btrfs_root *root,
} }
} }
trace_btrfs_reserved_extent_alloc(root, ins->objectid, ins->offset);
return ret; return ret;
} }
...@@ -6705,6 +6706,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, ...@@ -6705,6 +6706,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
ins->objectid, ins->offset); ins->objectid, ins->offset);
BUG(); BUG();
} }
trace_btrfs_reserved_extent_alloc(root, ins->objectid, ins->offset);
return ret; return ret;
} }
...@@ -6777,6 +6779,8 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans, ...@@ -6777,6 +6779,8 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
ins->objectid, ins->offset); ins->objectid, ins->offset);
BUG(); BUG();
} }
trace_btrfs_reserved_extent_alloc(root, ins->objectid, root->leafsize);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment