[PATCH 1/3] fscache: add tracepoints to fscache_parent_ready and fscache_done_parent_op

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add some tracepoints for tracking acquisition and release of parent
references.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 fs/fscache/object.c            |  2 ++
 include/trace/events/fscache.h | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/fs/fscache/object.c b/fs/fscache/object.c
index 3eac39ad3fae..a42b206c0659 100644
--- a/fs/fscache/object.c
+++ b/fs/fscache/object.c
@@ -156,6 +156,7 @@ static inline void fscache_done_parent_op(struct fscache_object *object)
 	spin_lock_nested(&parent->lock, 1);
 	parent->n_obj_ops--;
 	parent->n_ops--;
+	trace_fscache_parent(object, true);
 	if (parent->n_ops == 0)
 		fscache_raise_event(parent, FSCACHE_OBJECT_EV_CLEARED);
 	spin_unlock(&parent->lock);
@@ -437,6 +438,7 @@ static const struct fscache_state *fscache_parent_ready(struct fscache_object *o
 	parent->n_ops++;
 	parent->n_obj_ops++;
 	object->lookup_jif = jiffies;
+	trace_fscache_parent(object, false);
 	spin_unlock(&parent->lock);
 
 	_leave("");
diff --git a/include/trace/events/fscache.h b/include/trace/events/fscache.h
index dd2c794b5489..4c28aafcbb84 100644
--- a/include/trace/events/fscache.h
+++ b/include/trace/events/fscache.h
@@ -329,6 +329,35 @@ TRACE_EVENT(fscache_disable,
 		      __entry->n_children, __entry->n_active, __entry->flags)
 	    );
 
+TRACE_EVENT(fscache_parent,
+	    TP_PROTO(struct fscache_object *obj, bool done),
+
+	    TP_ARGS(obj, done),
+
+	    TP_STRUCT__entry(
+		    __field(unsigned int,	cookie	   )
+		    __field(unsigned int,	parent	   )
+		    __field(int,		n_obj_ops  )
+		    __field(int,		n_ops      )
+		    __field(int,		n_children )
+		    __field(bool,		done       )
+			     ),
+
+	    TP_fast_assign(
+		    __entry->cookie	= obj->cookie->debug_id;
+		    __entry->parent	= obj->parent->cookie->debug_id;
+		    __entry->n_obj_ops	= obj->parent->n_obj_ops;
+		    __entry->n_ops	= obj->parent->n_ops;
+		    __entry->n_children	= obj->parent->n_children;
+		    __entry->done	= done;
+			   ),
+
+	    TP_printk("c=%08x pc=%08x Noo=%d No=%d Nc=%d %s",
+		      __entry->cookie, __entry->parent, __entry->n_obj_ops,
+		      __entry->n_ops, __entry->n_children,
+		      __entry->done ? "DONE" : "READY")
+	    );
+
 TRACE_EVENT(fscache_osm,
 	    TP_PROTO(struct fscache_object *object,
 		     const struct fscache_state *state,
-- 
2.21.0

--
Linux-cachefs mailing list
Linux-cachefs@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cachefs





[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux