Lines Matching refs:space_info

383 	struct btrfs_space_info *space_info = bg->space_info;  in btrfs_wait_block_group_reservations()  local
400 down_write(&space_info->groups_sem); in btrfs_wait_block_group_reservations()
401 up_write(&space_info->groups_sem); in btrfs_wait_block_group_reservations()
864 spin_lock(&block_group->space_info->lock); in caching_thread()
867 block_group->space_info->bytes_used += bytes_used >> 1; in caching_thread()
869 spin_unlock(&block_group->space_info->lock); in caching_thread()
968 struct list_head *head = &fs_info->space_info; in clear_incompat_bg_bits()
1115 down_write(&block_group->space_info->groups_sem); in btrfs_remove_block_group()
1121 if (list_empty(&block_group->space_info->block_groups[index])) { in btrfs_remove_block_group()
1122 kobj = block_group->space_info->block_group_kobjs[index]; in btrfs_remove_block_group()
1123 block_group->space_info->block_group_kobjs[index] = NULL; in btrfs_remove_block_group()
1126 up_write(&block_group->space_info->groups_sem); in btrfs_remove_block_group()
1166 spin_lock(&block_group->space_info->lock); in btrfs_remove_block_group()
1170 WARN_ON(block_group->space_info->total_bytes in btrfs_remove_block_group()
1172 WARN_ON(block_group->space_info->bytes_readonly in btrfs_remove_block_group()
1174 WARN_ON(block_group->space_info->bytes_zone_unusable in btrfs_remove_block_group()
1176 WARN_ON(block_group->space_info->disk_total in btrfs_remove_block_group()
1180 block_group->space_info->active_total_bytes in btrfs_remove_block_group()
1183 block_group->space_info->total_bytes -= block_group->length; in btrfs_remove_block_group()
1185 block_group->space_info->active_total_bytes -= block_group->length; in btrfs_remove_block_group()
1186 block_group->space_info->bytes_readonly -= in btrfs_remove_block_group()
1188 block_group->space_info->bytes_zone_unusable -= in btrfs_remove_block_group()
1190 block_group->space_info->disk_total -= block_group->length * factor; in btrfs_remove_block_group()
1192 spin_unlock(&block_group->space_info->lock); in btrfs_remove_block_group()
1320 struct btrfs_space_info *sinfo = cache->space_info; in inc_block_group_ro()
1385 btrfs_dump_space_info(cache->fs_info, cache->space_info, 0, 0); in inc_block_group_ro()
1442 struct btrfs_space_info *space_info; in btrfs_delete_unused_bgs() local
1469 space_info = block_group->space_info; in btrfs_delete_unused_bgs()
1471 if (ret || btrfs_mixed_space_info(space_info)) { in btrfs_delete_unused_bgs()
1480 down_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1490 up_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1509 up_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1516 up_write(&space_info->groups_sem); in btrfs_delete_unused_bgs()
1569 spin_lock(&space_info->lock); in btrfs_delete_unused_bgs()
1572 btrfs_space_info_update_bytes_pinned(fs_info, space_info, in btrfs_delete_unused_bgs()
1574 space_info->bytes_readonly += block_group->pinned; in btrfs_delete_unused_bgs()
1578 spin_unlock(&space_info->lock); in btrfs_delete_unused_bgs()
1684 const struct btrfs_space_info *space_info = bg->space_info; in should_reclaim_block_group() local
1685 const int reclaim_thresh = READ_ONCE(space_info->bg_reclaim_threshold); in should_reclaim_block_group()
1711 struct btrfs_space_info *space_info; in btrfs_reclaim_bgs_work() local
1755 space_info = bg->space_info; in btrfs_reclaim_bgs_work()
1759 down_write(&space_info->groups_sem); in btrfs_reclaim_bgs_work()
1770 up_write(&space_info->groups_sem); in btrfs_reclaim_bgs_work()
1788 up_write(&space_info->groups_sem); in btrfs_reclaim_bgs_work()
1804 up_write(&space_info->groups_sem); in btrfs_reclaim_bgs_work()
1811 up_write(&space_info->groups_sem); in btrfs_reclaim_bgs_work()
1823 up_write(&space_info->groups_sem); in btrfs_reclaim_bgs_work()
2368 struct btrfs_space_info *space_info; in btrfs_read_block_groups() local
2426 list_for_each_entry(space_info, &info->space_info, list) { in btrfs_read_block_groups()
2430 if (list_empty(&space_info->block_groups[i])) in btrfs_read_block_groups()
2432 cache = list_first_entry(&space_info->block_groups[i], in btrfs_read_block_groups()
2438 if (!(btrfs_get_alloc_profile(info, space_info->flags) & in btrfs_read_block_groups()
2449 &space_info->block_groups[BTRFS_RAID_RAID0], in btrfs_read_block_groups()
2453 &space_info->block_groups[BTRFS_RAID_SINGLE], in btrfs_read_block_groups()
2648 if (block_group->space_info->block_group_kobjs[index] == NULL) in btrfs_create_pending_block_groups()
2727 cache->space_info = btrfs_find_space_info(fs_info, cache->flags); in btrfs_make_block_group()
2728 ASSERT(cache->space_info); in btrfs_make_block_group()
2749 cache->space_info->bytes_used += new_bytes_used >> 1; in btrfs_make_block_group()
2845 alloc_flags = btrfs_get_alloc_profile(fs_info, cache->space_info->flags); in btrfs_inc_block_group_ro()
2853 ret = btrfs_zoned_activate_one_bg(fs_info, cache->space_info, true); in btrfs_inc_block_group_ro()
2876 struct btrfs_space_info *sinfo = cache->space_info; in btrfs_dec_block_group_ro()
3500 spin_lock(&cache->space_info->lock); in btrfs_update_block_group()
3513 cache->space_info->bytes_reserved -= num_bytes; in btrfs_update_block_group()
3514 cache->space_info->bytes_used += num_bytes; in btrfs_update_block_group()
3515 cache->space_info->disk_used += num_bytes * factor; in btrfs_update_block_group()
3517 spin_unlock(&cache->space_info->lock); in btrfs_update_block_group()
3523 cache->space_info, num_bytes); in btrfs_update_block_group()
3524 cache->space_info->bytes_used -= num_bytes; in btrfs_update_block_group()
3525 cache->space_info->disk_used -= num_bytes * factor; in btrfs_update_block_group()
3530 spin_unlock(&cache->space_info->lock); in btrfs_update_block_group()
3586 struct btrfs_space_info *space_info = cache->space_info; in btrfs_add_reserved_bytes() local
3590 spin_lock(&space_info->lock); in btrfs_add_reserved_bytes()
3604 space_info->bytes_reserved += num_bytes; in btrfs_add_reserved_bytes()
3606 space_info->flags, num_bytes, 1); in btrfs_add_reserved_bytes()
3608 space_info, -ram_bytes); in btrfs_add_reserved_bytes()
3617 btrfs_try_granting_tickets(cache->fs_info, space_info); in btrfs_add_reserved_bytes()
3620 spin_unlock(&space_info->lock); in btrfs_add_reserved_bytes()
3639 struct btrfs_space_info *space_info = cache->space_info; in btrfs_free_reserved_bytes() local
3641 spin_lock(&space_info->lock); in btrfs_free_reserved_bytes()
3644 space_info->bytes_readonly += num_bytes; in btrfs_free_reserved_bytes()
3646 space_info->bytes_reserved -= num_bytes; in btrfs_free_reserved_bytes()
3647 space_info->max_extent_size = 0; in btrfs_free_reserved_bytes()
3653 btrfs_try_granting_tickets(cache->fs_info, space_info); in btrfs_free_reserved_bytes()
3654 spin_unlock(&space_info->lock); in btrfs_free_reserved_bytes()
3659 struct list_head *head = &info->space_info; in force_metadata_allocation()
3906 struct btrfs_space_info *space_info; in btrfs_chunk_alloc() local
3945 space_info = btrfs_find_space_info(fs_info, flags); in btrfs_chunk_alloc()
3946 ASSERT(space_info); in btrfs_chunk_alloc()
3949 spin_lock(&space_info->lock); in btrfs_chunk_alloc()
3950 if (force < space_info->force_alloc) in btrfs_chunk_alloc()
3951 force = space_info->force_alloc; in btrfs_chunk_alloc()
3952 should_alloc = should_alloc_chunk(fs_info, space_info, force); in btrfs_chunk_alloc()
3953 if (space_info->full) { in btrfs_chunk_alloc()
3959 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3962 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3964 } else if (space_info->chunk_alloc) { in btrfs_chunk_alloc()
3973 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3978 space_info->chunk_alloc = 1; in btrfs_chunk_alloc()
3980 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
3993 if (btrfs_mixed_space_info(space_info)) in btrfs_chunk_alloc()
4024 spin_lock(&space_info->lock); in btrfs_chunk_alloc()
4027 space_info->full = 1; in btrfs_chunk_alloc()
4032 space_info->max_extent_size = 0; in btrfs_chunk_alloc()
4035 space_info->force_alloc = CHUNK_ALLOC_NO_FORCE; in btrfs_chunk_alloc()
4037 space_info->chunk_alloc = 0; in btrfs_chunk_alloc()
4038 spin_unlock(&space_info->lock); in btrfs_chunk_alloc()
4207 struct btrfs_space_info *space_info; in btrfs_free_block_groups() local
4257 down_write(&block_group->space_info->groups_sem); in btrfs_free_block_groups()
4259 up_write(&block_group->space_info->groups_sem); in btrfs_free_block_groups()
4284 while (!list_empty(&info->space_info)) { in btrfs_free_block_groups()
4285 space_info = list_entry(info->space_info.next, in btrfs_free_block_groups()
4293 if (WARN_ON(space_info->bytes_pinned > 0 || in btrfs_free_block_groups()
4294 space_info->bytes_may_use > 0)) in btrfs_free_block_groups()
4295 btrfs_dump_space_info(info, space_info, 0, 0); in btrfs_free_block_groups()
4304 if (!(space_info->flags & BTRFS_BLOCK_GROUP_METADATA) || in btrfs_free_block_groups()
4306 if (WARN_ON(space_info->bytes_reserved > 0)) in btrfs_free_block_groups()
4307 btrfs_dump_space_info(info, space_info, 0, 0); in btrfs_free_block_groups()
4310 WARN_ON(space_info->reclaim_size > 0); in btrfs_free_block_groups()
4311 list_del(&space_info->list); in btrfs_free_block_groups()
4312 btrfs_sysfs_remove_space_info(space_info); in btrfs_free_block_groups()