@@ -772,7 +772,7 @@ int btrfs_cache_block_group(struct btrfs_block_group *cache, bool wait)
772772 WARN_ON (cache -> caching_ctl );
773773 cache -> caching_ctl = caching_ctl ;
774774 cache -> cached = BTRFS_CACHE_STARTED ;
775- cache -> has_caching_ctl = 1 ;
775+ set_bit ( BLOCK_GROUP_FLAG_HAS_CACHING_CTL , & cache -> runtime_flags ) ;
776776 spin_unlock (& cache -> lock );
777777
778778 write_lock (& fs_info -> block_group_cache_lock );
@@ -988,11 +988,12 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
988988 kobject_put (kobj );
989989 }
990990
991- if (block_group -> has_caching_ctl )
991+
992+ if (test_bit (BLOCK_GROUP_FLAG_HAS_CACHING_CTL , & block_group -> runtime_flags ))
992993 caching_ctl = btrfs_get_caching_control (block_group );
993994 if (block_group -> cached == BTRFS_CACHE_STARTED )
994995 btrfs_wait_block_group_cache_done (block_group );
995- if (block_group -> has_caching_ctl ) {
996+ if (test_bit ( BLOCK_GROUP_FLAG_HAS_CACHING_CTL , & block_group -> runtime_flags ) ) {
996997 write_lock (& fs_info -> block_group_cache_lock );
997998 if (!caching_ctl ) {
998999 struct btrfs_caching_control * ctl ;
@@ -1034,12 +1035,13 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
10341035 < block_group -> zone_unusable );
10351036 WARN_ON (block_group -> space_info -> disk_total
10361037 < block_group -> length * factor );
1037- WARN_ON (block_group -> zone_is_active &&
1038+ WARN_ON (test_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE ,
1039+ & block_group -> runtime_flags ) &&
10381040 block_group -> space_info -> active_total_bytes
10391041 < block_group -> length );
10401042 }
10411043 block_group -> space_info -> total_bytes -= block_group -> length ;
1042- if (block_group -> zone_is_active )
1044+ if (test_bit ( BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , & block_group -> runtime_flags ) )
10431045 block_group -> space_info -> active_total_bytes -= block_group -> length ;
10441046 block_group -> space_info -> bytes_readonly -=
10451047 (block_group -> length - block_group -> zone_unusable );
@@ -1069,7 +1071,8 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
10691071 goto out ;
10701072
10711073 spin_lock (& block_group -> lock );
1072- block_group -> removed = 1 ;
1074+ set_bit (BLOCK_GROUP_FLAG_REMOVED , & block_group -> runtime_flags );
1075+
10731076 /*
10741077 * At this point trimming or scrub can't start on this block group,
10751078 * because we removed the block group from the rbtree
@@ -2409,7 +2412,8 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans)
24092412 ret = insert_block_group_item (trans , block_group );
24102413 if (ret )
24112414 btrfs_abort_transaction (trans , ret );
2412- if (!block_group -> chunk_item_inserted ) {
2415+ if (!test_bit (BLOCK_GROUP_FLAG_CHUNK_ITEM_INSERTED ,
2416+ & block_group -> runtime_flags )) {
24132417 mutex_lock (& fs_info -> chunk_mutex );
24142418 ret = btrfs_chunk_alloc_add_chunk_item (trans , block_group );
24152419 mutex_unlock (& fs_info -> chunk_mutex );
@@ -3955,7 +3959,8 @@ void btrfs_put_block_group_cache(struct btrfs_fs_info *info)
39553959 while (block_group ) {
39563960 btrfs_wait_block_group_cache_done (block_group );
39573961 spin_lock (& block_group -> lock );
3958- if (block_group -> iref )
3962+ if (test_bit (BLOCK_GROUP_FLAG_IREF ,
3963+ & block_group -> runtime_flags ))
39593964 break ;
39603965 spin_unlock (& block_group -> lock );
39613966 block_group = btrfs_next_block_group (block_group );
@@ -3968,7 +3973,7 @@ void btrfs_put_block_group_cache(struct btrfs_fs_info *info)
39683973 }
39693974
39703975 inode = block_group -> inode ;
3971- block_group -> iref = 0 ;
3976+ clear_bit ( BLOCK_GROUP_FLAG_IREF , & block_group -> runtime_flags ) ;
39723977 block_group -> inode = NULL ;
39733978 spin_unlock (& block_group -> lock );
39743979 ASSERT (block_group -> io_ctl .inode == NULL );
@@ -4110,7 +4115,7 @@ void btrfs_unfreeze_block_group(struct btrfs_block_group *block_group)
41104115
41114116 spin_lock (& block_group -> lock );
41124117 cleanup = (atomic_dec_and_test (& block_group -> frozen ) &&
4113- block_group -> removed );
4118+ test_bit ( BLOCK_GROUP_FLAG_REMOVED , & block_group -> runtime_flags ) );
41144119 spin_unlock (& block_group -> lock );
41154120
41164121 if (cleanup ) {
0 commit comments