@@ -96,10 +96,7 @@ void internal_error(const char *fmt, ...)
vfprintf(stderr, fmt, vargs);
va_end(vargs);
fputc('\n', stderr);
-
-#ifndef BTRFS_DISABLE_BACKTRACE
print_trace();
-#endif
}
static bool should_print(int level)
@@ -94,17 +94,17 @@
#define BUILD_ASSERT(x)
#endif
-#ifndef BTRFS_DISABLE_BACKTRACE
-#define MAX_BACKTRACE 16
static inline void print_trace(void)
{
+#ifndef BTRFS_DISABLE_BACKTRACE
+#define MAX_BACKTRACE 16
void *array[MAX_BACKTRACE];
int size;
size = backtrace(array, MAX_BACKTRACE);
backtrace_symbols_fd(array, size, 2);
-}
#endif
+}
static inline void warning_trace(const char *assertion, const char *filename,
const char *func, unsigned line, long val)
@@ -114,9 +114,7 @@ static inline void warning_trace(const char *assertion, const char *filename,
fprintf(stderr,
"%s:%u: %s: Warning: assertion `%s` failed, value %ld\n",
filename, line, func, assertion, val);
-#ifndef BTRFS_DISABLE_BACKTRACE
print_trace();
-#endif
}
static inline void bugon_trace(const char *assertion, const char *filename,
@@ -127,9 +125,7 @@ static inline void bugon_trace(const char *assertion, const char *filename,
fprintf(stderr,
"%s:%u: %s: BUG_ON `%s` triggered, value %ld\n",
filename, line, func, assertion, val);
-#ifndef BTRFS_DISABLE_BACKTRACE
print_trace();
-#endif
abort();
exit(1);
}
Everybody who calls print_trace wraps it around this check, move the check instead to print_trace and remove the check from all the callers. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- common/messages.c | 3 --- include/kerncompat.h | 10 +++------- 2 files changed, 3 insertions(+), 10 deletions(-)