mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 15:42:23 +00:00
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:
parent
bf0f3db765
commit
e051593934
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user