]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: replace BUG_ON with ASSERT in walk_down_proc()
authorJosef Bacik <josef@toxicpanda.com>
Tue, 7 May 2024 18:12:12 +0000 (14:12 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 11 Jul 2024 13:33:25 +0000 (15:33 +0200)
We have a couple of areas where we check to make sure the tree block is
locked before looking up or messing with references.  This is old code
so it has this as BUG_ON().  Convert this to ASSERT() for developers.

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/extent-tree.c

index 53f12a12ee77e60fe4a64689a383f73cff3a9e6b..f399a0b05092f5dabebc8a570be9ad496bb149dc 100644 (file)
@@ -5391,7 +5391,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
        if (wc->lookup_info &&
            ((wc->stage == DROP_REFERENCE && wc->refs[level] != 1) ||
             (wc->stage == UPDATE_BACKREF && !(wc->flags[level] & flag)))) {
-               BUG_ON(!path->locks[level]);
+               ASSERT(path->locks[level]);
                ret = btrfs_lookup_extent_info(trans, fs_info,
                                               eb->start, level, 1,
                                               &wc->refs[level],
@@ -5415,7 +5415,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
 
        /* wc->stage == UPDATE_BACKREF */
        if (!(wc->flags[level] & flag)) {
-               BUG_ON(!path->locks[level]);
+               ASSERT(path->locks[level]);
                ret = btrfs_inc_ref(trans, root, eb, 1);
                if (ret) {
                        btrfs_abort_transaction(trans, ret);