Skip to content

Commit 05bfadc

Browse files
fdmananakdave
authored andcommitted
btrfs: add unlikely to critical error in btrfs_extend_item()
It's not expected to get a data size less than the leaf's free space, which would lead to a leaf dump and BUG(), so tag the if statement's expression as unlikely, hinting the compiler to potentially generate better code. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 3d07e35 commit 05bfadc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/ctree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4132,7 +4132,7 @@ void btrfs_extend_item(struct btrfs_trans_handle *trans,
41324132
nritems = btrfs_header_nritems(leaf);
41334133
data_end = leaf_data_end(leaf);
41344134

4135-
if (btrfs_leaf_free_space(leaf) < data_size) {
4135+
if (unlikely(btrfs_leaf_free_space(leaf) < data_size)) {
41364136
btrfs_print_leaf(leaf);
41374137
BUG();
41384138
}

0 commit comments

Comments
 (0)