linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: add tracepoints for request
@ 2021-11-04  4:20 Lianjun Huang
  2021-11-04 10:11 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Lianjun Huang @ 2021-11-04  4:20 UTC (permalink / raw)
  To: miklos; +Cc: hljhnu, linux-fsdevel, fuse-devel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fuse: add tracepoints for request
  2021-11-04  4:20 [PATCH] fuse: add tracepoints for request Lianjun Huang
@ 2021-11-04 10:11 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2021-11-04 10:11 UTC (permalink / raw)
  To: Lianjun Huang; +Cc: linux-fsdevel, fuse-devel

On Thu, 4 Nov 2021 at 05:20, Lianjun Huang <hljhnu@gmail.com> wrote:
>
> 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");

I'm very much reluctant to add tracepoints to fuse at all.

Fuse protocol is traceable on the syscall interface (with strace) so I
don't see how this adds any value.

Can you please explain why you need this and why is tracing on the
userspace ABI not sufficient?

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-04 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04  4:20 [PATCH] fuse: add tracepoints for request Lianjun Huang
2021-11-04 10:11 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).