public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lianjun Huang <hljhnu@gmail.com>
To: miklos@szeredi.hu
Cc: hljhnu@gmail.com, linux-fsdevel@vger.kernel.org,
	fuse-devel@lists.sourceforge.net
Subject: [PATCH] fuse: add tracepoints for request
Date: Thu, 4 Nov 2021 12:20:37 +0800	[thread overview]
Message-ID: <20211104042037.GA7088@ubuntu-PC> (raw)

Change-Id: I361d582f30a04040969f1774064d5d1a4b646389
Signed-off-by: Lianjun Huang <hljhnu@gmail.com>
---
 fs/fuse/dev.c               |  4 ++++
 include/trace/events/fuse.h | 27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 include/trace/events/fuse.h

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 9d2d321bd60b..83f20799683d 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -23,6 +23,8 @@
 #include <linux/splice.h>
 #include <linux/sched.h>
 #include <linux/freezer.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/fuse.h>
 
 MODULE_ALIAS_MISCDEV(FUSE_MINOR);
 MODULE_ALIAS("devname:fuse");
@@ -323,6 +325,7 @@ static u64 fuse_get_unique(struct fuse_iqueue *fiq)
 
 static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req)
 {
+	trace_fuse_info(req->in.h.opcode, req->in.h.unique, req->in.h.nodeid, "queue request");
 	req->in.h.len = sizeof(struct fuse_in_header) +
 		len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
 	list_add_tail(&req->list, &fiq->pending);
@@ -417,6 +420,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
 	if (req->end)
 		req->end(fc, req);
 put_request:
+	trace_fuse_info(req->in.h.opcode, req->in.h.unique, req->in.h.nodeid, "request end");
 	fuse_put_request(fc, req);
 }
 
diff --git a/include/trace/events/fuse.h b/include/trace/events/fuse.h
new file mode 100644
index 000000000000..da471c0db9b6
--- /dev/null
+++ b/include/trace/events/fuse.h
@@ -0,0 +1,27 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM fuse
+#if !defined(_TRACE_FUSE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_FUSE_H
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(fuse_info,
+		TP_PROTO(uint32_t opcode, uint64_t unique, uint64_t nodeid, const char *info),
+		TP_ARGS(opcode, unique, nodeid, info),
+		TP_STRUCT__entry(
+			__field(uint32_t, opcode)
+			__field(uint64_t, unique)
+			__field(uint64_t, nodeid)
+			__string(info, info)
+			),
+		TP_fast_assign(
+			__entry->opcode	= opcode;
+			__entry->unique = unique;
+			__entry->nodeid = nodeid;
+			__assign_str(info, info);
+			),
+		TP_printk("fuse: opcode %u, unique %lu, nodeid %lu %s\n",
+			__entry->opcode, __entry->unique, __entry->nodeid, __get_str(info))
+	   );
+#endif
+
+#include <trace/define_trace.h>
-- 
2.17.1


             reply	other threads:[~2021-11-04  4:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04  4:20 Lianjun Huang [this message]
2021-11-04 10:11 ` [PATCH] fuse: add tracepoints for request Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211104042037.GA7088@ubuntu-PC \
    --to=hljhnu@gmail.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox