Commit f9c5b70c authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: convert correctness BUG_ON()'s to ASSERT()'s in walk_up_proc()

In walk_up_proc() we have several sanity checks that should only trip if
the programmer made a mistake.  Convert these to ASSERT()'s instead of
BUG_ON()'s.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b8ccef04
...@@ -5747,7 +5747,7 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, ...@@ -5747,7 +5747,7 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
u64 parent = 0; u64 parent = 0;
if (wc->stage == UPDATE_BACKREF) { if (wc->stage == UPDATE_BACKREF) {
BUG_ON(wc->shared_level < level); ASSERT(wc->shared_level >= level);
if (level < wc->shared_level) if (level < wc->shared_level)
goto out; goto out;
...@@ -5765,7 +5765,7 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, ...@@ -5765,7 +5765,7 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
* count is one. * count is one.
*/ */
if (!path->locks[level]) { if (!path->locks[level]) {
BUG_ON(level == 0); ASSERT(level > 0);
btrfs_tree_lock(eb); btrfs_tree_lock(eb);
path->locks[level] = BTRFS_WRITE_LOCK; path->locks[level] = BTRFS_WRITE_LOCK;
...@@ -5794,7 +5794,7 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, ...@@ -5794,7 +5794,7 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
} }
/* wc->stage == DROP_REFERENCE */ /* wc->stage == DROP_REFERENCE */
BUG_ON(wc->refs[level] > 1 && !path->locks[level]); ASSERT(path->locks[level] || wc->refs[level] == 1);
if (wc->refs[level] == 1) { if (wc->refs[level] == 1) {
if (level == 0) { if (level == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment