All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH dlm/next] fs: dlm: add lkb attach resource trace
@ 2022-01-17 15:38 Alexander Aring
  0 siblings, 0 replies; only message in thread
From: Alexander Aring @ 2022-01-17 15:38 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This patch adds a tracpoint for dlm_attach() which indicates the local
lkb is attached to a global resource. This becomes useful to make a
connection between a local ls_id and lkb_id (from e.g. dlm_lock_start
tracepoint) to a global lock reference which is the same cluster-wide.

The trace printk will look like the following output:

ls_id=3841231384, lkb_id=23, res_name=202020202020203520202020202020202020343531356462, res_length=24

Most time the resource name using ASCII codec which allows us to print it
out. However this is not required. The printout used here will represent
the resource name as a bytewise hexademical string.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/lock.c              |  1 +
 include/trace/events/dlm.h | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index bdb51d209ba2..f6ad96de4f3b 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1169,6 +1169,7 @@ static void kill_rsb(struct kref *kref)
 static void attach_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
 	hold_rsb(r);
+	trace_dlm_attach_lkb(lkb, r);
 	lkb->lkb_resource = r;
 }
 
diff --git a/include/trace/events/dlm.h b/include/trace/events/dlm.h
index 32088c603244..53b81faa5877 100644
--- a/include/trace/events/dlm.h
+++ b/include/trace/events/dlm.h
@@ -214,6 +214,34 @@ TRACE_EVENT(dlm_unlock_end,
 
 );
 
+TRACE_EVENT(dlm_attach_lkb,
+
+	TP_PROTO(const struct dlm_lkb *lkb, const struct dlm_rsb *r),
+
+	TP_ARGS(lkb, r),
+
+	TP_STRUCT__entry(
+		__field(__u32, ls_id)
+		__field(__u32, lkb_id)
+		__field(int, res_length)
+		__dynamic_array(unsigned char, res_name, r->res_length)
+	),
+
+	TP_fast_assign(
+		__entry->ls_id = r->res_ls->ls_global_id;
+		__entry->lkb_id = lkb->lkb_id;
+		__entry->res_length = r->res_length;
+		memcpy(__get_dynamic_array(res_name), r->res_name,
+		       __get_dynamic_array_len(res_name));
+	),
+
+	TP_printk("ls_id=%u, lkb_id=%x, res_name=%s, res_length=%d",
+		  __entry->ls_id, __entry->lkb_id,
+		  __print_hex_str(__get_dynamic_array(res_name),
+				  __get_dynamic_array_len(res_name)),
+		  __entry->res_length)
+);
+
 TRACE_EVENT(dlm_send,
 
 	TP_PROTO(int nodeid, int ret),
-- 
2.31.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-17 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 15:38 [Cluster-devel] [PATCH dlm/next] fs: dlm: add lkb attach resource trace Alexander Aring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.