[2/3] fs/fuse kio: disable duplication FUSE_K* messages to debugfs by default

Submitted by Pavel Butsykin on Dec. 5, 2018, 6:03 p.m.

Details

Message ID 20181205180348.16714-3-pbutsykin@virtuozzo.com
State New
Series "kio_pcs: Compact the logs and make eyes happy"
Headers show

Commit Message

Pavel Butsykin Dec. 5, 2018, 6:03 p.m.
It's not very polite to put trace messages to debugfs without asking the user,
while they are only used for easier debugging fuse_kio_pcs module. This patch
disables debugfs tracing by default and makes it possible to enable this traces
via debugfs_tracing option.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 7bedb7f95486..e4d23eb38208 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -31,6 +31,10 @@  unsigned int pcs_loglevel = LOG_TRACE;
 module_param(pcs_loglevel, uint, 0644);
 MODULE_PARM_DESC(pcs_loglevel, "Trace level");
 
+unsigned int debugfs_tracing;
+module_param(debugfs_tracing, uint, 0644);
+MODULE_PARM_DESC(debugfs_tracing, "Enable/Disbale debugfs tracing");
+
 #ifdef CONFIG_DEBUG_KERNEL
 static int set_sockio_fail_percent(const char *val, struct kernel_param *kp)
 {
@@ -1472,10 +1476,12 @@  void __kfuse_trace(struct fuse_conn * fc, unsigned long ip, const char * fmt, ..
 		if (t)
 			memcpy(t + 1, buf, len + 1);
 		FUSE_TRACE_COMMIT(tr);
-		if (ip)
-			__trace_puts(ip, buf, len);
-		else
-			pr_debug("%s\n", buf);
+		if (unlikely(debugfs_tracing)) {
+			if (ip)
+				__trace_puts(ip, buf, len);
+			else
+				pr_debug("%s\n", buf);
+		}
 	}
 	put_cpu();
 }