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

Pavel Butsykin pbutsykin at virtuozzo.com
Wed Dec 5 21:03:47 MSK 2018


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 at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

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();
 }
-- 
2.15.1



More information about the Devel mailing list