btrfs-progs: Fix disable backtrace assert error
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 19 Jan 2017 04:00:03 +0000 (12:00 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 25 Jan 2017 08:48:13 +0000 (09:48 +0100)
commit5826f1e9ff5d8e3df8d48a09f6b95a4ef4309950
tree0333d3b5a8bfcc570fa93a464f3478e81dabcb00
parent795cfb9b1735c09f108c91f93b578203cd865163
btrfs-progs: Fix disable backtrace assert error

Due to commit 00e769d04c2c83029d6c71(btrfs-progs: Correct value printed
by assertions/BUG_ON/WARN_ON), which changed the assert_trace()
parameter, the condition passed to assert/WARN_ON/BUG_ON are logical
notted for backtrace enabled and disabled case.

Such behavior makes us easier to pass value wrong, and in fact it did
cause us to pass wrong condition for ASSERT().

Instead of passing different conditions for ASSERT/WARN_ON/BUG_ON()
manually, this patch will use ASSERT() to implement the resting
ASSERT/WARN_ON/BUG() for disable backtrace case, and use assert_trace()
to implement ASSERT() and BUG_ON(), to allow them to print correct
value.

Also, move WARN_ON() out of the ifdef branch, as it's completely the
same for both branches.

Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
kerncompat.h