@@ -404,7 +404,7 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
404404 CSUM_FMT_VALUE (csum_size , result ),
405405 btrfs_header_level (eb ),
406406 ignore_csum ? ", ignored" : "" );
407- if (!ignore_csum ) {
407+ if (unlikely ( !ignore_csum ) ) {
408408 ret = - EUCLEAN ;
409409 goto out ;
410410 }
@@ -1055,10 +1055,10 @@ static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
10551055 * For real fs, and not log/reloc trees, root owner must
10561056 * match its root node owner
10571057 */
1058- if (!btrfs_is_testing (fs_info ) &&
1059- btrfs_root_id (root ) != BTRFS_TREE_LOG_OBJECTID &&
1060- btrfs_root_id (root ) != BTRFS_TREE_RELOC_OBJECTID &&
1061- btrfs_root_id (root ) != btrfs_header_owner (root -> node )) {
1058+ if (unlikely ( !btrfs_is_testing (fs_info ) &&
1059+ btrfs_root_id (root ) != BTRFS_TREE_LOG_OBJECTID &&
1060+ btrfs_root_id (root ) != BTRFS_TREE_RELOC_OBJECTID &&
1061+ btrfs_root_id (root ) != btrfs_header_owner (root -> node ) )) {
10621062 btrfs_crit (fs_info ,
10631063"root=%llu block=%llu, tree root owner mismatch, have %llu expect %llu" ,
10641064 btrfs_root_id (root ), root -> node -> start ,
@@ -2324,7 +2324,7 @@ static int validate_sys_chunk_array(const struct btrfs_fs_info *fs_info,
23242324 const u32 sectorsize = btrfs_super_sectorsize (sb );
23252325 u32 sys_array_size = btrfs_super_sys_array_size (sb );
23262326
2327- if (sys_array_size > BTRFS_SYSTEM_CHUNK_ARRAY_SIZE ) {
2327+ if (unlikely ( sys_array_size > BTRFS_SYSTEM_CHUNK_ARRAY_SIZE ) ) {
23282328 btrfs_err (fs_info , "system chunk array too big %u > %u" ,
23292329 sys_array_size , BTRFS_SYSTEM_CHUNK_ARRAY_SIZE );
23302330 return - EUCLEAN ;
@@ -2342,23 +2342,23 @@ static int validate_sys_chunk_array(const struct btrfs_fs_info *fs_info,
23422342 disk_key = (struct btrfs_disk_key * )(sb -> sys_chunk_array + cur );
23432343 len = sizeof (* disk_key );
23442344
2345- if (cur + len > sys_array_size )
2345+ if (unlikely ( cur + len > sys_array_size ) )
23462346 goto short_read ;
23472347 cur += len ;
23482348
23492349 btrfs_disk_key_to_cpu (& key , disk_key );
2350- if (key .type != BTRFS_CHUNK_ITEM_KEY ) {
2350+ if (unlikely ( key .type != BTRFS_CHUNK_ITEM_KEY ) ) {
23512351 btrfs_err (fs_info ,
23522352 "unexpected item type %u in sys_array at offset %u" ,
23532353 key .type , cur );
23542354 return - EUCLEAN ;
23552355 }
23562356 chunk = (struct btrfs_chunk * )(sb -> sys_chunk_array + cur );
23572357 num_stripes = btrfs_stack_chunk_num_stripes (chunk );
2358- if (cur + btrfs_chunk_item_size (num_stripes ) > sys_array_size )
2358+ if (unlikely ( cur + btrfs_chunk_item_size (num_stripes ) > sys_array_size ) )
23592359 goto short_read ;
23602360 type = btrfs_stack_chunk_type (chunk );
2361- if (!(type & BTRFS_BLOCK_GROUP_SYSTEM )) {
2361+ if (unlikely ( !(type & BTRFS_BLOCK_GROUP_SYSTEM ) )) {
23622362 btrfs_err (fs_info ,
23632363 "invalid chunk type %llu in sys_array at offset %u" ,
23642364 type , cur );
@@ -2605,13 +2605,13 @@ static int btrfs_validate_write_super(struct btrfs_fs_info *fs_info,
26052605 ret = btrfs_validate_super (fs_info , sb , -1 );
26062606 if (ret < 0 )
26072607 goto out ;
2608- if (!btrfs_supported_super_csum (btrfs_super_csum_type (sb ))) {
2608+ if (unlikely ( !btrfs_supported_super_csum (btrfs_super_csum_type (sb ) ))) {
26092609 ret = - EUCLEAN ;
26102610 btrfs_err (fs_info , "invalid csum type, has %u want %u" ,
26112611 btrfs_super_csum_type (sb ), BTRFS_CSUM_TYPE_CRC32 );
26122612 goto out ;
26132613 }
2614- if (btrfs_super_incompat_flags (sb ) & ~BTRFS_FEATURE_INCOMPAT_SUPP ) {
2614+ if (unlikely ( btrfs_super_incompat_flags (sb ) & ~BTRFS_FEATURE_INCOMPAT_SUPP ) ) {
26152615 ret = - EUCLEAN ;
26162616 btrfs_err (fs_info ,
26172617 "invalid incompat flags, has 0x%llx valid mask 0x%llx" ,
@@ -4065,7 +4065,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
40654065 btrfs_set_super_flags (sb , flags | BTRFS_HEADER_FLAG_WRITTEN );
40664066
40674067 ret = btrfs_validate_write_super (fs_info , sb );
4068- if (ret < 0 ) {
4068+ if (unlikely ( ret < 0 ) ) {
40694069 mutex_unlock (& fs_info -> fs_devices -> device_list_mutex );
40704070 btrfs_handle_fs_error (fs_info , - EUCLEAN ,
40714071 "unexpected superblock corruption detected" );
@@ -4881,7 +4881,7 @@ int btrfs_init_root_free_objectid(struct btrfs_root *root)
48814881 ret = btrfs_search_slot (NULL , root , & search_key , path , 0 , 0 );
48824882 if (ret < 0 )
48834883 return ret ;
4884- if (ret == 0 ) {
4884+ if (unlikely ( ret == 0 ) ) {
48854885 /*
48864886 * Key with offset -1 found, there would have to exist a root
48874887 * with such id, but this is out of valid range.
0 commit comments