From: Alexander Aring Date: Mon, 17 Jan 2022 10:38:39 -0500 Subject: [Cluster-devel] [PATCH dlm/next] fs: dlm: add lkb attach resource trace Message-ID: <20220117153839.2654806-1-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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