Skip to content

Commit 4ebe8d4

Browse files
fdmananakdave
authored andcommitted
btrfs: mark transaction id check as unlikely at btrfs_mark_buffer_dirty()
At btrfs_mark_buffer_dirty(), having a transaction id mismatch is never expected to happen and it usually means there's a bug or some memory corruption due to a bitflip for example. So mark the condition as unlikely to optimize code generation as well as to make it obvious for human readers that it is a very unexpected condition. Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 20cbe46 commit 4ebe8d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/disk-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4403,7 +4403,7 @@ void btrfs_mark_buffer_dirty(struct btrfs_trans_handle *trans,
44034403
/* This is an active transaction (its state < TRANS_STATE_UNBLOCKED). */
44044404
ASSERT(trans->transid == fs_info->generation);
44054405
btrfs_assert_tree_write_locked(buf);
4406-
if (transid != fs_info->generation) {
4406+
if (unlikely(transid != fs_info->generation)) {
44074407
btrfs_abort_transaction(trans, -EUCLEAN);
44084408
btrfs_crit(fs_info,
44094409
"dirty buffer transid mismatch, logical %llu found transid %llu running transid %llu",

0 commit comments

Comments
 (0)