Skip to content

Commit 129e40f

Browse files
fdmananakdave
authored andcommitted
btrfs: mark ordered extent insertion failure checks as unlikely
We never expect an ordered extent insertion to fail due to already having another ordered extent in the tree for the same file offset, since we always wait for existing ordered extents in a range to complete before writing into the range again. So mark the failure checks for the results of tree_insert() as unlikely, to make it clear it's never expected (save exceptional causes like bugs or memory corruptions) and to serve as a hint for the compiler to possibly generate better code. Reviewed-by: Josef Bacik <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 6c8e66e commit 129e40f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/ordered-data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static void insert_ordered_extent(struct btrfs_ordered_extent *entry)
224224
spin_lock_irq(&inode->ordered_tree_lock);
225225
node = tree_insert(&inode->ordered_tree, entry->file_offset,
226226
&entry->rb_node);
227-
if (node)
227+
if (unlikely(node))
228228
btrfs_panic(fs_info, -EEXIST,
229229
"inconsistency in ordered tree at offset %llu",
230230
entry->file_offset);
@@ -1303,7 +1303,7 @@ struct btrfs_ordered_extent *btrfs_split_ordered_extent(
13031303
}
13041304

13051305
node = tree_insert(&inode->ordered_tree, new->file_offset, &new->rb_node);
1306-
if (node)
1306+
if (unlikely(node))
13071307
btrfs_panic(fs_info, -EEXIST,
13081308
"zoned: inconsistency in ordered tree at offset %llu",
13091309
new->file_offset);

0 commit comments

Comments
 (0)