[Devel] [PATCH RHEL7 COMMIT] fuse kio: control internal tracing with module parameter pcs_loglevel
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Jul 19 13:22:02 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-862.6.3.vz7.62.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.6.3.vz7.62.4
------>
commit 43f91058a8d7ae149843892099f9a0d3ad1e62e1
Author: Alexey Kuznetsov <kuznet at virtuozzo.com>
Date: Thu Jul 19 13:22:02 2018 +0300
fuse kio: control internal tracing with module parameter pcs_loglevel
Tracing can affect performance, so that allow to disable it with:
echo 1 > /sys/module/fuse_kio_pcs/parameters/pcs_loglevel
Default level is set to LOG_TRACE=7. Maybe, we will want to reduce
this to 1.
NOTE: this is only for kernel specific internal trace messages,
this does not affect stangard messages relayed to vstorage-mount.
Their verbosity is still controlled by loglevel set via fusectl fs,
which is planned to be bound to userspace loglevel.
Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
---
fs/fuse/kio/pcs/log.h | 6 ++++--
fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 4 ++++
fs/fuse/kio/pcs/pcs_rpc.c | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/fuse/kio/pcs/log.h b/fs/fuse/kio/pcs/log.h
index 5127470d6f7e..5309e2e5102b 100644
--- a/fs/fuse/kio/pcs/log.h
+++ b/fs/fuse/kio/pcs/log.h
@@ -21,6 +21,8 @@
#define LOG_DTRACE LOG_DEBUG4
+extern unsigned int pcs_loglevel;
+
#define __PCS_DEBUG__ 1
#define __PCS_DTRACE__ 1
@@ -29,12 +31,12 @@
#define TRACE(fmt, ...) do {} while (0)
#define DTRACE(fmt, ...) do {} while (0)
#else
-#define TRACE(fmt, args...) trace_printk("%d: " fmt "\n", __LINE__, ## args)
+#define TRACE(fmt, args...) if (pcs_loglevel >= LOG_TRACE) trace_printk("%d: " fmt "\n", __LINE__, ## args)
#ifndef __PCS_DTRACE__
#define DTRACE(fmt, ...) do {} while (0)
#else
-#define DTRACE(fmt, args...) trace_printk("%d: " fmt "\n", __LINE__, ## args)
+#define DTRACE(fmt, args...) if (pcs_loglevel >= LOG_DTRACE) trace_printk("%d: " fmt "\n", __LINE__, ## args)
#endif /* __PCS_DTRACE__ */
#endif /* __PCS_DEBUG__ */
#endif /* __PCSLOG_H__ */
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 9d81792c5807..8a6f9e60fece 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -27,6 +27,10 @@
#include "fuse_ktrace.h"
#include "fuse_prometheus.h"
+unsigned int pcs_loglevel = LOG_TRACE;
+module_param(pcs_loglevel, uint, 0644);
+MODULE_PARM_DESC(pcs_loglevel, "Trace level");
+
static int fuse_ktrace_setup(struct fuse_conn * fc);
static int fuse_ktrace_remove(struct fuse_conn *fc);
diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index c8737b96d932..a26624785fa9 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -557,7 +557,7 @@ void pcs_rpc_connect(struct pcs_rpc * ep)
if (ep->state != PCS_RPC_UNCONN)
return;
- TRACE("Connecting to node " NODE_FMT "\n", NODE_ARGS(ep->peer_id));
+ FUSE_KTRACE(cc_from_rpc(ep->eng)->fc, "Connecting to node " NODE_FMT "\n", NODE_ARGS(ep->peer_id));
BUG_ON(!ep->ops->connect);
ep->ops->connect(ep);
More information about the Devel
mailing list