Commit 376b91d5 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: convert BUG() for pending_del_nr into an ASSERT

This is a logic correctness check, convert it into an ASSERT() instead
of a BUG().
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
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 56e1edb0
...@@ -651,6 +651,9 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -651,6 +651,9 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
else else
control->last_size = new_size; control->last_size = new_size;
if (del_item) { if (del_item) {
ASSERT(!pending_del_nr ||
((path->slots[0] + 1) == pending_del_slot));
if (!pending_del_nr) { if (!pending_del_nr) {
/* No pending yet, add ourselves */ /* No pending yet, add ourselves */
pending_del_slot = path->slots[0]; pending_del_slot = path->slots[0];
...@@ -660,8 +663,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -660,8 +663,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
/* Hop on the pending chunk */ /* Hop on the pending chunk */
pending_del_nr++; pending_del_nr++;
pending_del_slot = path->slots[0]; pending_del_slot = path->slots[0];
} else {
BUG();
} }
} else { } else {
break; break;
......
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