@@ -16,6 +16,12 @@ static int __add_block_group_free_space(struct btrfs_trans_handle *trans,
16
16
struct btrfs_block_group * block_group ,
17
17
struct btrfs_path * path );
18
18
19
+ static struct btrfs_root * btrfs_free_space_root (
20
+ struct btrfs_block_group * block_group )
21
+ {
22
+ return block_group -> fs_info -> _free_space_root ;
23
+ }
24
+
19
25
void set_free_space_tree_thresholds (struct btrfs_block_group * cache )
20
26
{
21
27
u32 bitmap_range ;
@@ -51,7 +57,7 @@ static int add_new_free_space_info(struct btrfs_trans_handle *trans,
51
57
struct btrfs_block_group * block_group ,
52
58
struct btrfs_path * path )
53
59
{
54
- struct btrfs_root * root = trans -> fs_info -> free_space_root ;
60
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
55
61
struct btrfs_free_space_info * info ;
56
62
struct btrfs_key key ;
57
63
struct extent_buffer * leaf ;
@@ -85,7 +91,7 @@ struct btrfs_free_space_info *search_free_space_info(
85
91
struct btrfs_path * path , int cow )
86
92
{
87
93
struct btrfs_fs_info * fs_info = block_group -> fs_info ;
88
- struct btrfs_root * root = fs_info -> free_space_root ;
94
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
89
95
struct btrfs_key key ;
90
96
int ret ;
91
97
@@ -188,7 +194,7 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
188
194
struct btrfs_path * path )
189
195
{
190
196
struct btrfs_fs_info * fs_info = trans -> fs_info ;
191
- struct btrfs_root * root = fs_info -> free_space_root ;
197
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
192
198
struct btrfs_free_space_info * info ;
193
199
struct btrfs_key key , found_key ;
194
200
struct extent_buffer * leaf ;
@@ -326,7 +332,7 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
326
332
struct btrfs_path * path )
327
333
{
328
334
struct btrfs_fs_info * fs_info = trans -> fs_info ;
329
- struct btrfs_root * root = fs_info -> free_space_root ;
335
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
330
336
struct btrfs_free_space_info * info ;
331
337
struct btrfs_key key , found_key ;
332
338
struct extent_buffer * leaf ;
@@ -586,7 +592,7 @@ static int modify_free_space_bitmap(struct btrfs_trans_handle *trans,
586
592
struct btrfs_path * path ,
587
593
u64 start , u64 size , int remove )
588
594
{
589
- struct btrfs_root * root = block_group -> fs_info -> free_space_root ;
595
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
590
596
struct btrfs_key key ;
591
597
u64 end = start + size ;
592
598
u64 cur_start , cur_size ;
@@ -699,7 +705,7 @@ static int remove_free_space_extent(struct btrfs_trans_handle *trans,
699
705
struct btrfs_path * path ,
700
706
u64 start , u64 size )
701
707
{
702
- struct btrfs_root * root = trans -> fs_info -> free_space_root ;
708
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
703
709
struct btrfs_key key ;
704
710
u64 found_start , found_end ;
705
711
u64 end = start + size ;
@@ -851,7 +857,7 @@ static int add_free_space_extent(struct btrfs_trans_handle *trans,
851
857
struct btrfs_path * path ,
852
858
u64 start , u64 size )
853
859
{
854
- struct btrfs_root * root = trans -> fs_info -> free_space_root ;
860
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
855
861
struct btrfs_key key , new_key ;
856
862
u64 found_start , found_end ;
857
863
u64 end = start + size ;
@@ -1158,7 +1164,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info)
1158
1164
ret = PTR_ERR (free_space_root );
1159
1165
goto abort ;
1160
1166
}
1161
- fs_info -> free_space_root = free_space_root ;
1167
+ fs_info -> _free_space_root = free_space_root ;
1162
1168
1163
1169
node = rb_first (& fs_info -> block_group_cache_tree );
1164
1170
while (node ) {
@@ -1233,7 +1239,7 @@ int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info)
1233
1239
{
1234
1240
struct btrfs_trans_handle * trans ;
1235
1241
struct btrfs_root * tree_root = fs_info -> tree_root ;
1236
- struct btrfs_root * free_space_root = fs_info -> free_space_root ;
1242
+ struct btrfs_root * free_space_root = fs_info -> _free_space_root ;
1237
1243
int ret ;
1238
1244
1239
1245
trans = btrfs_start_transaction (tree_root , 0 );
@@ -1242,7 +1248,7 @@ int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info)
1242
1248
1243
1249
btrfs_clear_fs_compat_ro (fs_info , FREE_SPACE_TREE );
1244
1250
btrfs_clear_fs_compat_ro (fs_info , FREE_SPACE_TREE_VALID );
1245
- fs_info -> free_space_root = NULL ;
1251
+ fs_info -> _free_space_root = NULL ;
1246
1252
1247
1253
ret = clear_free_space_tree (trans , free_space_root );
1248
1254
if (ret )
@@ -1320,7 +1326,7 @@ int add_block_group_free_space(struct btrfs_trans_handle *trans,
1320
1326
int remove_block_group_free_space (struct btrfs_trans_handle * trans ,
1321
1327
struct btrfs_block_group * block_group )
1322
1328
{
1323
- struct btrfs_root * root = trans -> fs_info -> free_space_root ;
1329
+ struct btrfs_root * root = btrfs_free_space_root ( block_group ) ;
1324
1330
struct btrfs_path * path ;
1325
1331
struct btrfs_key key , found_key ;
1326
1332
struct extent_buffer * leaf ;
@@ -1411,7 +1417,7 @@ static int load_free_space_bitmaps(struct btrfs_caching_control *caching_ctl,
1411
1417
1412
1418
block_group = caching_ctl -> block_group ;
1413
1419
fs_info = block_group -> fs_info ;
1414
- root = fs_info -> free_space_root ;
1420
+ root = btrfs_free_space_root ( block_group ) ;
1415
1421
1416
1422
end = block_group -> start + block_group -> length ;
1417
1423
@@ -1489,7 +1495,7 @@ static int load_free_space_extents(struct btrfs_caching_control *caching_ctl,
1489
1495
1490
1496
block_group = caching_ctl -> block_group ;
1491
1497
fs_info = block_group -> fs_info ;
1492
- root = fs_info -> free_space_root ;
1498
+ root = btrfs_free_space_root ( block_group ) ;
1493
1499
1494
1500
end = block_group -> start + block_group -> length ;
1495
1501
0 commit comments