From d3982100baeb9bed8cf931545fb0522268f526e5 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 17 Jul 2014 12:39:00 -0700 Subject: btrfs: add trace for qgroup accounting We want this to debug qgroup changes on live systems. Signed-off-by: Mark Fasheh Reviewed-by: Josef Bacik Signed-off-by: Chris Mason --- include/trace/events/btrfs.h | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'include') diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 4ee4e30d26d9..b8774b3f88d7 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -23,6 +23,7 @@ struct map_lookup; struct extent_buffer; struct btrfs_work; struct __btrfs_workqueue; +struct btrfs_qgroup_operation; #define show_ref_type(type) \ __print_symbolic(type, \ @@ -1119,6 +1120,61 @@ DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, TP_ARGS(wq) ); +#define show_oper_type(type) \ + __print_symbolic(type, \ + { BTRFS_QGROUP_OPER_ADD_EXCL, "OPER_ADD_EXCL" }, \ + { BTRFS_QGROUP_OPER_ADD_SHARED, "OPER_ADD_SHARED" }, \ + { BTRFS_QGROUP_OPER_SUB_EXCL, "OPER_SUB_EXCL" }, \ + { BTRFS_QGROUP_OPER_SUB_SHARED, "OPER_SUB_SHARED" }) + +DECLARE_EVENT_CLASS(btrfs_qgroup_oper, + + TP_PROTO(struct btrfs_qgroup_operation *oper), + + TP_ARGS(oper), + + TP_STRUCT__entry( + __field( u64, ref_root ) + __field( u64, bytenr ) + __field( u64, num_bytes ) + __field( u64, seq ) + __field( int, type ) + __field( u64, elem_seq ) + ), + + TP_fast_assign( + __entry->ref_root = oper->ref_root; + __entry->bytenr = oper->bytenr, + __entry->num_bytes = oper->num_bytes; + __entry->seq = oper->seq; + __entry->type = oper->type; + __entry->elem_seq = oper->elem.seq; + ), + + TP_printk("ref_root = %llu, bytenr = %llu, num_bytes = %llu, " + "seq = %llu, elem.seq = %llu, type = %s", + (unsigned long long)__entry->ref_root, + (unsigned long long)__entry->bytenr, + (unsigned long long)__entry->num_bytes, + (unsigned long long)__entry->seq, + (unsigned long long)__entry->elem_seq, + show_oper_type(__entry->type)) +); + +DEFINE_EVENT(btrfs_qgroup_oper, btrfs_qgroup_account, + + TP_PROTO(struct btrfs_qgroup_operation *oper), + + TP_ARGS(oper) +); + +DEFINE_EVENT(btrfs_qgroup_oper, btrfs_qgroup_record_ref, + + TP_PROTO(struct btrfs_qgroup_operation *oper), + + TP_ARGS(oper) +); + #endif /* _TRACE_BTRFS_H */ /* This part must be outside protection */ -- cgit v1.2.3 From b38a62586fed4ce058dc8d40deaa1b85cafc7fb3 Mon Sep 17 00:00:00 2001 From: Liu Bo Date: Tue, 12 Aug 2014 16:33:17 +0800 Subject: Btrfs: add work_struct information for workqueue tracepoint Kernel workqueue's tracepoints print the address of work_struct, while btrfs workqueue's tracepoints print the address of btrfs_work. We need a connection between this two, for example when debuging, we usually grep an address in the trace output. So it'd be better to also print work_struct in btrfs workqueue's tracepoint. Please note that we can only add this into those tracepoints whose work is still available in memory because we need to reference the work. Signed-off-by: Liu Bo Signed-off-by: Chris Mason --- include/trace/events/btrfs.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index b8774b3f88d7..e3f3d10c6647 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -997,6 +997,7 @@ DECLARE_EVENT_CLASS(btrfs__work, __field( void *, func ) __field( void *, ordered_func ) __field( void *, ordered_free ) + __field( void *, normal_work ) ), TP_fast_assign( @@ -1005,11 +1006,13 @@ DECLARE_EVENT_CLASS(btrfs__work, __entry->func = work->func; __entry->ordered_func = work->ordered_func; __entry->ordered_free = work->ordered_free; + __entry->normal_work = &work->normal_work; ), - TP_printk("work=%p, wq=%p, func=%p, ordered_func=%p, ordered_free=%p", - __entry->work, __entry->wq, __entry->func, - __entry->ordered_func, __entry->ordered_free) + TP_printk("work=%p (normal_work=%p), wq=%p, func=%p, ordered_func=%p," + " ordered_free=%p", + __entry->work, __entry->normal_work, __entry->wq, + __entry->func, __entry->ordered_func, __entry->ordered_free) ); /* For situiations that the work is freed */ -- cgit v1.2.3 From 1a76e4ba5b18775e532faa4f8eb858c4553d196c Mon Sep 17 00:00:00 2001 From: Liu Bo Date: Tue, 12 Aug 2014 16:33:18 +0800 Subject: Btrfs: cleanup for btrfs workqueue tracepoints Tracepoint trace_btrfs_normal_work_done never has an user, just cleanup it. Signed-off-by: Liu Bo Signed-off-by: Chris Mason --- include/trace/events/btrfs.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index e3f3d10c6647..64a90d78e6bb 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -1047,13 +1047,6 @@ DEFINE_EVENT(btrfs__work, btrfs_work_sched, TP_ARGS(work) ); -DEFINE_EVENT(btrfs__work, btrfs_normal_work_done, - - TP_PROTO(struct btrfs_work *work), - - TP_ARGS(work) -); - DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, TP_PROTO(struct btrfs_work *work), -- cgit v1.2.3 From b7831b20f32019b741eb8fe3435c2516e13e0c4a Mon Sep 17 00:00:00 2001 From: Liu Bo Date: Fri, 15 Aug 2014 23:38:06 +0800 Subject: Btrfs: show real function name in btrfs workqueue tracepoint Use %pf instead of %p, just same as kernel workqueue tracepoints. Signed-off-by: Liu Bo Reviewed-by: David Sterba Signed-off-by: Chris Mason --- include/trace/events/btrfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 64a90d78e6bb..e022a60699df 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -1009,7 +1009,7 @@ DECLARE_EVENT_CLASS(btrfs__work, __entry->normal_work = &work->normal_work; ), - TP_printk("work=%p (normal_work=%p), wq=%p, func=%p, ordered_func=%p," + TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p," " ordered_free=%p", __entry->work, __entry->normal_work, __entry->wq, __entry->func, __entry->ordered_func, __entry->ordered_free) -- cgit v1.2.3 From 254a2d14fa77ac8a1b64f6171ec5f717f0753b53 Mon Sep 17 00:00:00 2001 From: Liu Bo Date: Wed, 17 Sep 2014 21:36:41 +0800 Subject: Btrfs: fix wrong parse of extent map's tracepoint The tracepoint of extent map doesn't parse @flag correctly, we set @flag via set_bit(), so we need to parse it on a bit bias. Also add the missing flag, EXTENT_FLAG_FS_MAPPING. Signed-off-by: Liu Bo Signed-off-by: Chris Mason --- include/trace/events/btrfs.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index e022a60699df..1faecea101f3 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -158,12 +158,13 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, #define show_map_flags(flag) \ __print_flags(flag, "|", \ - { EXTENT_FLAG_PINNED, "PINNED" }, \ - { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ - { EXTENT_FLAG_VACANCY, "VACANCY" }, \ - { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \ - { EXTENT_FLAG_LOGGING, "LOGGING" }, \ - { EXTENT_FLAG_FILLING, "FILLING" }) + { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ + { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ + { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ + { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ + { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ + { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ + { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) TRACE_EVENT_CONDITION(btrfs_get_extent, -- cgit v1.2.3