Commit c51e7bb1 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

Btrfs: trace pinned extents

Pinned extents are an important metric to keep track of for enospc.
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 957780eb
...@@ -6246,6 +6246,9 @@ static int update_block_group(struct btrfs_trans_handle *trans, ...@@ -6246,6 +6246,9 @@ static int update_block_group(struct btrfs_trans_handle *trans,
spin_unlock(&cache->lock); spin_unlock(&cache->lock);
spin_unlock(&cache->space_info->lock); spin_unlock(&cache->space_info->lock);
trace_btrfs_space_reservation(root->fs_info, "pinned",
cache->space_info->flags,
num_bytes, 1);
set_extent_dirty(info->pinned_extents, set_extent_dirty(info->pinned_extents,
bytenr, bytenr + num_bytes - 1, bytenr, bytenr + num_bytes - 1,
GFP_NOFS | __GFP_NOFAIL); GFP_NOFS | __GFP_NOFAIL);
...@@ -6320,6 +6323,8 @@ static int pin_down_extent(struct btrfs_root *root, ...@@ -6320,6 +6323,8 @@ static int pin_down_extent(struct btrfs_root *root,
spin_unlock(&cache->lock); spin_unlock(&cache->lock);
spin_unlock(&cache->space_info->lock); spin_unlock(&cache->space_info->lock);
trace_btrfs_space_reservation(root->fs_info, "pinned",
cache->space_info->flags, num_bytes, 1);
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) if (reserved)
...@@ -6678,6 +6683,9 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end, ...@@ -6678,6 +6683,9 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end,
spin_lock(&cache->lock); spin_lock(&cache->lock);
cache->pinned -= len; cache->pinned -= len;
space_info->bytes_pinned -= len; space_info->bytes_pinned -= len;
trace_btrfs_space_reservation(fs_info, "pinned",
space_info->flags, len, 0);
space_info->max_extent_size = 0; space_info->max_extent_size = 0;
percpu_counter_add(&space_info->total_bytes_pinned, -len); percpu_counter_add(&space_info->total_bytes_pinned, -len);
if (cache->ro) { if (cache->ro) {
......
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