Skip to content

Commit 8c95006

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: add plock dev tracepoints
I currently debug nfs plock handling and introduce those two tracepoints for getting more information about what is happening there if the user space reads plock operations from kernel and writing the result back. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 67b5da9 commit 8c95006

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

fs/dlm/plock.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <linux/dlm_plock.h>
1212
#include <linux/slab.h>
1313

14+
#include <trace/events/dlm.h>
15+
1416
#include "dlm_internal.h"
1517
#include "lockspace.h"
1618

@@ -509,6 +511,8 @@ static ssize_t dev_read(struct file *file, char __user *u, size_t count,
509511
if (!op)
510512
return -EAGAIN;
511513

514+
trace_dlm_plock_read(&info);
515+
512516
/* there is no need to get a reply from userspace for unlocks
513517
that were generated by the vfs cleaning up for a close
514518
(the process did not make an unlock call). */
@@ -536,6 +540,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
536540
if (copy_from_user(&info, u, sizeof(info)))
537541
return -EFAULT;
538542

543+
trace_dlm_plock_write(&info);
544+
539545
if (check_version(&info))
540546
return -EINVAL;
541547

include/trace/events/dlm.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/dlm.h>
99
#include <linux/dlmconstants.h>
10+
#include <uapi/linux/dlm_plock.h>
1011
#include <linux/tracepoint.h>
1112

1213
#include "../../../fs/dlm/dlm_internal.h"
@@ -585,6 +586,56 @@ TRACE_EVENT(dlm_recv_message,
585586

586587
);
587588

589+
DECLARE_EVENT_CLASS(dlm_plock_template,
590+
591+
TP_PROTO(const struct dlm_plock_info *info),
592+
593+
TP_ARGS(info),
594+
595+
TP_STRUCT__entry(
596+
__field(uint8_t, optype)
597+
__field(uint8_t, ex)
598+
__field(uint8_t, wait)
599+
__field(uint8_t, flags)
600+
__field(uint32_t, pid)
601+
__field(int32_t, nodeid)
602+
__field(int32_t, rv)
603+
__field(uint32_t, fsid)
604+
__field(uint64_t, number)
605+
__field(uint64_t, start)
606+
__field(uint64_t, end)
607+
__field(uint64_t, owner)
608+
),
609+
610+
TP_fast_assign(
611+
__entry->optype = info->optype;
612+
__entry->ex = info->ex;
613+
__entry->wait = info->wait;
614+
__entry->flags = info->flags;
615+
__entry->pid = info->pid;
616+
__entry->nodeid = info->nodeid;
617+
__entry->rv = info->rv;
618+
__entry->fsid = info->fsid;
619+
__entry->number = info->number;
620+
__entry->start = info->start;
621+
__entry->end = info->end;
622+
__entry->owner = info->owner;
623+
),
624+
625+
TP_printk("fsid=%u number=%llx owner=%llx optype=%d ex=%d wait=%d flags=%x pid=%u nodeid=%d rv=%d start=%llx end=%llx",
626+
__entry->fsid, __entry->number, __entry->owner,
627+
__entry->optype, __entry->ex, __entry->wait,
628+
__entry->flags, __entry->pid, __entry->nodeid,
629+
__entry->rv, __entry->start, __entry->end)
630+
631+
);
632+
633+
DEFINE_EVENT(dlm_plock_template, dlm_plock_read,
634+
TP_PROTO(const struct dlm_plock_info *info), TP_ARGS(info));
635+
636+
DEFINE_EVENT(dlm_plock_template, dlm_plock_write,
637+
TP_PROTO(const struct dlm_plock_info *info), TP_ARGS(info));
638+
588639
TRACE_EVENT(dlm_send,
589640

590641
TP_PROTO(int nodeid, int ret),

0 commit comments

Comments
 (0)