Lines Matching refs:info
151 static int btrfs_add_block_group_cache(struct btrfs_fs_info *info, in btrfs_add_block_group_cache() argument
158 spin_lock(&info->block_group_cache_lock); in btrfs_add_block_group_cache()
159 p = &info->block_group_cache_tree.rb_node; in btrfs_add_block_group_cache()
170 spin_unlock(&info->block_group_cache_lock); in btrfs_add_block_group_cache()
177 &info->block_group_cache_tree); in btrfs_add_block_group_cache()
179 if (info->first_logical_byte > block_group->key.objectid) in btrfs_add_block_group_cache()
180 info->first_logical_byte = block_group->key.objectid; in btrfs_add_block_group_cache()
182 spin_unlock(&info->block_group_cache_lock); in btrfs_add_block_group_cache()
192 struct btrfs_fs_info *info, u64 bytenr, int contains) in block_group_cache_tree_search() argument
198 spin_lock(&info->block_group_cache_lock); in block_group_cache_tree_search()
199 n = info->block_group_cache_tree.rb_node; in block_group_cache_tree_search()
224 if (bytenr == 0 && info->first_logical_byte > ret->key.objectid) in block_group_cache_tree_search()
225 info->first_logical_byte = ret->key.objectid; in block_group_cache_tree_search()
227 spin_unlock(&info->block_group_cache_lock); in block_group_cache_tree_search()
236 struct btrfs_fs_info *info, u64 bytenr) in btrfs_lookup_first_block_group() argument
238 return block_group_cache_tree_search(info, bytenr, 0); in btrfs_lookup_first_block_group()
245 struct btrfs_fs_info *info, u64 bytenr) in btrfs_lookup_block_group() argument
247 return block_group_cache_tree_search(info, bytenr, 1); in btrfs_lookup_block_group()
456 struct btrfs_fs_info *info = block_group->fs_info; in add_new_free_space() local
461 ret = find_first_extent_bit(info->pinned_extents, start, in add_new_free_space()
1689 int btrfs_read_block_groups(struct btrfs_fs_info *info) in btrfs_read_block_groups() argument
1703 feature = btrfs_super_incompat_flags(info->super_copy); in btrfs_read_block_groups()
1714 cache_gen = btrfs_super_cache_generation(info->super_copy); in btrfs_read_block_groups()
1715 if (btrfs_test_opt(info, SPACE_CACHE) && in btrfs_read_block_groups()
1716 btrfs_super_generation(info->super_copy) != cache_gen) in btrfs_read_block_groups()
1718 if (btrfs_test_opt(info, CLEAR_CACHE)) in btrfs_read_block_groups()
1722 ret = find_first_block_group(info, path, &key); in btrfs_read_block_groups()
1731 cache = btrfs_create_block_group_cache(info, found_key.objectid, in btrfs_read_block_groups()
1749 if (btrfs_test_opt(info, SPACE_CACHE)) in btrfs_read_block_groups()
1760 btrfs_err(info, in btrfs_read_block_groups()
1807 ret = btrfs_add_block_group_cache(info, cache); in btrfs_read_block_groups()
1814 trace_btrfs_add_block_group(info, cache, 0); in btrfs_read_block_groups()
1815 btrfs_update_space_info(info, cache->flags, found_key.offset, in btrfs_read_block_groups()
1823 set_avail_alloc_bits(info, cache->flags); in btrfs_read_block_groups()
1824 if (btrfs_chunk_readonly(info, cache->key.objectid)) { in btrfs_read_block_groups()
1832 list_for_each_entry_rcu(space_info, &info->space_info, list) { in btrfs_read_block_groups()
1833 if (!(btrfs_get_alloc_profile(info, space_info->flags) & in btrfs_read_block_groups()
1853 btrfs_init_global_block_rsv(info); in btrfs_read_block_groups()
1854 ret = check_chunk_block_group_mappings(info); in btrfs_read_block_groups()
2632 struct btrfs_fs_info *info = trans->fs_info; in btrfs_update_block_group() local
2641 spin_lock(&info->delalloc_root_lock); in btrfs_update_block_group()
2642 old_val = btrfs_super_bytes_used(info->super_copy); in btrfs_update_block_group()
2647 btrfs_set_super_bytes_used(info->super_copy, old_val); in btrfs_update_block_group()
2648 spin_unlock(&info->delalloc_root_lock); in btrfs_update_block_group()
2651 cache = btrfs_lookup_block_group(info, bytenr); in btrfs_update_block_group()
2673 if (btrfs_test_opt(info, SPACE_CACHE) && in btrfs_update_block_group()
2692 btrfs_space_info_update_bytes_pinned(info, in btrfs_update_block_group()
2703 set_extent_dirty(info->pinned_extents, in btrfs_update_block_group()
2803 static void force_metadata_allocation(struct btrfs_fs_info *info) in force_metadata_allocation() argument
2805 struct list_head *head = &info->space_info; in force_metadata_allocation()
2997 struct btrfs_space_info *info; in check_system_chunk() local
3009 info = btrfs_find_space_info(fs_info, BTRFS_BLOCK_GROUP_SYSTEM); in check_system_chunk()
3010 spin_lock(&info->lock); in check_system_chunk()
3011 left = info->total_bytes - btrfs_space_info_used(info, true); in check_system_chunk()
3012 spin_unlock(&info->lock); in check_system_chunk()
3023 btrfs_dump_space_info(fs_info, info, 0, 0); in check_system_chunk()
3047 void btrfs_put_block_group_cache(struct btrfs_fs_info *info) in btrfs_put_block_group_cache() argument
3055 block_group = btrfs_lookup_first_block_group(info, last); in btrfs_put_block_group_cache()
3087 int btrfs_free_block_groups(struct btrfs_fs_info *info) in btrfs_free_block_groups() argument
3094 down_write(&info->commit_root_sem); in btrfs_free_block_groups()
3095 while (!list_empty(&info->caching_block_groups)) { in btrfs_free_block_groups()
3096 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
3101 up_write(&info->commit_root_sem); in btrfs_free_block_groups()
3103 spin_lock(&info->unused_bgs_lock); in btrfs_free_block_groups()
3104 while (!list_empty(&info->unused_bgs)) { in btrfs_free_block_groups()
3105 block_group = list_first_entry(&info->unused_bgs, in btrfs_free_block_groups()
3111 spin_unlock(&info->unused_bgs_lock); in btrfs_free_block_groups()
3113 spin_lock(&info->block_group_cache_lock); in btrfs_free_block_groups()
3114 while ((n = rb_last(&info->block_group_cache_tree)) != NULL) { in btrfs_free_block_groups()
3118 &info->block_group_cache_tree); in btrfs_free_block_groups()
3120 spin_unlock(&info->block_group_cache_lock); in btrfs_free_block_groups()
3142 spin_lock(&info->block_group_cache_lock); in btrfs_free_block_groups()
3144 spin_unlock(&info->block_group_cache_lock); in btrfs_free_block_groups()
3154 btrfs_release_global_block_rsv(info); in btrfs_free_block_groups()
3156 while (!list_empty(&info->space_info)) { in btrfs_free_block_groups()
3157 space_info = list_entry(info->space_info.next, in btrfs_free_block_groups()
3168 btrfs_dump_space_info(info, space_info, 0, 0); in btrfs_free_block_groups()