@@ -3817,35 +3817,35 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3817
3817
struct btrfs_super_block * sb = fs_info -> super_copy ;
3818
3818
int ret = 0 ;
3819
3819
3820
- if (sb -> root_level > BTRFS_MAX_LEVEL ) {
3821
- printk (KERN_ERR "BTRFS: tree_root level too big: %d > %d\n" ,
3822
- sb -> root_level , BTRFS_MAX_LEVEL );
3820
+ if (btrfs_super_root_level ( sb ) >= BTRFS_MAX_LEVEL ) {
3821
+ printk (KERN_ERR "BTRFS: tree_root level too big: %d >= %d\n" ,
3822
+ btrfs_super_root_level ( sb ) , BTRFS_MAX_LEVEL );
3823
3823
ret = - EINVAL ;
3824
3824
}
3825
- if (sb -> chunk_root_level > BTRFS_MAX_LEVEL ) {
3826
- printk (KERN_ERR "BTRFS: chunk_root level too big: %d > %d\n" ,
3827
- sb -> chunk_root_level , BTRFS_MAX_LEVEL );
3825
+ if (btrfs_super_chunk_root_level ( sb ) >= BTRFS_MAX_LEVEL ) {
3826
+ printk (KERN_ERR "BTRFS: chunk_root level too big: %d >= %d\n" ,
3827
+ btrfs_super_chunk_root_level ( sb ) , BTRFS_MAX_LEVEL );
3828
3828
ret = - EINVAL ;
3829
3829
}
3830
- if (sb -> log_root_level > BTRFS_MAX_LEVEL ) {
3831
- printk (KERN_ERR "BTRFS: log_root level too big: %d > %d\n" ,
3832
- sb -> log_root_level , BTRFS_MAX_LEVEL );
3830
+ if (btrfs_super_log_root_level ( sb ) >= BTRFS_MAX_LEVEL ) {
3831
+ printk (KERN_ERR "BTRFS: log_root level too big: %d >= %d\n" ,
3832
+ btrfs_super_log_root_level ( sb ) , BTRFS_MAX_LEVEL );
3833
3833
ret = - EINVAL ;
3834
3834
}
3835
3835
3836
3836
/*
3837
3837
* The common minimum, we don't know if we can trust the nodesize/sectorsize
3838
3838
* items yet, they'll be verified later. Issue just a warning.
3839
3839
*/
3840
- if (!IS_ALIGNED (sb -> root , 4096 ))
3840
+ if (!IS_ALIGNED (btrfs_super_root ( sb ) , 4096 ))
3841
3841
printk (KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n" ,
3842
3842
sb -> root );
3843
- if (!IS_ALIGNED (sb -> chunk_root , 4096 ))
3843
+ if (!IS_ALIGNED (btrfs_super_chunk_root ( sb ) , 4096 ))
3844
3844
printk (KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n" ,
3845
3845
sb -> chunk_root );
3846
- if (!IS_ALIGNED (sb -> log_root , 4096 ))
3846
+ if (!IS_ALIGNED (btrfs_super_log_root ( sb ) , 4096 ))
3847
3847
printk (KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n" ,
3848
- sb -> log_root );
3848
+ btrfs_super_log_root ( sb ) );
3849
3849
3850
3850
if (memcmp (fs_info -> fsid , sb -> dev_item .fsid , BTRFS_UUID_SIZE ) != 0 ) {
3851
3851
printk (KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n" ,
@@ -3857,28 +3857,29 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3857
3857
* Hint to catch really bogus numbers, bitflips or so, more exact checks are
3858
3858
* done later
3859
3859
*/
3860
- if (sb -> num_devices > (1UL << 31 ))
3860
+ if (btrfs_super_num_devices ( sb ) > (1UL << 31 ))
3861
3861
printk (KERN_WARNING "BTRFS: suspicious number of devices: %llu\n" ,
3862
- sb -> num_devices );
3862
+ btrfs_super_num_devices ( sb ) );
3863
3863
3864
- if (sb -> bytenr != BTRFS_SUPER_INFO_OFFSET ) {
3864
+ if (btrfs_super_bytenr ( sb ) != BTRFS_SUPER_INFO_OFFSET ) {
3865
3865
printk (KERN_ERR "BTRFS: super offset mismatch %llu != %u\n" ,
3866
- sb -> bytenr , BTRFS_SUPER_INFO_OFFSET );
3866
+ btrfs_super_bytenr ( sb ) , BTRFS_SUPER_INFO_OFFSET );
3867
3867
ret = - EINVAL ;
3868
3868
}
3869
3869
3870
3870
/*
3871
3871
* The generation is a global counter, we'll trust it more than the others
3872
3872
* but it's still possible that it's the one that's wrong.
3873
3873
*/
3874
- if (sb -> generation < sb -> chunk_root_generation )
3874
+ if (btrfs_super_generation ( sb ) < btrfs_super_chunk_root_generation ( sb ) )
3875
3875
printk (KERN_WARNING
3876
3876
"BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n" ,
3877
- sb -> generation , sb -> chunk_root_generation );
3878
- if (sb -> generation < sb -> cache_generation && sb -> cache_generation != (u64 )- 1 )
3877
+ btrfs_super_generation (sb ), btrfs_super_chunk_root_generation (sb ));
3878
+ if (btrfs_super_generation (sb ) < btrfs_super_cache_generation (sb )
3879
+ && btrfs_super_cache_generation (sb ) != (u64 )- 1 )
3879
3880
printk (KERN_WARNING
3880
3881
"BTRFS: suspicious: generation < cache_generation: %llu < %llu\n" ,
3881
- sb -> generation , sb -> cache_generation );
3882
+ btrfs_super_generation ( sb ), btrfs_super_cache_generation ( sb ) );
3882
3883
3883
3884
return ret ;
3884
3885
}
0 commit comments