]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: change BUG_ON to assertion when verifying lockdep class setup
authorDavid Sterba <dsterba@suse.com>
Tue, 23 Jan 2024 22:09:18 +0000 (23:09 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 4 Mar 2024 15:24:48 +0000 (16:24 +0100)
The BUG_ON in btrfs_set_buffer_lockdep_class() is a sanity check of the
level which is verified in callers, e.g. when initializing an extent
buffer or reading from an eb header. Change it to an assertion as this
would not happen unless things are really bad and would fail elsewhere
too.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/locking.c

index 286e6aa721c73d11b7441760865fd60a743e696d..99ccab86bb865689f3183ff6230158d26b4a6709 100644 (file)
@@ -84,7 +84,7 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb, int
 {
        struct btrfs_lockdep_keyset *ks;
 
-       BUG_ON(level >= ARRAY_SIZE(ks->keys));
+       ASSERT(level < ARRAY_SIZE(ks->keys));
 
        /* Find the matching keyset, id 0 is the default entry */
        for (ks = btrfs_lockdep_keysets; ks->id; ks++)