Searched refs:space_info (Results 1 - 7 of 7) sorted by relevance

/linux-4.1.27/fs/btrfs/
H A Dextent-tree.c683 struct list_head *head = &info->space_info; __find_space_info()
705 struct list_head *head = &info->space_info; btrfs_clear_space_info_full()
2678 if (global_rsv->space_info->full) { btrfs_check_space_for_delayed_refs()
3676 struct btrfs_space_info **space_info) update_space_info()
3698 *space_info = found; update_space_info()
3739 *space_info = found; update_space_info()
3740 list_add_rcu(&found->list, &info->space_info); update_space_info()
4006 "space_info:enospc", btrfs_check_data_free_space()
4014 trace_btrfs_space_reservation(root->fs_info, "space_info", btrfs_check_data_free_space()
4037 trace_btrfs_space_reservation(root->fs_info, "space_info", btrfs_free_reserved_data_space()
4044 struct list_head *head = &info->space_info; force_metadata_allocation()
4146 struct btrfs_space_info *space_info; do_chunk_alloc() local
4155 space_info = __find_space_info(extent_root->fs_info, flags); do_chunk_alloc()
4156 if (!space_info) { do_chunk_alloc()
4158 0, 0, &space_info); do_chunk_alloc()
4161 BUG_ON(!space_info); /* Logic error */ do_chunk_alloc()
4164 spin_lock(&space_info->lock); do_chunk_alloc()
4165 if (force < space_info->force_alloc) do_chunk_alloc()
4166 force = space_info->force_alloc; do_chunk_alloc()
4167 if (space_info->full) { do_chunk_alloc()
4168 if (should_alloc_chunk(extent_root, space_info, force)) do_chunk_alloc()
4172 spin_unlock(&space_info->lock); do_chunk_alloc()
4176 if (!should_alloc_chunk(extent_root, space_info, force)) { do_chunk_alloc()
4177 spin_unlock(&space_info->lock); do_chunk_alloc()
4179 } else if (space_info->chunk_alloc) { do_chunk_alloc()
4182 space_info->chunk_alloc = 1; do_chunk_alloc()
4185 spin_unlock(&space_info->lock); do_chunk_alloc()
4207 if (btrfs_mixed_space_info(space_info)) do_chunk_alloc()
4231 spin_lock(&space_info->lock); do_chunk_alloc()
4235 space_info->full = 1; do_chunk_alloc()
4239 space_info->force_alloc = CHUNK_ALLOC_NO_FORCE; do_chunk_alloc()
4241 space_info->chunk_alloc = 0; do_chunk_alloc()
4242 spin_unlock(&space_info->lock); do_chunk_alloc()
4248 struct btrfs_space_info *space_info, u64 bytes, can_overcommit()
4257 used = space_info->bytes_used + space_info->bytes_reserved + can_overcommit()
4258 space_info->bytes_pinned + space_info->bytes_readonly; can_overcommit()
4269 if (used + space_size >= space_info->total_bytes) can_overcommit()
4272 used += space_info->bytes_may_use; can_overcommit()
4299 if (used + bytes < space_info->total_bytes + avail) can_overcommit()
4347 struct btrfs_space_info *space_info; shrink_delalloc() local
4363 space_info = block_rsv->space_info; shrink_delalloc()
4401 spin_lock(&space_info->lock); shrink_delalloc()
4402 if (can_overcommit(root, space_info, orig, flush)) { shrink_delalloc()
4403 spin_unlock(&space_info->lock); shrink_delalloc()
4406 spin_unlock(&space_info->lock); shrink_delalloc()
4432 struct btrfs_space_info *space_info, may_commit_transaction()
4446 if (percpu_counter_compare(&space_info->total_bytes_pinned, may_commit_transaction()
4454 if (space_info != delayed_rsv->space_info) may_commit_transaction()
4458 if (percpu_counter_compare(&space_info->total_bytes_pinned, may_commit_transaction()
4483 struct btrfs_space_info *space_info, u64 num_bytes, flush_space()
4525 ret = may_commit_transaction(root, space_info, orig_bytes, 0); flush_space()
4537 struct btrfs_space_info *space_info) btrfs_calc_reclaim_metadata_size()
4545 spin_lock(&space_info->lock); btrfs_calc_reclaim_metadata_size()
4546 if (can_overcommit(root, space_info, to_reclaim, btrfs_calc_reclaim_metadata_size()
4552 used = space_info->bytes_used + space_info->bytes_reserved + btrfs_calc_reclaim_metadata_size()
4553 space_info->bytes_pinned + space_info->bytes_readonly + btrfs_calc_reclaim_metadata_size()
4554 space_info->bytes_may_use; btrfs_calc_reclaim_metadata_size()
4555 if (can_overcommit(root, space_info, 1024 * 1024, btrfs_calc_reclaim_metadata_size()
4557 expected = div_factor_fine(space_info->total_bytes, 95); btrfs_calc_reclaim_metadata_size()
4559 expected = div_factor_fine(space_info->total_bytes, 90); btrfs_calc_reclaim_metadata_size()
4565 to_reclaim = min(to_reclaim, space_info->bytes_may_use + btrfs_calc_reclaim_metadata_size()
4566 space_info->bytes_reserved); btrfs_calc_reclaim_metadata_size()
4568 spin_unlock(&space_info->lock); btrfs_calc_reclaim_metadata_size()
4573 static inline int need_do_async_reclaim(struct btrfs_space_info *space_info, need_do_async_reclaim() argument
4576 u64 thresh = div_factor_fine(space_info->total_bytes, 98); need_do_async_reclaim()
4579 if (space_info->bytes_used >= thresh) need_do_async_reclaim()
4586 static int btrfs_need_do_async_reclaim(struct btrfs_space_info *space_info, btrfs_need_do_async_reclaim() argument
4592 spin_lock(&space_info->lock); btrfs_need_do_async_reclaim()
4597 if (flush_state > COMMIT_TRANS && space_info->full) { btrfs_need_do_async_reclaim()
4598 spin_unlock(&space_info->lock); btrfs_need_do_async_reclaim()
4602 used = space_info->bytes_used + space_info->bytes_reserved + btrfs_need_do_async_reclaim()
4603 space_info->bytes_pinned + space_info->bytes_readonly + btrfs_need_do_async_reclaim()
4604 space_info->bytes_may_use; btrfs_need_do_async_reclaim()
4605 if (need_do_async_reclaim(space_info, fs_info, used)) { btrfs_need_do_async_reclaim()
4606 spin_unlock(&space_info->lock); btrfs_need_do_async_reclaim()
4609 spin_unlock(&space_info->lock); btrfs_need_do_async_reclaim()
4617 struct btrfs_space_info *space_info; btrfs_async_reclaim_metadata_space() local
4622 space_info = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA); btrfs_async_reclaim_metadata_space()
4625 space_info); btrfs_async_reclaim_metadata_space()
4631 flush_space(fs_info->fs_root, space_info, to_reclaim, btrfs_async_reclaim_metadata_space()
4634 if (!btrfs_need_do_async_reclaim(space_info, fs_info, btrfs_async_reclaim_metadata_space()
4664 struct btrfs_space_info *space_info = block_rsv->space_info; reserve_metadata_bytes() local
4673 spin_lock(&space_info->lock); reserve_metadata_bytes()
4679 space_info->flush) { reserve_metadata_bytes()
4680 spin_unlock(&space_info->lock); reserve_metadata_bytes()
4689 ret = wait_event_killable(space_info->wait, !space_info->flush); reserve_metadata_bytes()
4694 spin_lock(&space_info->lock); reserve_metadata_bytes()
4698 used = space_info->bytes_used + space_info->bytes_reserved + reserve_metadata_bytes()
4699 space_info->bytes_pinned + space_info->bytes_readonly + reserve_metadata_bytes()
4700 space_info->bytes_may_use; reserve_metadata_bytes()
4709 if (used <= space_info->total_bytes) { reserve_metadata_bytes()
4710 if (used + orig_bytes <= space_info->total_bytes) { reserve_metadata_bytes()
4711 space_info->bytes_may_use += orig_bytes; reserve_metadata_bytes()
4713 "space_info", space_info->flags, orig_bytes, 1); reserve_metadata_bytes()
4729 num_bytes = used - space_info->total_bytes + reserve_metadata_bytes()
4733 if (ret && can_overcommit(root, space_info, orig_bytes, flush)) { reserve_metadata_bytes()
4734 space_info->bytes_may_use += orig_bytes; reserve_metadata_bytes()
4735 trace_btrfs_space_reservation(root->fs_info, "space_info", reserve_metadata_bytes()
4736 space_info->flags, orig_bytes, reserve_metadata_bytes()
4751 space_info->flush = 1; reserve_metadata_bytes()
4752 } else if (!ret && space_info->flags & BTRFS_BLOCK_GROUP_METADATA) { reserve_metadata_bytes()
4760 need_do_async_reclaim(space_info, root->fs_info, used) && reserve_metadata_bytes()
4765 spin_unlock(&space_info->lock); reserve_metadata_bytes()
4770 ret = flush_space(root, space_info, num_bytes, orig_bytes, reserve_metadata_bytes()
4804 "space_info:enospc", reserve_metadata_bytes()
4805 space_info->flags, orig_bytes, 1); reserve_metadata_bytes()
4807 spin_lock(&space_info->lock); reserve_metadata_bytes()
4808 space_info->flush = 0; reserve_metadata_bytes()
4809 wake_up_all(&space_info->wait); reserve_metadata_bytes()
4810 spin_unlock(&space_info->lock); reserve_metadata_bytes()
4873 if (global_rsv->space_info != dest->space_info) btrfs_cond_migrate_bytes()
4895 struct btrfs_space_info *space_info = block_rsv->space_info; block_rsv_release_bytes() local
4926 spin_lock(&space_info->lock); block_rsv_release_bytes()
4927 space_info->bytes_may_use -= num_bytes; block_rsv_release_bytes()
4928 trace_btrfs_space_reservation(fs_info, "space_info", block_rsv_release_bytes()
4929 space_info->flags, num_bytes, 0); block_rsv_release_bytes()
4930 spin_unlock(&space_info->lock); block_rsv_release_bytes()
4966 block_rsv->space_info = __find_space_info(fs_info, btrfs_alloc_block_rsv()
5064 block_rsv->space_info != global_rsv->space_info) btrfs_block_rsv_release()
5108 struct btrfs_space_info *sinfo = block_rsv->space_info; update_global_block_rsv()
5126 trace_btrfs_space_reservation(fs_info, "space_info", update_global_block_rsv()
5133 trace_btrfs_space_reservation(fs_info, "space_info", update_global_block_rsv()
5145 struct btrfs_space_info *space_info; init_global_block_rsv() local
5147 space_info = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_SYSTEM); init_global_block_rsv()
5148 fs_info->chunk_block_rsv.space_info = space_info; init_global_block_rsv()
5150 space_info = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA); init_global_block_rsv()
5151 fs_info->global_block_rsv.space_info = space_info; init_global_block_rsv()
5152 fs_info->delalloc_block_rsv.space_info = space_info; init_global_block_rsv()
5153 fs_info->trans_block_rsv.space_info = space_info; init_global_block_rsv()
5154 fs_info->empty_block_rsv.space_info = space_info; init_global_block_rsv()
5155 fs_info->delayed_block_rsv.space_info = space_info; init_global_block_rsv()
5262 rsv->space_info = __find_space_info(root->fs_info, btrfs_subvolume_reserve_metadata()
5658 spin_lock(&cache->space_info->lock); update_block_group()
5671 cache->space_info->bytes_reserved -= num_bytes; update_block_group()
5672 cache->space_info->bytes_used += num_bytes; update_block_group()
5673 cache->space_info->disk_used += num_bytes * factor; update_block_group()
5675 spin_unlock(&cache->space_info->lock); update_block_group()
5680 cache->space_info->bytes_pinned += num_bytes; update_block_group()
5681 cache->space_info->bytes_used -= num_bytes; update_block_group()
5682 cache->space_info->disk_used -= num_bytes * factor; update_block_group()
5684 spin_unlock(&cache->space_info->lock); update_block_group()
5746 spin_lock(&cache->space_info->lock); pin_down_extent()
5749 cache->space_info->bytes_pinned += num_bytes; pin_down_extent()
5752 cache->space_info->bytes_reserved -= num_bytes; pin_down_extent()
5755 spin_unlock(&cache->space_info->lock); pin_down_extent()
5910 struct btrfs_space_info *space_info = cache->space_info; btrfs_update_reserved_bytes() local
5913 spin_lock(&space_info->lock); btrfs_update_reserved_bytes()
5920 space_info->bytes_reserved += num_bytes; btrfs_update_reserved_bytes()
5923 "space_info", space_info->flags, btrfs_update_reserved_bytes()
5925 space_info->bytes_may_use -= num_bytes; btrfs_update_reserved_bytes()
5933 space_info->bytes_readonly += num_bytes; btrfs_update_reserved_bytes()
5935 space_info->bytes_reserved -= num_bytes; btrfs_update_reserved_bytes()
5941 spin_unlock(&space_info->lock); btrfs_update_reserved_bytes()
5982 struct btrfs_space_info *space_info; unpin_extent_range() local
6007 space_info = cache->space_info; unpin_extent_range()
6009 spin_lock(&space_info->lock); unpin_extent_range()
6012 space_info->bytes_pinned -= len; unpin_extent_range()
6013 percpu_counter_add(&space_info->total_bytes_pinned, -len); unpin_extent_range()
6015 space_info->bytes_readonly += len; unpin_extent_range()
6019 if (!readonly && global_rsv->space_info == space_info) { unpin_extent_range()
6025 space_info->bytes_may_use += len; unpin_extent_range()
6031 spin_unlock(&space_info->lock); unpin_extent_range()
6081 struct btrfs_space_info *space_info; add_pinned_bytes() local
6093 space_info = __find_space_info(fs_info, flags); add_pinned_bytes()
6094 BUG_ON(!space_info); /* Logic bug */ add_pinned_bytes()
6095 percpu_counter_add(&space_info->total_bytes_pinned, num_bytes); add_pinned_bytes()
6731 struct btrfs_space_info *space_info; find_free_extent() local
6748 space_info = __find_space_info(root->fs_info, flags); find_free_extent()
6749 if (!space_info) { find_free_extent()
6758 if (btrfs_mixed_space_info(space_info)) find_free_extent()
6797 down_read(&space_info->groups_sem); find_free_extent()
6807 up_read(&space_info->groups_sem); find_free_extent()
6819 down_read(&space_info->groups_sem); find_free_extent()
6820 list_for_each_entry(block_group, &space_info->block_groups[index], find_free_extent()
7064 up_read(&space_info->groups_sem); find_free_extent()
7139 printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n", dump_space_info()
7144 printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, " dump_space_info()
7558 block_rsv->space_info == global_rsv->space_info) { use_block_rsv()
8762 struct btrfs_space_info *sinfo = cache->space_info; set_block_group_ro()
8860 alloc_flags = get_alloc_profile(root, cache->space_info->flags); btrfs_set_block_group_ro()
8889 * space_info. takes mirrors into account.
8931 struct btrfs_space_info *sinfo = cache->space_info; btrfs_set_block_group_rw()
8956 struct btrfs_space_info *space_info; btrfs_can_relocate() local
8980 space_info = block_group->space_info; btrfs_can_relocate()
8981 spin_lock(&space_info->lock); btrfs_can_relocate()
8983 full = space_info->full; btrfs_can_relocate()
8992 if ((space_info->total_bytes != block_group->key.offset) && btrfs_can_relocate()
8993 (space_info->bytes_used + space_info->bytes_reserved + btrfs_can_relocate()
8994 space_info->bytes_pinned + space_info->bytes_readonly + btrfs_can_relocate()
8995 min_free < space_info->total_bytes)) { btrfs_can_relocate()
8996 spin_unlock(&space_info->lock); btrfs_can_relocate()
8999 spin_unlock(&space_info->lock); btrfs_can_relocate()
9154 struct btrfs_space_info *space_info; btrfs_free_block_groups() local
9186 down_write(&block_group->space_info->groups_sem); btrfs_free_block_groups()
9188 up_write(&block_group->space_info->groups_sem); btrfs_free_block_groups()
9209 * free all the space_info structs. This is only called during btrfs_free_block_groups()
9218 while (!list_empty(&info->space_info)) { btrfs_free_block_groups()
9221 space_info = list_entry(info->space_info.next, btrfs_free_block_groups()
9225 if (WARN_ON(space_info->bytes_pinned > 0 || btrfs_free_block_groups()
9226 space_info->bytes_reserved > 0 || btrfs_free_block_groups()
9227 space_info->bytes_may_use > 0)) { btrfs_free_block_groups()
9228 dump_space_info(space_info, 0, 0); btrfs_free_block_groups()
9231 list_del(&space_info->list); btrfs_free_block_groups()
9234 kobj = space_info->block_group_kobjs[i]; btrfs_free_block_groups()
9235 space_info->block_group_kobjs[i] = NULL; btrfs_free_block_groups()
9241 kobject_del(&space_info->kobj); btrfs_free_block_groups()
9242 kobject_put(&space_info->kobj); btrfs_free_block_groups()
9247 static void __link_block_group(struct btrfs_space_info *space_info, __link_block_group() argument
9253 down_write(&space_info->groups_sem); __link_block_group()
9254 if (list_empty(&space_info->block_groups[index])) __link_block_group()
9256 list_add_tail(&cache->list, &space_info->block_groups[index]); __link_block_group()
9257 up_write(&space_info->groups_sem); __link_block_group()
9268 ret = kobject_add(&rkobj->kobj, &space_info->kobj, __link_block_group()
9274 space_info->block_group_kobjs[index] = &rkobj->kobj; __link_block_group()
9328 struct btrfs_space_info *space_info; btrfs_read_block_groups() local
9437 &space_info); btrfs_read_block_groups()
9449 cache->space_info = space_info; btrfs_read_block_groups()
9450 spin_lock(&cache->space_info->lock); btrfs_read_block_groups()
9451 cache->space_info->bytes_readonly += cache->bytes_super; btrfs_read_block_groups()
9452 spin_unlock(&cache->space_info->lock); btrfs_read_block_groups()
9454 __link_block_group(space_info, cache); btrfs_read_block_groups()
9471 list_for_each_entry_rcu(space_info, &root->fs_info->space_info, list) { btrfs_read_block_groups()
9472 if (!(get_alloc_profile(root, space_info->flags) & btrfs_read_block_groups()
9484 &space_info->block_groups[BTRFS_RAID_RAID0], btrfs_read_block_groups()
9488 &space_info->block_groups[BTRFS_RAID_SINGLE], btrfs_read_block_groups()
9579 &cache->space_info); btrfs_make_block_group()
9592 spin_lock(&cache->space_info->lock); btrfs_make_block_group()
9593 cache->space_info->bytes_readonly += cache->bytes_super; btrfs_make_block_group()
9594 spin_unlock(&cache->space_info->lock); btrfs_make_block_group()
9596 __link_block_group(cache->space_info, cache); btrfs_make_block_group()
9757 down_write(&block_group->space_info->groups_sem); btrfs_remove_block_group()
9763 if (list_empty(&block_group->space_info->block_groups[index])) { btrfs_remove_block_group()
9764 kobj = block_group->space_info->block_group_kobjs[index]; btrfs_remove_block_group()
9765 block_group->space_info->block_group_kobjs[index] = NULL; btrfs_remove_block_group()
9768 up_write(&block_group->space_info->groups_sem); btrfs_remove_block_group()
9811 spin_lock(&block_group->space_info->lock); btrfs_remove_block_group()
9815 WARN_ON(block_group->space_info->total_bytes btrfs_remove_block_group()
9817 WARN_ON(block_group->space_info->bytes_readonly btrfs_remove_block_group()
9819 WARN_ON(block_group->space_info->disk_total btrfs_remove_block_group()
9822 block_group->space_info->total_bytes -= block_group->key.offset; btrfs_remove_block_group()
9823 block_group->space_info->bytes_readonly -= block_group->key.offset; btrfs_remove_block_group()
9824 block_group->space_info->disk_total -= block_group->key.offset * factor; btrfs_remove_block_group()
9826 spin_unlock(&block_group->space_info->lock); btrfs_remove_block_group()
9917 struct btrfs_space_info *space_info; btrfs_delete_unused_bgs() local
9932 space_info = block_group->space_info; btrfs_delete_unused_bgs()
9934 if (ret || btrfs_mixed_space_info(space_info)) { btrfs_delete_unused_bgs()
9941 down_write(&space_info->groups_sem); btrfs_delete_unused_bgs()
9953 up_write(&space_info->groups_sem); btrfs_delete_unused_bgs()
9960 up_write(&space_info->groups_sem); btrfs_delete_unused_bgs()
10013 spin_lock(&space_info->lock); btrfs_delete_unused_bgs()
10016 space_info->bytes_pinned -= block_group->pinned; btrfs_delete_unused_bgs()
10017 space_info->bytes_readonly += block_group->pinned; btrfs_delete_unused_bgs()
10018 percpu_counter_add(&space_info->total_bytes_pinned, btrfs_delete_unused_bgs()
10023 spin_unlock(&space_info->lock); btrfs_delete_unused_bgs()
10042 struct btrfs_space_info *space_info; btrfs_init_space_info() local
10058 ret = update_space_info(fs_info, flags, 0, 0, &space_info); btrfs_init_space_info()
10064 ret = update_space_info(fs_info, flags, 0, 0, &space_info); btrfs_init_space_info()
10067 ret = update_space_info(fs_info, flags, 0, 0, &space_info); btrfs_init_space_info()
10072 ret = update_space_info(fs_info, flags, 0, 0, &space_info); btrfs_init_space_info()
3674 update_space_info(struct btrfs_fs_info *info, u64 flags, u64 total_bytes, u64 bytes_used, struct btrfs_space_info **space_info) update_space_info() argument
4247 can_overcommit(struct btrfs_root *root, struct btrfs_space_info *space_info, u64 bytes, enum btrfs_reserve_flush_enum flush) can_overcommit() argument
4431 may_commit_transaction(struct btrfs_root *root, struct btrfs_space_info *space_info, u64 bytes, int force) may_commit_transaction() argument
4482 flush_space(struct btrfs_root *root, struct btrfs_space_info *space_info, u64 num_bytes, u64 orig_bytes, int state) flush_space() argument
4536 btrfs_calc_reclaim_metadata_size(struct btrfs_root *root, struct btrfs_space_info *space_info) btrfs_calc_reclaim_metadata_size() argument
H A Dfree-space-cache.c3070 struct btrfs_space_info *space_info = block_group->space_info; do_trimming() local
3077 spin_lock(&space_info->lock); do_trimming()
3081 space_info->bytes_reserved += reserved_bytes; do_trimming()
3085 spin_unlock(&space_info->lock); do_trimming()
3098 spin_lock(&space_info->lock); do_trimming()
3101 space_info->bytes_readonly += reserved_bytes; do_trimming()
3103 space_info->bytes_reserved -= reserved_bytes; do_trimming()
3104 spin_unlock(&space_info->lock); do_trimming()
H A Dctree.h1208 struct btrfs_space_info *space_info; member in struct:btrfs_block_rsv
1315 struct btrfs_space_info *space_info; member in struct:btrfs_block_group_cache
1644 * the space_info list is almost entirely read only. It only changes
1648 struct list_head space_info; member in struct:btrfs_fs_info
3318 static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info) btrfs_mixed_space_info() argument
3320 return ((space_info->flags & BTRFS_BLOCK_GROUP_METADATA) && btrfs_mixed_space_info()
3321 (space_info->flags & BTRFS_BLOCK_GROUP_DATA)); btrfs_mixed_space_info()
H A Dioctl.c4022 list_for_each_entry_rcu(tmp, &root->fs_info->space_info, btrfs_ioctl_space_info()
4043 * Global block reserve, exported as a space_info btrfs_ioctl_space_info()
4078 list_for_each_entry_rcu(tmp, &root->fs_info->space_info, btrfs_ioctl_space_info()
H A Dsuper.c1834 struct list_head *head = &fs_info->space_info; btrfs_statfs()
H A Dtransaction.c707 if (root->fs_info->global_block_rsv.space_info->full && should_end_transaction()
H A Ddisk-io.c2517 INIT_LIST_HEAD(&fs_info->space_info); open_ctree()
3443 list_for_each_entry_rcu(tmp, &fs_info->space_info, list) { btrfs_calc_num_tolerated_disk_barrier_failures()

Completed in 303 milliseconds