@@ -293,11 +293,11 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
293293
294294 if (new_root_objectid == BTRFS_TREE_RELOC_OBJECTID ) {
295295 ret = btrfs_inc_ref (trans , root , cow , 1 );
296- if (ret )
296+ if (unlikely ( ret ) )
297297 btrfs_abort_transaction (trans , ret );
298298 } else {
299299 ret = btrfs_inc_ref (trans , root , cow , 0 );
300- if (ret )
300+ if (unlikely ( ret ) )
301301 btrfs_abort_transaction (trans , ret );
302302 }
303303 if (ret ) {
@@ -536,14 +536,14 @@ int btrfs_force_cow_block(struct btrfs_trans_handle *trans,
536536 write_extent_buffer_fsid (cow , fs_info -> fs_devices -> metadata_uuid );
537537
538538 ret = update_ref_for_cow (trans , root , buf , cow , & last_ref );
539- if (ret ) {
539+ if (unlikely ( ret ) ) {
540540 btrfs_abort_transaction (trans , ret );
541541 goto error_unlock_cow ;
542542 }
543543
544544 if (test_bit (BTRFS_ROOT_SHAREABLE , & root -> state )) {
545545 ret = btrfs_reloc_cow_block (trans , root , buf , cow );
546- if (ret ) {
546+ if (unlikely ( ret ) ) {
547547 btrfs_abort_transaction (trans , ret );
548548 goto error_unlock_cow ;
549549 }
@@ -556,7 +556,7 @@ int btrfs_force_cow_block(struct btrfs_trans_handle *trans,
556556 parent_start = buf -> start ;
557557
558558 ret = btrfs_tree_mod_log_insert_root (root -> node , cow , true);
559- if (ret < 0 ) {
559+ if (unlikely ( ret < 0 ) ) {
560560 btrfs_abort_transaction (trans , ret );
561561 goto error_unlock_cow ;
562562 }
@@ -567,15 +567,15 @@ int btrfs_force_cow_block(struct btrfs_trans_handle *trans,
567567 parent_start , last_ref );
568568 free_extent_buffer (buf );
569569 add_root_to_dirty_list (root );
570- if (ret < 0 ) {
570+ if (unlikely ( ret < 0 ) ) {
571571 btrfs_abort_transaction (trans , ret );
572572 goto error_unlock_cow ;
573573 }
574574 } else {
575575 WARN_ON (trans -> transid != btrfs_header_generation (parent ));
576576 ret = btrfs_tree_mod_log_insert_key (parent , parent_slot ,
577577 BTRFS_MOD_LOG_KEY_REPLACE );
578- if (ret ) {
578+ if (unlikely ( ret ) ) {
579579 btrfs_abort_transaction (trans , ret );
580580 goto error_unlock_cow ;
581581 }
@@ -586,14 +586,14 @@ int btrfs_force_cow_block(struct btrfs_trans_handle *trans,
586586 btrfs_mark_buffer_dirty (trans , parent );
587587 if (last_ref ) {
588588 ret = btrfs_tree_mod_log_free_eb (buf );
589- if (ret ) {
589+ if (unlikely ( ret ) ) {
590590 btrfs_abort_transaction (trans , ret );
591591 goto error_unlock_cow ;
592592 }
593593 }
594594 ret = btrfs_free_tree_block (trans , btrfs_root_id (root ), buf ,
595595 parent_start , last_ref );
596- if (ret < 0 ) {
596+ if (unlikely ( ret < 0 ) ) {
597597 btrfs_abort_transaction (trans , ret );
598598 goto error_unlock_cow ;
599599 }
@@ -922,7 +922,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
922922 }
923923
924924 ret = btrfs_tree_mod_log_insert_root (root -> node , child , true);
925- if (ret < 0 ) {
925+ if (unlikely ( ret < 0 ) ) {
926926 btrfs_tree_unlock (child );
927927 free_extent_buffer (child );
928928 btrfs_abort_transaction (trans , ret );
@@ -944,7 +944,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
944944 ret = btrfs_free_tree_block (trans , btrfs_root_id (root ), mid , 0 , 1 );
945945 /* once for the root ptr */
946946 free_extent_buffer_stale (mid );
947- if (ret < 0 ) {
947+ if (unlikely ( ret < 0 ) ) {
948948 btrfs_abort_transaction (trans , ret );
949949 goto out ;
950950 }
@@ -1019,7 +1019,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
10191019 right , 0 , 1 );
10201020 free_extent_buffer_stale (right );
10211021 right = NULL ;
1022- if (ret < 0 ) {
1022+ if (unlikely ( ret < 0 ) ) {
10231023 btrfs_abort_transaction (trans , ret );
10241024 goto out ;
10251025 }
@@ -1028,7 +1028,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
10281028 btrfs_node_key (right , & right_key , 0 );
10291029 ret = btrfs_tree_mod_log_insert_key (parent , pslot + 1 ,
10301030 BTRFS_MOD_LOG_KEY_REPLACE );
1031- if (ret < 0 ) {
1031+ if (unlikely ( ret < 0 ) ) {
10321032 btrfs_abort_transaction (trans , ret );
10331033 goto out ;
10341034 }
@@ -1080,7 +1080,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
10801080 ret = btrfs_free_tree_block (trans , btrfs_root_id (root ), mid , 0 , 1 );
10811081 free_extent_buffer_stale (mid );
10821082 mid = NULL ;
1083- if (ret < 0 ) {
1083+ if (unlikely ( ret < 0 ) ) {
10841084 btrfs_abort_transaction (trans , ret );
10851085 goto out ;
10861086 }
@@ -1090,7 +1090,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
10901090 btrfs_node_key (mid , & mid_key , 0 );
10911091 ret = btrfs_tree_mod_log_insert_key (parent , pslot ,
10921092 BTRFS_MOD_LOG_KEY_REPLACE );
1093- if (ret < 0 ) {
1093+ if (unlikely ( ret < 0 ) ) {
10941094 btrfs_abort_transaction (trans , ret );
10951095 goto out ;
10961096 }
@@ -1195,7 +1195,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
11951195 btrfs_node_key (mid , & disk_key , 0 );
11961196 ret = btrfs_tree_mod_log_insert_key (parent , pslot ,
11971197 BTRFS_MOD_LOG_KEY_REPLACE );
1198- if (ret < 0 ) {
1198+ if (unlikely ( ret < 0 ) ) {
11991199 btrfs_tree_unlock (left );
12001200 free_extent_buffer (left );
12011201 btrfs_abort_transaction (trans , ret );
@@ -1255,7 +1255,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
12551255 btrfs_node_key (right , & disk_key , 0 );
12561256 ret = btrfs_tree_mod_log_insert_key (parent , pslot + 1 ,
12571257 BTRFS_MOD_LOG_KEY_REPLACE );
1258- if (ret < 0 ) {
1258+ if (unlikely ( ret < 0 ) ) {
12591259 btrfs_tree_unlock (right );
12601260 free_extent_buffer (right );
12611261 btrfs_abort_transaction (trans , ret );
@@ -2737,7 +2737,7 @@ static int push_node_left(struct btrfs_trans_handle *trans,
27372737 return ret ;
27382738 }
27392739 ret = btrfs_tree_mod_log_eb_copy (dst , src , dst_nritems , 0 , push_items );
2740- if (ret ) {
2740+ if (unlikely ( ret ) ) {
27412741 btrfs_abort_transaction (trans , ret );
27422742 return ret ;
27432743 }
@@ -2822,7 +2822,7 @@ static int balance_node_right(struct btrfs_trans_handle *trans,
28222822
28232823 ret = btrfs_tree_mod_log_eb_copy (dst , src , 0 , src_nritems - push_items ,
28242824 push_items );
2825- if (ret ) {
2825+ if (unlikely ( ret ) ) {
28262826 btrfs_abort_transaction (trans , ret );
28272827 return ret ;
28282828 }
@@ -2892,7 +2892,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
28922892
28932893 btrfs_clear_buffer_dirty (trans , c );
28942894 ret2 = btrfs_free_tree_block (trans , btrfs_root_id (root ), c , 0 , 1 );
2895- if (ret2 < 0 )
2895+ if (unlikely ( ret2 < 0 ) )
28962896 btrfs_abort_transaction (trans , ret2 );
28972897 btrfs_tree_unlock (c );
28982898 free_extent_buffer (c );
@@ -2937,7 +2937,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans,
29372937 if (level ) {
29382938 ret = btrfs_tree_mod_log_insert_move (lower , slot + 1 ,
29392939 slot , nritems - slot );
2940- if (ret < 0 ) {
2940+ if (unlikely ( ret < 0 ) ) {
29412941 btrfs_abort_transaction (trans , ret );
29422942 return ret ;
29432943 }
@@ -2950,7 +2950,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans,
29502950 if (level ) {
29512951 ret = btrfs_tree_mod_log_insert_key (lower , slot ,
29522952 BTRFS_MOD_LOG_KEY_ADD );
2953- if (ret < 0 ) {
2953+ if (unlikely ( ret < 0 ) ) {
29542954 btrfs_abort_transaction (trans , ret );
29552955 return ret ;
29562956 }
@@ -3026,7 +3026,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
30263026 ASSERT (btrfs_header_level (c ) == level );
30273027
30283028 ret = btrfs_tree_mod_log_eb_copy (split , c , 0 , mid , c_nritems - mid );
3029- if (ret ) {
3029+ if (unlikely ( ret ) ) {
30303030 btrfs_tree_unlock (split );
30313031 free_extent_buffer (split );
30323032 btrfs_abort_transaction (trans , ret );
@@ -4383,7 +4383,7 @@ int btrfs_del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
43834383 if (level ) {
43844384 ret = btrfs_tree_mod_log_insert_move (parent , slot ,
43854385 slot + 1 , nritems - slot - 1 );
4386- if (ret < 0 ) {
4386+ if (unlikely ( ret < 0 ) ) {
43874387 btrfs_abort_transaction (trans , ret );
43884388 return ret ;
43894389 }
@@ -4396,7 +4396,7 @@ int btrfs_del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
43964396 } else if (level ) {
43974397 ret = btrfs_tree_mod_log_insert_key (parent , slot ,
43984398 BTRFS_MOD_LOG_KEY_REMOVE );
4399- if (ret < 0 ) {
4399+ if (unlikely ( ret < 0 ) ) {
44004400 btrfs_abort_transaction (trans , ret );
44014401 return ret ;
44024402 }
0 commit comments