btrfs: convert BUG() for pending_del_nr into an ASSERT
authorJosef Bacik <josef@toxicpanda.com>
Fri, 3 Dec 2021 22:18:17 +0000 (17:18 -0500)
committerDavid Sterba <dsterba@suse.com>
Fri, 7 Jan 2022 13:18:25 +0000 (14:18 +0100)
This is a logic correctness check, convert it into an ASSERT() instead
of a BUG().

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode-item.c

index 9356edb..f7b02ab 100644 (file)
@@ -651,6 +651,9 @@ delete:
                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];
@@ -660,8 +663,6 @@ delete:
                                /* Hop on the pending chunk */
                                pending_del_nr++;
                                pending_del_slot = path->slots[0];
-                       } else {
-                               BUG();
                        }
                } else {
                        break;