@@ -370,21 +370,21 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
370
370
ASSERT (check );
371
371
372
372
found_start = btrfs_header_bytenr (eb );
373
- if (found_start != eb -> start ) {
373
+ if (unlikely ( found_start != eb -> start ) ) {
374
374
btrfs_err_rl (fs_info ,
375
375
"bad tree block start, mirror %u want %llu have %llu" ,
376
376
eb -> read_mirror , eb -> start , found_start );
377
377
ret = - EIO ;
378
378
goto out ;
379
379
}
380
- if (check_tree_block_fsid (eb )) {
380
+ if (unlikely ( check_tree_block_fsid (eb ) )) {
381
381
btrfs_err_rl (fs_info , "bad fsid on logical %llu mirror %u" ,
382
382
eb -> start , eb -> read_mirror );
383
383
ret = - EIO ;
384
384
goto out ;
385
385
}
386
386
found_level = btrfs_header_level (eb );
387
- if (found_level >= BTRFS_MAX_LEVEL ) {
387
+ if (unlikely ( found_level >= BTRFS_MAX_LEVEL ) ) {
388
388
btrfs_err (fs_info ,
389
389
"bad tree block level, mirror %u level %d on logical %llu" ,
390
390
eb -> read_mirror , btrfs_header_level (eb ), eb -> start );
@@ -410,7 +410,7 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
410
410
}
411
411
}
412
412
413
- if (found_level != check -> level ) {
413
+ if (unlikely ( found_level != check -> level ) ) {
414
414
btrfs_err (fs_info ,
415
415
"level verify failed on logical %llu mirror %u wanted %u found %u" ,
416
416
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,
1046
1046
root -> node = NULL ;
1047
1047
goto fail ;
1048
1048
}
1049
- if (!btrfs_buffer_uptodate (root -> node , generation , false)) {
1049
+ if (unlikely ( !btrfs_buffer_uptodate (root -> node , generation , false) )) {
1050
1050
ret = - EIO ;
1051
1051
goto fail ;
1052
1052
}
@@ -2058,7 +2058,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
2058
2058
u64 bytenr = btrfs_super_log_root (disk_super );
2059
2059
int level = btrfs_super_log_root_level (disk_super );
2060
2060
2061
- if (fs_devices -> rw_devices == 0 ) {
2061
+ if (unlikely ( fs_devices -> rw_devices == 0 ) ) {
2062
2062
btrfs_warn (fs_info , "log replay required on RO media" );
2063
2063
return - EIO ;
2064
2064
}
@@ -2079,7 +2079,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
2079
2079
btrfs_put_root (log_tree_root );
2080
2080
return ret ;
2081
2081
}
2082
- if (!extent_buffer_uptodate (log_tree_root -> node )) {
2082
+ if (unlikely ( !extent_buffer_uptodate (log_tree_root -> node ) )) {
2083
2083
btrfs_err (fs_info , "failed to read log tree" );
2084
2084
btrfs_put_root (log_tree_root );
2085
2085
return - EIO ;
@@ -2641,7 +2641,7 @@ static int load_super_root(struct btrfs_root *root, u64 bytenr, u64 gen, int lev
2641
2641
root -> node = NULL ;
2642
2642
return ret ;
2643
2643
}
2644
- if (!extent_buffer_uptodate (root -> node )) {
2644
+ if (unlikely ( !extent_buffer_uptodate (root -> node ) )) {
2645
2645
free_extent_buffer (root -> node );
2646
2646
root -> node = NULL ;
2647
2647
return - EIO ;
@@ -3469,7 +3469,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
3469
3469
* below in btrfs_init_dev_replace().
3470
3470
*/
3471
3471
btrfs_free_extra_devids (fs_devices );
3472
- if (!fs_devices -> latest_dev -> bdev ) {
3472
+ if (unlikely ( !fs_devices -> latest_dev -> bdev ) ) {
3473
3473
btrfs_err (fs_info , "failed to read devices" );
3474
3474
ret = - EIO ;
3475
3475
goto fail_tree_roots ;
@@ -3963,7 +3963,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
3963
3963
* Checks last_flush_error of disks in order to determine the device
3964
3964
* state.
3965
3965
*/
3966
- if (errors_wait && !btrfs_check_rw_degradable (info , NULL ))
3966
+ if (unlikely ( errors_wait && !btrfs_check_rw_degradable (info , NULL ) ))
3967
3967
return - EIO ;
3968
3968
3969
3969
return 0 ;
@@ -4076,7 +4076,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
4076
4076
if (ret )
4077
4077
total_errors ++ ;
4078
4078
}
4079
- if (total_errors > max_errors ) {
4079
+ if (unlikely ( total_errors > max_errors ) ) {
4080
4080
btrfs_err (fs_info , "%d errors while writing supers" ,
4081
4081
total_errors );
4082
4082
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)
4101
4101
total_errors ++ ;
4102
4102
}
4103
4103
mutex_unlock (& fs_info -> fs_devices -> device_list_mutex );
4104
- if (total_errors > max_errors ) {
4104
+ if (unlikely ( total_errors > max_errors ) ) {
4105
4105
btrfs_handle_fs_error (fs_info , - EIO ,
4106
4106
"%d errors while writing supers" ,
4107
4107
total_errors );
0 commit comments