[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: make it possible to enable TRACE/DTRACE in the release kernel

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jan 10 13:22:11 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.4
------>
commit 59a46f05edea38edff2d245070da855e8250b8c6
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Thu Jan 10 13:22:09 2019 +0300

    fs/fuse kio: make it possible to enable TRACE/DTRACE in the release kernel
    
    Sometimes it can be very convenient to enable detailed tracing on the release
    kernel too.
    
    https://pmc.acronis.com/browse/VSTOR-18383
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Acked-by: Pavel Emelianov <xemul at virtuozzo.com>
---
 fs/fuse/kio/pcs/fuse_ktrace.h      |  6 ++++++
 fs/fuse/kio/pcs/log.h              | 10 +++-------
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/kio/pcs/fuse_ktrace.h b/fs/fuse/kio/pcs/fuse_ktrace.h
index 1950b872ef4a..7cce9e26959a 100644
--- a/fs/fuse/kio/pcs/fuse_ktrace.h
+++ b/fs/fuse/kio/pcs/fuse_ktrace.h
@@ -4,6 +4,12 @@
 #include "fuse_ktrace_prot.h"
 #include <linux/relay.h>
 
+#ifdef CONFIG_FUSE_KIO_DEBUG
+#define DEBUGFS_TRACE 1
+#else
+#define DEBUGFS_TRACE 0
+#endif /* CONFIG_FUSE_KIO_DEBUG */
+
 #define KTRACE_LOG_BUF_SIZE	256
 
 struct fuse_ktrace
diff --git a/fs/fuse/kio/pcs/log.h b/fs/fuse/kio/pcs/log.h
index a26ed08a557a..0097eaffb2a2 100644
--- a/fs/fuse/kio/pcs/log.h
+++ b/fs/fuse/kio/pcs/log.h
@@ -22,12 +22,8 @@
 #define LOG_DTRACE LOG_DEBUG4
 
 extern unsigned int pcs_loglevel;
+extern unsigned int debugfs_tracing;
 
-#ifdef CONFIG_FUSE_KIO_DEBUG
-#define TRACE(fmt, args...)	if (pcs_loglevel >= LOG_TRACE) trace_printk("%d: " fmt "\n", __LINE__, ## args)
-#define DTRACE(fmt, args...)	if (pcs_loglevel >= LOG_DTRACE) trace_printk("%d: " fmt "\n", __LINE__, ## args)
-#else
-#define TRACE(fmt, ...) do {} while (0)
-#define DTRACE(fmt, ...) do {} while (0)
-#endif /* CONFIG_FUSE_KIO_DEBUG */
+#define TRACE(fmt, args...)	if (unlikely(debugfs_tracing && pcs_loglevel >= LOG_TRACE)) trace_printk("%d: " fmt "\n", __LINE__, ## args)
+#define DTRACE(fmt, args...)	if (unlikely(debugfs_tracing && pcs_loglevel >= LOG_DTRACE)) trace_printk("%d: " fmt "\n", __LINE__, ## args)
 #endif /* __PCSLOG_H__ */
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index bef782942335..948bfc66deeb 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -31,7 +31,7 @@ unsigned int pcs_loglevel = LOG_TRACE;
 module_param(pcs_loglevel, uint, 0644);
 MODULE_PARM_DESC(pcs_loglevel, "Trace level");
 
-unsigned int debugfs_tracing;
+unsigned int debugfs_tracing = DEBUGFS_TRACE;
 module_param(debugfs_tracing, uint, 0644);
 MODULE_PARM_DESC(debugfs_tracing, "Enable/Disbale debugfs tracing");
 



More information about the Devel mailing list