@@ -3448,7 +3448,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
34483448
34493449 spin_lock (& block_group -> lock );
34503450 if (block_group -> cached != BTRFS_CACHE_FINISHED ||
3451- !btrfs_test_opt (root , SPACE_CACHE )) {
3451+ !btrfs_test_opt (root -> fs_info , SPACE_CACHE )) {
34523452 /*
34533453 * don't bother trying to write stuff out _if_
34543454 * a) we're not cached,
@@ -3525,7 +3525,7 @@ int btrfs_setup_space_cache(struct btrfs_trans_handle *trans,
35253525 struct btrfs_path * path ;
35263526
35273527 if (list_empty (& cur_trans -> dirty_bgs ) ||
3528- !btrfs_test_opt (root , SPACE_CACHE ))
3528+ !btrfs_test_opt (root -> fs_info , SPACE_CACHE ))
35293529 return 0 ;
35303530
35313531 path = btrfs_alloc_path ();
@@ -4444,7 +4444,7 @@ void check_system_chunk(struct btrfs_trans_handle *trans,
44444444 thresh = btrfs_calc_trunc_metadata_size (root , num_devs ) +
44454445 btrfs_calc_trans_metadata_size (root , 1 );
44464446
4447- if (left < thresh && btrfs_test_opt (root , ENOSPC_DEBUG )) {
4447+ if (left < thresh && btrfs_test_opt (root -> fs_info , ENOSPC_DEBUG )) {
44484448 btrfs_info (root -> fs_info , "left=%llu, need=%llu, flags=%llu" ,
44494449 left , thresh , type );
44504450 dump_space_info (info , 0 , 0 );
@@ -6216,7 +6216,7 @@ static int update_block_group(struct btrfs_trans_handle *trans,
62166216 spin_lock (& cache -> space_info -> lock );
62176217 spin_lock (& cache -> lock );
62186218
6219- if (btrfs_test_opt (root , SPACE_CACHE ) &&
6219+ if (btrfs_test_opt (root -> fs_info , SPACE_CACHE ) &&
62206220 cache -> disk_cache_state < BTRFS_DC_CLEAR )
62216221 cache -> disk_cache_state = BTRFS_DC_CLEAR ;
62226222
@@ -6598,7 +6598,7 @@ fetch_cluster_info(struct btrfs_root *root, struct btrfs_space_info *space_info,
65986598 u64 * empty_cluster )
65996599{
66006600 struct btrfs_free_cluster * ret = NULL ;
6601- bool ssd = btrfs_test_opt (root , SSD );
6601+ bool ssd = btrfs_test_opt (root -> fs_info , SSD );
66026602
66036603 * empty_cluster = 0 ;
66046604 if (btrfs_mixed_space_info (space_info ))
@@ -6743,7 +6743,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
67436743 break ;
67446744 }
67456745
6746- if (btrfs_test_opt (root , DISCARD ))
6746+ if (btrfs_test_opt (root -> fs_info , DISCARD ))
67476747 ret = btrfs_discard_extent (root , start ,
67486748 end + 1 - start , NULL );
67496749
@@ -7962,7 +7962,7 @@ int btrfs_reserve_extent(struct btrfs_root *root,
79627962 if (num_bytes == min_alloc_size )
79637963 final_tried = true;
79647964 goto again ;
7965- } else if (btrfs_test_opt (root , ENOSPC_DEBUG )) {
7965+ } else if (btrfs_test_opt (root -> fs_info , ENOSPC_DEBUG )) {
79667966 struct btrfs_space_info * sinfo ;
79677967
79687968 sinfo = __find_space_info (root -> fs_info , flags );
@@ -7993,7 +7993,7 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root,
79937993 if (pin )
79947994 pin_down_extent (root , cache , start , len , 1 );
79957995 else {
7996- if (btrfs_test_opt (root , DISCARD ))
7996+ if (btrfs_test_opt (root -> fs_info , DISCARD ))
79977997 ret = btrfs_discard_extent (root , start , len , NULL );
79987998 btrfs_add_free_space (cache , start , len );
79997999 btrfs_update_reserved_bytes (cache , len , RESERVE_FREE , delalloc );
@@ -8301,7 +8301,7 @@ use_block_rsv(struct btrfs_trans_handle *trans,
83018301 goto again ;
83028302 }
83038303
8304- if (btrfs_test_opt (root , ENOSPC_DEBUG )) {
8304+ if (btrfs_test_opt (root -> fs_info , ENOSPC_DEBUG )) {
83058305 static DEFINE_RATELIMIT_STATE (_rs ,
83068306 DEFAULT_RATELIMIT_INTERVAL * 10 ,
83078307 /*DEFAULT_RATELIMIT_BURST*/ 1 ) ;
@@ -9735,7 +9735,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)
97359735 int full = 0 ;
97369736 int ret = 0 ;
97379737
9738- debug = btrfs_test_opt (root , ENOSPC_DEBUG );
9738+ debug = btrfs_test_opt (root -> fs_info , ENOSPC_DEBUG );
97399739
97409740 block_group = btrfs_lookup_block_group (root -> fs_info , bytenr );
97419741
@@ -10148,10 +10148,10 @@ int btrfs_read_block_groups(struct btrfs_root *root)
1014810148 path -> reada = READA_FORWARD ;
1014910149
1015010150 cache_gen = btrfs_super_cache_generation (root -> fs_info -> super_copy );
10151- if (btrfs_test_opt (root , SPACE_CACHE ) &&
10151+ if (btrfs_test_opt (root -> fs_info , SPACE_CACHE ) &&
1015210152 btrfs_super_generation (root -> fs_info -> super_copy ) != cache_gen )
1015310153 need_clear = 1 ;
10154- if (btrfs_test_opt (root , CLEAR_CACHE ))
10154+ if (btrfs_test_opt (root -> fs_info , CLEAR_CACHE ))
1015510155 need_clear = 1 ;
1015610156
1015710157 while (1 ) {
@@ -10182,7 +10182,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
1018210182 * b) Setting 'dirty flag' makes sure that we flush
1018310183 * the new space cache info onto disk.
1018410184 */
10185- if (btrfs_test_opt (root , SPACE_CACHE ))
10185+ if (btrfs_test_opt (root -> fs_info , SPACE_CACHE ))
1018610186 cache -> disk_cache_state = BTRFS_DC_CLEAR ;
1018710187 }
1018810188
@@ -10641,7 +10641,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
1064110641 spin_lock (& block_group -> space_info -> lock );
1064210642 list_del_init (& block_group -> ro_list );
1064310643
10644- if (btrfs_test_opt (root , ENOSPC_DEBUG )) {
10644+ if (btrfs_test_opt (root -> fs_info , ENOSPC_DEBUG )) {
1064510645 WARN_ON (block_group -> space_info -> total_bytes
1064610646 < block_group -> key .offset );
1064710647 WARN_ON (block_group -> space_info -> bytes_readonly
@@ -10909,7 +10909,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
1090910909 spin_unlock (& space_info -> lock );
1091010910
1091110911 /* DISCARD can flip during remount */
10912- trimming = btrfs_test_opt (root , DISCARD );
10912+ trimming = btrfs_test_opt (root -> fs_info , DISCARD );
1091310913
1091410914 /* Implicit trim during transaction commit. */
1091510915 if (trimming )
0 commit comments