From ae748f0ebcf814709c419eddee050614c1aaf85f Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 5 Jul 2016 14:20:19 -0700 Subject: [PATCH] scoutfs: allow tracing with a null sb The sb counter field isn't necessary, allow a null sb pointer arg which then results in a counter output of 0. Signed-off-by: Zach Brown --- kmod/src/trace.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kmod/src/trace.h b/kmod/src/trace.h index 0e9e3735..7f890843 100644 --- a/kmod/src/trace.h +++ b/kmod/src/trace.h @@ -97,7 +97,8 @@ static inline void only_check_format(const char *fmt, ...) */ #define scoutfs_trace(sb, fmt, ...) \ do { \ - struct scoutfs_sb_info *__sbi = SCOUTFS_SB(sb); \ + struct super_block *__sb = (sb); \ + u64 __sbi_ctr = __sb ? SCOUTFS_SB(__sb)->ctr : 0; \ static char __scoutfs_trace_section __fmt[] = \ "[%llu.%llu] %llu %llu %llu " __stringify(__LINE__) ": "\ fmt; \ @@ -111,7 +112,7 @@ do { \ do_gettimeofday(&__tv); \ \ __trace_write(__fmt, CAST_ARGS_U64(__tv.tv_sec, __tv.tv_usec, \ - __sbi->ctr, current->pid, get_cpu(), \ + __sbi_ctr, current->pid, get_cpu(), \ __VA_ARGS__)); \ put_cpu(); \ } while (0)