@@ -370,21 +370,21 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
370370 ASSERT (check );
371371
372372 found_start = btrfs_header_bytenr (eb );
373- if (found_start != eb -> start ) {
373+ if (unlikely ( found_start != eb -> start ) ) {
374374 btrfs_err_rl (fs_info ,
375375 "bad tree block start, mirror %u want %llu have %llu" ,
376376 eb -> read_mirror , eb -> start , found_start );
377377 ret = - EIO ;
378378 goto out ;
379379 }
380- if (check_tree_block_fsid (eb )) {
380+ if (unlikely ( check_tree_block_fsid (eb ) )) {
381381 btrfs_err_rl (fs_info , "bad fsid on logical %llu mirror %u" ,
382382 eb -> start , eb -> read_mirror );
383383 ret = - EIO ;
384384 goto out ;
385385 }
386386 found_level = btrfs_header_level (eb );
387- if (found_level >= BTRFS_MAX_LEVEL ) {
387+ if (unlikely ( found_level >= BTRFS_MAX_LEVEL ) ) {
388388 btrfs_err (fs_info ,
389389 "bad tree block level, mirror %u level %d on logical %llu" ,
390390 eb -> read_mirror , btrfs_header_level (eb ), eb -> start );
@@ -410,7 +410,7 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
410410 }
411411 }
412412
413- if (found_level != check -> level ) {
413+ if (unlikely ( found_level != check -> level ) ) {
414414 btrfs_err (fs_info ,
415415 "level verify failed on logical %llu mirror %u wanted %u found %u" ,
416416 eb -> start , eb -> read_mirror , check -> level , found_level );
@@ -1046,7 +1046,7 @@ static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
10461046 root -> node = NULL ;
10471047 goto fail ;
10481048 }
1049- if (!btrfs_buffer_uptodate (root -> node , generation , false)) {
1049+ if (unlikely ( !btrfs_buffer_uptodate (root -> node , generation , false) )) {
10501050 ret = - EIO ;
10511051 goto fail ;
10521052 }
@@ -2058,7 +2058,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
20582058 u64 bytenr = btrfs_super_log_root (disk_super );
20592059 int level = btrfs_super_log_root_level (disk_super );
20602060
2061- if (fs_devices -> rw_devices == 0 ) {
2061+ if (unlikely ( fs_devices -> rw_devices == 0 ) ) {
20622062 btrfs_warn (fs_info , "log replay required on RO media" );
20632063 return - EIO ;
20642064 }
@@ -2079,7 +2079,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
20792079 btrfs_put_root (log_tree_root );
20802080 return ret ;
20812081 }
2082- if (!extent_buffer_uptodate (log_tree_root -> node )) {
2082+ if (unlikely ( !extent_buffer_uptodate (log_tree_root -> node ) )) {
20832083 btrfs_err (fs_info , "failed to read log tree" );
20842084 btrfs_put_root (log_tree_root );
20852085 return - EIO ;
@@ -2641,7 +2641,7 @@ static int load_super_root(struct btrfs_root *root, u64 bytenr, u64 gen, int lev
26412641 root -> node = NULL ;
26422642 return ret ;
26432643 }
2644- if (!extent_buffer_uptodate (root -> node )) {
2644+ if (unlikely ( !extent_buffer_uptodate (root -> node ) )) {
26452645 free_extent_buffer (root -> node );
26462646 root -> node = NULL ;
26472647 return - EIO ;
@@ -3469,7 +3469,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
34693469 * below in btrfs_init_dev_replace().
34703470 */
34713471 btrfs_free_extra_devids (fs_devices );
3472- if (!fs_devices -> latest_dev -> bdev ) {
3472+ if (unlikely ( !fs_devices -> latest_dev -> bdev ) ) {
34733473 btrfs_err (fs_info , "failed to read devices" );
34743474 ret = - EIO ;
34753475 goto fail_tree_roots ;
@@ -3963,7 +3963,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
39633963 * Checks last_flush_error of disks in order to determine the device
39643964 * state.
39653965 */
3966- if (errors_wait && !btrfs_check_rw_degradable (info , NULL ))
3966+ if (unlikely ( errors_wait && !btrfs_check_rw_degradable (info , NULL ) ))
39673967 return - EIO ;
39683968
39693969 return 0 ;
@@ -4076,7 +4076,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
40764076 if (ret )
40774077 total_errors ++ ;
40784078 }
4079- if (total_errors > max_errors ) {
4079+ if (unlikely ( total_errors > max_errors ) ) {
40804080 btrfs_err (fs_info , "%d errors while writing supers" ,
40814081 total_errors );
40824082 mutex_unlock (& fs_info -> fs_devices -> device_list_mutex );
@@ -4101,7 +4101,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
41014101 total_errors ++ ;
41024102 }
41034103 mutex_unlock (& fs_info -> fs_devices -> device_list_mutex );
4104- if (total_errors > max_errors ) {
4104+ if (unlikely ( total_errors > max_errors ) ) {
41054105 btrfs_handle_fs_error (fs_info , - EIO ,
41064106 "%d errors while writing supers" ,
41074107 total_errors );
0 commit comments