aboutsummaryrefslogtreecommitdiff
path: root/include/trace/events/btrfs.h
diff options
context:
space:
mode:
authorGravatar Josef Bacik <josef@toxicpanda.com> 2020-10-09 09:28:19 -0400
committerGravatar David Sterba <dsterba@suse.com> 2021-02-08 22:58:58 +0100
commitac1ea10e757a57fb61512ae9beb2ef67e5340e31 (patch)
treedab384f192cb229fcbe3929615fb502cb2debc63 /include/trace/events/btrfs.h
parentbtrfs: make flush_space take a enum btrfs_flush_state instead of int (diff)
downloadlinux-ac1ea10e757a57fb61512ae9beb2ef67e5340e31.tar.gz
linux-ac1ea10e757a57fb61512ae9beb2ef67e5340e31.tar.bz2
linux-ac1ea10e757a57fb61512ae9beb2ef67e5340e31.zip
btrfs: add a trace point for reserve tickets
While debugging a ENOSPC related performance problem I needed to see the time difference between start and end of a reserve ticket, so add a trace point to report when we handle a reserve ticket. I opted to spit out start_ns itself without calculating the difference because there could be a gap between enabling the tracepoint and setting start_ns. Doing it this way allows us to filter on 0 start_ns so we don't get bogus entries, and we can easily calculate the time difference with bpftrace or something else. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/trace/events/btrfs.h')
-rw-r--r--include/trace/events/btrfs.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index b9896fc06160..b0ea2a108be3 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -2026,6 +2026,35 @@ TRACE_EVENT(btrfs_convert_extent_bit,
__print_flags(__entry->clear_bits, "|", EXTENT_FLAGS))
);
+TRACE_EVENT(btrfs_reserve_ticket,
+ TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
+ u64 start_ns, int flush, int error),
+
+ TP_ARGS(fs_info, flags, bytes, start_ns, flush, error),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, flags )
+ __field( u64, bytes )
+ __field( u64, start_ns )
+ __field( int, flush )
+ __field( int, error )
+ ),
+
+ TP_fast_assign_btrfs(fs_info,
+ __entry->flags = flags;
+ __entry->bytes = bytes;
+ __entry->start_ns = start_ns;
+ __entry->flush = flush;
+ __entry->error = error;
+ ),
+
+ TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d",
+ __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS),
+ __entry->bytes, __entry->start_ns,
+ __print_symbolic(__entry->flush, FLUSH_ACTIONS),
+ __entry->error)
+);
+
DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock,
TP_PROTO(const struct extent_buffer *eb, u64 start_ns),