scoutfs: add coarse lock lifetime tracing

Add tracepoints for allocated lock structs entering the tree and finally
being freed.  This gives visibility into the lifetime of locks without
using much higher frequency per-operation tracing that blow out other
events.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-11-10 14:55:42 -08:00
committed by Mark Fasheh
parent 7767a8a48e
commit c292a3ceb8
2 changed files with 12 additions and 0 deletions

View File

@@ -128,6 +128,7 @@ static void put_scoutfs_lock(struct super_block *sb, struct scoutfs_lock *lock)
BUG_ON(!lock->refcnt);
refs = --lock->refcnt;
if (!refs) {
trace_scoutfs_lock_free(sb, lock);
rb_erase(&lock->node, &linfo->lock_tree);
list_del(&lock->lru_entry);
spin_unlock(&linfo->lock);
@@ -312,6 +313,7 @@ search:
new = NULL;
found->refcnt = 1; /* Freed by shrinker or on umount */
found->sequence = ++linfo->seq_cnt;
trace_scoutfs_lock_rb_insert(sb, found);
rb_link_node(&found->node, parent, node);
rb_insert_color(&found->node, &linfo->lock_tree);
scoutfs_inc_counter(sb, lock_alloc);

View File

@@ -1662,6 +1662,16 @@ DEFINE_EVENT(scoutfs_lock_class, shrink_lock_tree,
TP_ARGS(sb, lck)
);
DEFINE_EVENT(scoutfs_lock_class, scoutfs_lock_rb_insert,
TP_PROTO(struct super_block *sb, struct scoutfs_lock *lck),
TP_ARGS(sb, lck)
);
DEFINE_EVENT(scoutfs_lock_class, scoutfs_lock_free,
TP_PROTO(struct super_block *sb, struct scoutfs_lock *lck),
TP_ARGS(sb, lck)
);
DECLARE_EVENT_CLASS(scoutfs_seg_class,
TP_PROTO(struct scoutfs_segment *seg),
TP_ARGS(seg),