Lines Matching refs:space_info
337 struct btrfs_space_info *space_info = bg->space_info; in btrfs_wait_block_group_reservations() local
354 down_write(&space_info->groups_sem); in btrfs_wait_block_group_reservations()
355 up_write(&space_info->groups_sem); in btrfs_wait_block_group_reservations()
664 spin_lock(&block_group->space_info->lock); in caching_thread()
667 block_group->space_info->bytes_used += bytes_used >> 1; in caching_thread()
669 spin_unlock(&block_group->space_info->lock); in caching_thread()
768 spin_lock(&cache->space_info->lock); in btrfs_cache_block_group()
771 cache->space_info->bytes_used += bytes_used >> 1; in btrfs_cache_block_group()
773 spin_unlock(&cache->space_info->lock); in btrfs_cache_block_group()
850 struct list_head *head = &fs_info->space_info; in clear_incompat_bg_bits()
1031 down_write(&block_group->space_info->groups_sem); in btrfs_remove_block_group()
1037 if (list_empty(&block_group->space_info->block_groups[index])) { in btrfs_remove_block_group()
1038 kobj = block_group->space_info->block_group_kobjs[index]; in btrfs_remove_block_group()
1039 block_group->space_info->block_group_kobjs[index] = NULL; in btrfs_remove_block_group()
1042 up_write(&block_group->space_info->groups_sem); in btrfs_remove_block_group()
1083 spin_lock(&block_group->space_info->lock); in btrfs_remove_block_group()
1087 WARN_ON(block_group->space_info->total_bytes in btrfs_remove_block_group()
1089 WARN_ON(block_group->space_info->bytes_readonly in btrfs_remove_block_group()
1091 WARN_ON(block_group->space_info->disk_total in btrfs_remove_block_group()
1094 block_group->space_info->total_bytes -= block_group->length; in btrfs_remove_block_group()
1095 block_group->space_info->bytes_readonly -= block_group->length; in btrfs_remove_block_group()
1096 block_group->space_info->disk_total -= block_group->length * factor; in btrfs_remove_block_group()
1098 spin_unlock(&block_group->space_info->lock); in btrfs_remove_block_group()
1225 struct btrfs_space_info *sinfo = cache->space_info; in inc_block_group_ro()
1284 btrfs_dump_space_info(cache->fs_info, cache->space_info, 0, 0); in inc_block_group_ro()
1341 struct btrfs_space_info *space_info; in btrfs_delete_unused_bgs() local
1358 space_info = block_group->space_info; in btrfs_delete_unused_bgs()
1360 if (ret || btrfs_mixed_space_info(space_info)) { in btrfs_delete_unused_bgs()
1371 down_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1381 up_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1400 up_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1407 up_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1452 spin_lock(&space_info->lock); in btrfs_delete_unused_bgs()
1455 btrfs_space_info_update_bytes_pinned(fs_info, space_info, in btrfs_delete_unused_bgs()
1457 space_info->bytes_readonly += block_group->pinned; in btrfs_delete_unused_bgs()
1458 __btrfs_mod_total_bytes_pinned(space_info, -block_group->pinned); in btrfs_delete_unused_bgs()
1462 spin_unlock(&space_info->lock); in btrfs_delete_unused_bgs()
1778 struct btrfs_space_info *space_info = cache->space_info; in link_block_group() local
1781 down_write(&space_info->groups_sem); in link_block_group()
1782 list_add_tail(&cache->list, &space_info->block_groups[index]); in link_block_group()
1783 up_write(&space_info->groups_sem); in link_block_group()
1903 struct btrfs_space_info *space_info; in read_one_block_group() local
1977 cache->used, cache->bytes_super, &space_info); in read_one_block_group()
1979 cache->space_info = space_info; in read_one_block_group()
2004 struct btrfs_space_info *space_info; in btrfs_read_block_groups() local
2040 list_for_each_entry(space_info, &info->space_info, list) { in btrfs_read_block_groups()
2044 if (list_empty(&space_info->block_groups[i])) in btrfs_read_block_groups()
2046 cache = list_first_entry(&space_info->block_groups[i], in btrfs_read_block_groups()
2052 if (!(btrfs_get_alloc_profile(info, space_info->flags) & in btrfs_read_block_groups()
2063 &space_info->block_groups[BTRFS_RAID_RAID0], in btrfs_read_block_groups()
2067 &space_info->block_groups[BTRFS_RAID_SINGLE], in btrfs_read_block_groups()
2136 if (block_group->space_info->block_group_kobjs[index] == NULL) in btrfs_create_pending_block_groups()
2192 cache->space_info = btrfs_find_space_info(fs_info, cache->flags); in btrfs_make_block_group()
2193 ASSERT(cache->space_info); in btrfs_make_block_group()
2208 cache->bytes_super, &cache->space_info); in btrfs_make_block_group()
2286 alloc_flags = btrfs_get_alloc_profile(fs_info, cache->space_info->flags); in btrfs_inc_block_group_ro()
2309 struct btrfs_space_info *sinfo = cache->space_info; in btrfs_dec_block_group_ro()
2898 spin_lock(&cache->space_info->lock); in btrfs_update_block_group()
2911 cache->space_info->bytes_reserved -= num_bytes; in btrfs_update_block_group()
2912 cache->space_info->bytes_used += num_bytes; in btrfs_update_block_group()
2913 cache->space_info->disk_used += num_bytes * factor; in btrfs_update_block_group()
2915 spin_unlock(&cache->space_info->lock); in btrfs_update_block_group()
2921 cache->space_info, num_bytes); in btrfs_update_block_group()
2922 cache->space_info->bytes_used -= num_bytes; in btrfs_update_block_group()
2923 cache->space_info->disk_used -= num_bytes * factor; in btrfs_update_block_group()
2925 spin_unlock(&cache->space_info->lock); in btrfs_update_block_group()
2927 __btrfs_mod_total_bytes_pinned(cache->space_info, in btrfs_update_block_group()
2979 struct btrfs_space_info *space_info = cache->space_info; in btrfs_add_reserved_bytes() local
2982 spin_lock(&space_info->lock); in btrfs_add_reserved_bytes()
2988 space_info->bytes_reserved += num_bytes; in btrfs_add_reserved_bytes()
2990 space_info->flags, num_bytes, 1); in btrfs_add_reserved_bytes()
2992 space_info, -ram_bytes); in btrfs_add_reserved_bytes()
3001 btrfs_try_granting_tickets(cache->fs_info, space_info); in btrfs_add_reserved_bytes()
3004 spin_unlock(&space_info->lock); in btrfs_add_reserved_bytes()
3022 struct btrfs_space_info *space_info = cache->space_info; in btrfs_free_reserved_bytes() local
3024 spin_lock(&space_info->lock); in btrfs_free_reserved_bytes()
3027 space_info->bytes_readonly += num_bytes; in btrfs_free_reserved_bytes()
3029 space_info->bytes_reserved -= num_bytes; in btrfs_free_reserved_bytes()
3030 space_info->max_extent_size = 0; in btrfs_free_reserved_bytes()
3036 btrfs_try_granting_tickets(cache->fs_info, space_info); in btrfs_free_reserved_bytes()
3037 spin_unlock(&space_info->lock); in btrfs_free_reserved_bytes()
3042 struct list_head *head = &info->space_info; in force_metadata_allocation()
3097 struct btrfs_space_info *space_info; in btrfs_chunk_alloc() local
3106 space_info = btrfs_find_space_info(fs_info, flags); in btrfs_chunk_alloc()
3107 ASSERT(space_info); in btrfs_chunk_alloc()
3110 spin_lock(&space_info->lock); in btrfs_chunk_alloc()
3111 if (force < space_info->force_alloc) in btrfs_chunk_alloc()
3112 force = space_info->force_alloc; in btrfs_chunk_alloc()
3113 should_alloc = should_alloc_chunk(fs_info, space_info, force); in btrfs_chunk_alloc()
3114 if (space_info->full) { in btrfs_chunk_alloc()
3120 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3123 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3125 } else if (space_info->chunk_alloc) { in btrfs_chunk_alloc()
3133 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3138 space_info->chunk_alloc = 1; in btrfs_chunk_alloc()
3140 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3153 if (btrfs_mixed_space_info(space_info)) in btrfs_chunk_alloc()
3177 spin_lock(&space_info->lock); in btrfs_chunk_alloc()
3180 space_info->full = 1; in btrfs_chunk_alloc()
3185 space_info->max_extent_size = 0; in btrfs_chunk_alloc()
3188 space_info->force_alloc = CHUNK_ALLOC_NO_FORCE; in btrfs_chunk_alloc()
3190 space_info->chunk_alloc = 0; in btrfs_chunk_alloc()
3191 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3323 struct btrfs_space_info *space_info; in btrfs_free_block_groups() local
3355 down_write(&block_group->space_info->groups_sem); in btrfs_free_block_groups()
3357 up_write(&block_group->space_info->groups_sem); in btrfs_free_block_groups()
3382 while (!list_empty(&info->space_info)) { in btrfs_free_block_groups()
3383 space_info = list_entry(info->space_info.next, in btrfs_free_block_groups()
3391 if (WARN_ON(space_info->bytes_pinned > 0 || in btrfs_free_block_groups()
3392 space_info->bytes_reserved > 0 || in btrfs_free_block_groups()
3393 space_info->bytes_may_use > 0)) in btrfs_free_block_groups()
3394 btrfs_dump_space_info(info, space_info, 0, 0); in btrfs_free_block_groups()
3395 WARN_ON(space_info->reclaim_size > 0); in btrfs_free_block_groups()
3396 list_del(&space_info->list); in btrfs_free_block_groups()
3397 btrfs_sysfs_remove_space_info(space_info); in btrfs_free_block_groups()