[Devel] [PATCH 3/3] fs/fuse kio: make it possible to enable TRACE/DTRACE in the release kernel
Pavel Butsykin
pbutsykin at virtuozzo.com
Wed Dec 5 21:03:48 MSK 2018
Sometimes it can be very convenient to enable detailed tracing on the release
kernel too.
Signed-off-by: Pavel Butsykin <pbutsykin 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..c77d9f3f8817 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 e4d23eb38208..f0bf0d31bdd2 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");
--
2.15.1
More information about the Devel
mailing list