@@ -655,6 +655,9 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
else
control->last_size = new_size;
if (del_item) {
+ ASSERT(!pending_del_nr ||
+ ((path->slots[0] + 1) == pending_del_slot));
+
if (!pending_del_nr) {
/* no pending yet, add ourselves */
pending_del_slot = path->slots[0];
@@ -664,8 +667,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
/* hop on the pending chunk */
pending_del_nr++;
pending_del_slot = path->slots[0];
- } else {
- BUG();
}
} else {
break;
This is a logic correctness check, convert it into an ASSERT() instead of a BUG(). Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/inode-item.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)