btrfs-progs: move BTRFS_DISABLE_BACKTRACE check in print_trace

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>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-04-19 17:13:47 -04:00 committed by David Sterba
parent bf0f3db765
commit e051593934
2 changed files with 3 additions and 10 deletions

View File

@ -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)

View File

@ -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);
}