From 94e78414f94419ea6b08c13a96118d2065b02566 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 22 Jun 2017 13:00:33 -0700 Subject: [PATCH] scoutfs: add key trace class Some item tracing functions were really just tracing a key. Refactor it into a trace class with event users. Later patches can then use the key trace class. Signed-off-by: Zach Brown --- kmod/src/item.c | 4 ++-- kmod/src/scoutfs_trace.h | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/kmod/src/item.c b/kmod/src/item.c index b3e9d8f5..b0ab001d 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -408,7 +408,7 @@ restart: } } - trace_scoutfs_item_insertion(sb, ins->key, ins->val); + trace_scoutfs_item_insertion(sb, ins->key); rb_link_node(&ins->node, parent, node); rb_insert_augmented(&ins->node, root, &scoutfs_item_rb_cb); @@ -632,7 +632,7 @@ int scoutfs_item_lookup(struct super_block *sb, struct scoutfs_key_buf *key, unsigned long flags; int ret; - trace_scoutfs_item_lookup(sb, key, val); + trace_scoutfs_item_lookup(sb, key); end = scoutfs_key_alloc(sb, SCOUTFS_MAX_KEY_SIZE); if (!end) { diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index 98bb8f25..d31c0415 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -204,10 +204,9 @@ TRACE_EVENT(scoutfs_manifest_add, __entry->seq, __entry->level) ); -TRACE_EVENT(scoutfs_item_lookup, - TP_PROTO(struct super_block *sb, struct scoutfs_key_buf *key, - struct kvec *val), - TP_ARGS(sb, key, val), +DECLARE_EVENT_CLASS(scoutfs_key_class, + TP_PROTO(struct super_block *sb, struct scoutfs_key_buf *key), + TP_ARGS(sb, key), TP_STRUCT__entry( __dynamic_array(char, key, scoutfs_key_str(NULL, key)) ), @@ -217,17 +216,14 @@ TRACE_EVENT(scoutfs_item_lookup, TP_printk("key %s", __get_str(key)) ); -TRACE_EVENT(scoutfs_item_insertion, - TP_PROTO(struct super_block *sb, struct scoutfs_key_buf *key, - struct kvec *val), - TP_ARGS(sb, key, val), - TP_STRUCT__entry( - __dynamic_array(char, key, scoutfs_key_str(NULL, key)) - ), - TP_fast_assign( - scoutfs_key_str(__get_dynamic_array(key), key); - ), - TP_printk("key %s", __get_str(key)) +DEFINE_EVENT(scoutfs_key_class, scoutfs_item_lookup, + TP_PROTO(struct super_block *sb, struct scoutfs_key_buf *key), + TP_ARGS(sb, key) +); + +DEFINE_EVENT(scoutfs_key_class, scoutfs_item_insertion, + TP_PROTO(struct super_block *sb, struct scoutfs_key_buf *key), + TP_ARGS(sb, key) ); DECLARE_EVENT_CLASS(scoutfs_range_class,