scoutfs: add some tracing to dlmglue

The cluster_lock and cluster_unlock traces are close to each other but not
quite there so they have to be two different traces (thanks tracepoints!).
The rest (ocfs2_unblock_lock, ocfs2_simple_drop_lock) can use a shared trace
class.

Signed-off-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
Mark Fasheh
2017-12-12 13:43:11 -06:00
committed by Zach Brown
parent ee96b650f0
commit 4a043dfd3f
2 changed files with 137 additions and 1 deletions

View File

@@ -38,6 +38,8 @@
#include "dlmglue.h"
#include "scoutfs_trace.h"
#ifdef TRACE_DLMGLUE
#define mlog(mask, fmt, args...) trace_printk(fmt , ##args)
#define mlog_errno(st) do { \
@@ -1106,6 +1108,8 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
int dlm_locked = 0;
int kick_dc = 0;
trace_ocfs2_cluster_lock(osb, lockres, level, lkm_flags, arg_flags);
if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED)) {
mlog_errno(-EINVAL);
return -EINVAL;
@@ -1319,7 +1323,6 @@ int ocfs2_cluster_lock(struct ocfs2_super *osb,
0, _RET_IP_);
}
static void __ocfs2_cluster_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level,
@@ -1327,6 +1330,8 @@ static void __ocfs2_cluster_unlock(struct ocfs2_super *osb,
{
unsigned long flags;
trace_ocfs2_cluster_unlock(osb, lockres, level);
spin_lock_irqsave(&lockres->l_lock, flags);
ocfs2_dec_holders(lockres, level);
ocfs2_downconvert_on_unlock(osb, lockres);
@@ -2223,6 +2228,8 @@ void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
{
int ret;
trace_ocfs2_simple_drop_lockres(osb, lockres);
ocfs2_mark_lockres_freeing(osb, lockres);
ret = ocfs2_drop_lock(osb, lockres);
if (ret)
@@ -2360,6 +2367,8 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
int set_lvb = 0;
unsigned int gen;
trace_ocfs2_unblock_lock(osb, lockres);
spin_lock_irqsave(&lockres->l_lock, flags);
recheck:

View File

@@ -35,6 +35,8 @@
#include "ioctl.h"
#include "count.h"
#include "bio.h"
#include "dlmglue.h"
#include "stackglue.h"
struct lock_info;
@@ -1943,6 +1945,131 @@ DEFINE_EVENT(scoutfs_super_lifecycle_class, scoutfs_kill_sb,
TP_ARGS(sb)
);
TRACE_EVENT(ocfs2_cluster_lock,
TP_PROTO(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres,
int requested, unsigned int lkm_flags, unsigned int arg_flags),
TP_ARGS(osb, lockres, requested, lkm_flags, arg_flags),
TP_STRUCT__entry(
__field(char *, lockspace)
__field(int, lockspace_len)
__field(char *, lockname)
__field(int, requested)
__field(unsigned int, lkm_flags)
__field(unsigned int, arg_flags)
__field(unsigned int, lockres_flags)
__field(int, lockres_level)
__field(int, blocking)
__field(unsigned int, cw_holders)
__field(unsigned int, pr_holders)
__field(unsigned int, ex_holders)
),
TP_fast_assign(
__entry->lockspace = osb->cconn->cc_name;
__entry->lockspace_len = osb->cconn->cc_namelen;
__entry->lockname = lockres->l_pretty_name;
__entry->requested = requested;
__entry->lkm_flags = lkm_flags;
__entry->arg_flags = arg_flags;
__entry->lockres_flags = lockres->l_flags;
__entry->lockres_level = lockres->l_level;
__entry->blocking = lockres->l_blocking;
__entry->cw_holders = lockres->l_cw_holders;
__entry->pr_holders = lockres->l_ro_holders;
__entry->ex_holders = lockres->l_ex_holders;
),
TP_printk("lockspace %.*s lock %s requested %d lkm_flags 0x%x arg_flags 0x%x lockres->level %d lockres->flags 0x%x lockres->blocking %d holders cw/pr/ex %u/%u/%u",
__entry->lockspace_len, __entry->lockspace, __entry->lockname,
__entry->requested, __entry->lkm_flags, __entry->arg_flags,
__entry->lockres_level, __entry->lockres_flags, __entry->blocking,
__entry->cw_holders, __entry->pr_holders, __entry->ex_holders)
);
TRACE_EVENT(ocfs2_cluster_unlock,
TP_PROTO(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres,
int level),
TP_ARGS(osb, lockres, level),
TP_STRUCT__entry(
__field(char *, lockspace)
__field(int, lockspace_len)
__field(char *, lockname)
__field(int, level)
__field(unsigned int, lockres_flags)
__field(int, lockres_level)
__field(int, blocking)
__field(unsigned int, cw_holders)
__field(unsigned int, pr_holders)
__field(unsigned int, ex_holders)
),
TP_fast_assign(
__entry->lockspace = osb->cconn->cc_name;
__entry->lockspace_len = osb->cconn->cc_namelen;
__entry->lockname = lockres->l_pretty_name;
__entry->level = level;
__entry->lockres_flags = lockres->l_flags;
__entry->lockres_level = lockres->l_level;
__entry->blocking = lockres->l_blocking;
__entry->cw_holders = lockres->l_cw_holders;
__entry->pr_holders = lockres->l_ro_holders;
__entry->ex_holders = lockres->l_ex_holders;
),
TP_printk("lockspace %.*s lock %s level %d lockres->level %d lockres->flags 0x%x lockres->blocking %d holders cw/pr/ex: %u/%u/%u",
__entry->lockspace_len, __entry->lockspace, __entry->lockname,
__entry->level, __entry->lockres_level, __entry->lockres_flags,
__entry->blocking, __entry->cw_holders, __entry->pr_holders,
__entry->ex_holders)
);
DECLARE_EVENT_CLASS(ocfs2_lock_res_class,
TP_PROTO(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres),
TP_ARGS(osb, lockres),
TP_STRUCT__entry(
__field(char *, lockspace)
__field(int, lockspace_len)
__field(char *, lockname)
__field(unsigned int, lockres_flags)
__field(int, lockres_level)
__field(int, blocking)
__field(unsigned int, cw_holders)
__field(unsigned int, pr_holders)
__field(unsigned int, ex_holders)
),
TP_fast_assign(
__entry->lockspace = osb->cconn->cc_name;
__entry->lockspace_len = osb->cconn->cc_namelen;
__entry->lockname = lockres->l_pretty_name;
__entry->lockres_flags = lockres->l_flags;
__entry->lockres_level = lockres->l_level;
__entry->blocking = lockres->l_blocking;
__entry->cw_holders = lockres->l_cw_holders;
__entry->pr_holders = lockres->l_ro_holders;
__entry->ex_holders = lockres->l_ex_holders;
),
TP_printk("lockspace %.*s lock %s lockres->level %d lockres->flags 0x%x lockres->blocking %d holders cw/pr/ex: %u/%u/%u",
__entry->lockspace_len, __entry->lockspace, __entry->lockname,
__entry->lockres_level, __entry->lockres_flags, __entry->blocking,
__entry->cw_holders, __entry->pr_holders, __entry->ex_holders)
);
DEFINE_EVENT(ocfs2_lock_res_class, ocfs2_simple_drop_lockres,
TP_PROTO(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres),
TP_ARGS(osb, lockres)
);
DEFINE_EVENT(ocfs2_lock_res_class, ocfs2_unblock_lock,
TP_PROTO(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres),
TP_ARGS(osb, lockres)
);
#endif /* _TRACE_SCOUTFS_H */
/* This part must be outside protection */