Commit 8197766d authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: include delalloc related info in dump space info tracepoint

In order to debug delalloc flushing issues I added delalloc_bytes and
ordered_bytes to this tracepoint to see if they were non-zero when we
were going ENOSPC. This was valuable for me and showed me cases where we
weren't waiting on ordered extents properly. In order to add this to the
tracepoint we need to take away the const modifier for fs_info, as
percpu_sum_counter_positive() will change the counter when it adds up
the percpu buckets.  This is needed to make sure we're getting accurate
information at these tracepoints, as the wrong information could send us
down the wrong path when debugging problems.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ac98141d
...@@ -2037,7 +2037,7 @@ TRACE_EVENT(btrfs_convert_extent_bit, ...@@ -2037,7 +2037,7 @@ TRACE_EVENT(btrfs_convert_extent_bit,
); );
DECLARE_EVENT_CLASS(btrfs_dump_space_info, DECLARE_EVENT_CLASS(btrfs_dump_space_info,
TP_PROTO(const struct btrfs_fs_info *fs_info, TP_PROTO(struct btrfs_fs_info *fs_info,
const struct btrfs_space_info *sinfo), const struct btrfs_space_info *sinfo),
TP_ARGS(fs_info, sinfo), TP_ARGS(fs_info, sinfo),
...@@ -2057,6 +2057,8 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info, ...@@ -2057,6 +2057,8 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info,
__field( u64, delayed_refs_reserved ) __field( u64, delayed_refs_reserved )
__field( u64, delayed_reserved ) __field( u64, delayed_reserved )
__field( u64, free_chunk_space ) __field( u64, free_chunk_space )
__field( u64, delalloc_bytes )
__field( u64, ordered_bytes )
), ),
TP_fast_assign_btrfs(fs_info, TP_fast_assign_btrfs(fs_info,
...@@ -2074,6 +2076,8 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info, ...@@ -2074,6 +2076,8 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info,
__entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved; __entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved;
__entry->delayed_reserved = fs_info->delayed_block_rsv.reserved; __entry->delayed_reserved = fs_info->delayed_block_rsv.reserved;
__entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space); __entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space);
__entry->delalloc_bytes = percpu_counter_sum_positive(&fs_info->delalloc_bytes);
__entry->ordered_bytes = percpu_counter_sum_positive(&fs_info->ordered_bytes);
), ),
TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu " TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu "
...@@ -2081,7 +2085,8 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info, ...@@ -2081,7 +2085,8 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info,
"bytes_may_use=%llu bytes_readonly=%llu " "bytes_may_use=%llu bytes_readonly=%llu "
"reclaim_size=%llu clamp=%d global_reserved=%llu " "reclaim_size=%llu clamp=%d global_reserved=%llu "
"trans_reserved=%llu delayed_refs_reserved=%llu " "trans_reserved=%llu delayed_refs_reserved=%llu "
"delayed_reserved=%llu chunk_free_space=%llu", "delayed_reserved=%llu chunk_free_space=%llu "
"delalloc_bytes=%llu ordered_bytes=%llu",
__print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS),
__entry->total_bytes, __entry->bytes_used, __entry->total_bytes, __entry->bytes_used,
__entry->bytes_pinned, __entry->bytes_reserved, __entry->bytes_pinned, __entry->bytes_reserved,
...@@ -2089,11 +2094,12 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info, ...@@ -2089,11 +2094,12 @@ DECLARE_EVENT_CLASS(btrfs_dump_space_info,
__entry->reclaim_size, __entry->clamp, __entry->reclaim_size, __entry->clamp,
__entry->global_reserved, __entry->trans_reserved, __entry->global_reserved, __entry->trans_reserved,
__entry->delayed_refs_reserved, __entry->delayed_refs_reserved,
__entry->delayed_reserved, __entry->free_chunk_space) __entry->delayed_reserved, __entry->free_chunk_space,
__entry->delalloc_bytes, __entry->ordered_bytes)
); );
DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim, DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim,
TP_PROTO(const struct btrfs_fs_info *fs_info, TP_PROTO(struct btrfs_fs_info *fs_info,
const struct btrfs_space_info *sinfo), const struct btrfs_space_info *sinfo),
TP_ARGS(fs_info, sinfo) TP_ARGS(fs_info, sinfo)
); );
......
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