• Home
  • Raw
  • Download

Lines Matching refs:block_group

2607 	struct btrfs_block_group *block_group;  in __exclude_logged_extent()  local
2609 block_group = btrfs_lookup_block_group(fs_info, start); in __exclude_logged_extent()
2610 if (!block_group) in __exclude_logged_extent()
2613 ret = btrfs_cache_block_group(block_group, true); in __exclude_logged_extent()
2617 ret = btrfs_remove_free_space(block_group, start, num_bytes); in __exclude_logged_extent()
2619 btrfs_put_block_group(block_group); in __exclude_logged_extent()
2787 struct btrfs_block_group *block_group, *tmp; in btrfs_finish_extent_commit() local
2828 list_for_each_entry_safe(block_group, tmp, deleted_bgs, bg_list) { in btrfs_finish_extent_commit()
2834 block_group->start, in btrfs_finish_extent_commit()
2835 block_group->length, in btrfs_finish_extent_commit()
2838 list_del_init(&block_group->bg_list); in btrfs_finish_extent_commit()
2839 btrfs_unfreeze_block_group(block_group); in btrfs_finish_extent_commit()
2840 btrfs_put_block_group(block_group); in btrfs_finish_extent_commit()
3453 struct btrfs_block_group *block_group, in btrfs_lock_cluster() argument
3462 used_bg = cluster->block_group; in btrfs_lock_cluster()
3466 if (used_bg == block_group) in btrfs_lock_cluster()
3483 if (used_bg == cluster->block_group) in btrfs_lock_cluster()
3535 WARN_ON(last_ptr->block_group != cluster_bg); in find_free_extent_clustered()
3641 static int do_allocation_clustered(struct btrfs_block_group *block_group, in do_allocation_clustered() argument
3649 ret = find_free_extent_clustered(block_group, ffe_ctl, bg_ret); in do_allocation_clustered()
3655 return find_free_extent_unclustered(block_group, ffe_ctl); in do_allocation_clustered()
3679 static int do_allocation_zoned(struct btrfs_block_group *block_group, in do_allocation_zoned() argument
3683 struct btrfs_fs_info *fs_info = block_group->fs_info; in do_allocation_zoned()
3684 struct btrfs_space_info *space_info = block_group->space_info; in do_allocation_zoned()
3685 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; in do_allocation_zoned()
3686 u64 start = block_group->start; in do_allocation_zoned()
3689 u64 bytenr = block_group->start; in do_allocation_zoned()
3695 ASSERT(btrfs_is_zoned(block_group->fs_info)); in do_allocation_zoned()
3725 spin_lock(&block_group->lock); in do_allocation_zoned()
3726 if (block_group->ro || btrfs_zoned_bg_is_full(block_group)) { in do_allocation_zoned()
3733 spin_unlock(&block_group->lock); in do_allocation_zoned()
3736 if (!ret && (block_group->flags & BTRFS_BLOCK_GROUP_DATA) && in do_allocation_zoned()
3737 !btrfs_zone_activate(block_group)) { in do_allocation_zoned()
3746 spin_lock(&block_group->lock); in do_allocation_zoned()
3754 block_group->start == fs_info->treelog_bg || in do_allocation_zoned()
3757 block_group->start == fs_info->data_reloc_bg || in do_allocation_zoned()
3760 if (block_group->ro || in do_allocation_zoned()
3762 test_bit(BLOCK_GROUP_FLAG_ZONED_DATA_RELOC, &block_group->runtime_flags))) { in do_allocation_zoned()
3772 (block_group->used || block_group->reserved)) { in do_allocation_zoned()
3782 (block_group->used || block_group->reserved)) { in do_allocation_zoned()
3787 WARN_ON_ONCE(block_group->alloc_offset > block_group->zone_capacity); in do_allocation_zoned()
3788 avail = block_group->zone_capacity - block_group->alloc_offset; in do_allocation_zoned()
3803 fs_info->treelog_bg = block_group->start; in do_allocation_zoned()
3807 fs_info->data_reloc_bg = block_group->start; in do_allocation_zoned()
3823 set_bit(BLOCK_GROUP_FLAG_ZONED_DATA_RELOC, &block_group->runtime_flags); in do_allocation_zoned()
3826 ffe_ctl->found_offset = start + block_group->alloc_offset; in do_allocation_zoned()
3827 block_group->alloc_offset += num_bytes; in do_allocation_zoned()
3846 spin_unlock(&block_group->lock); in do_allocation_zoned()
3851 static int do_allocation(struct btrfs_block_group *block_group, in do_allocation() argument
3857 return do_allocation_clustered(block_group, ffe_ctl, bg_ret); in do_allocation()
3859 return do_allocation_zoned(block_group, ffe_ctl, bg_ret); in do_allocation()
3865 static void release_block_group(struct btrfs_block_group *block_group, in release_block_group() argument
3880 BUG_ON(btrfs_bg_flags_to_raid_index(block_group->flags) != in release_block_group()
3882 btrfs_release_block_group(block_group, delalloc); in release_block_group()
4126 if (last_ptr->block_group) in prepare_allocation_clustered()
4157 struct btrfs_block_group *block_group; in prepare_allocation_zoned() local
4160 list_for_each_entry(block_group, &fs_info->zone_active_bgs, active_bg_list) { in prepare_allocation_zoned()
4165 u64 avail = block_group->zone_capacity - block_group->alloc_offset; in prepare_allocation_zoned()
4167 if (block_group_bits(block_group, ffe_ctl->flags) && in prepare_allocation_zoned()
4169 ffe_ctl->hint_byte = block_group->start; in prepare_allocation_zoned()
4227 struct btrfs_block_group *block_group = NULL; in find_free_extent() local
4273 block_group = btrfs_lookup_block_group(fs_info, in find_free_extent()
4282 if (block_group && block_group_bits(block_group, ffe_ctl->flags) && in find_free_extent()
4283 block_group->cached != BTRFS_CACHE_NO) { in find_free_extent()
4285 if (list_empty(&block_group->list) || in find_free_extent()
4286 block_group->ro) { in find_free_extent()
4293 btrfs_put_block_group(block_group); in find_free_extent()
4297 block_group->flags); in find_free_extent()
4298 btrfs_lock_block_group(block_group, in find_free_extent()
4303 } else if (block_group) { in find_free_extent()
4304 btrfs_put_block_group(block_group); in find_free_extent()
4314 list_for_each_entry(block_group, in find_free_extent()
4320 if (unlikely(block_group->ro)) { in find_free_extent()
4322 btrfs_clear_treelog_bg(block_group); in find_free_extent()
4324 btrfs_clear_data_reloc_bg(block_group); in find_free_extent()
4328 btrfs_grab_block_group(block_group, ffe_ctl->delalloc); in find_free_extent()
4329 ffe_ctl->search_start = block_group->start; in find_free_extent()
4336 if (!block_group_bits(block_group, ffe_ctl->flags)) { in find_free_extent()
4347 if ((ffe_ctl->flags & extra) && !(block_group->flags & extra)) in find_free_extent()
4355 btrfs_release_block_group(block_group, ffe_ctl->delalloc); in find_free_extent()
4360 trace_find_free_extent_have_block_group(root, ffe_ctl, block_group); in find_free_extent()
4361 ffe_ctl->cached = btrfs_block_group_done(block_group); in find_free_extent()
4364 ret = btrfs_cache_block_group(block_group, false); in find_free_extent()
4382 if (unlikely(block_group->cached == BTRFS_CACHE_ERROR)) { in find_free_extent()
4388 if (!find_free_extent_check_size_class(ffe_ctl, block_group)) in find_free_extent()
4392 ret = do_allocation(block_group, ffe_ctl, &bg_ret); in find_free_extent()
4396 if (bg_ret && bg_ret != block_group) { in find_free_extent()
4397 btrfs_release_block_group(block_group, ffe_ctl->delalloc); in find_free_extent()
4398 block_group = bg_ret; in find_free_extent()
4407 block_group->start + block_group->length) { in find_free_extent()
4408 btrfs_add_free_space_unused(block_group, in find_free_extent()
4415 btrfs_add_free_space_unused(block_group, in find_free_extent()
4419 ret = btrfs_add_reserved_bytes(block_group, ffe_ctl->ram_bytes, in find_free_extent()
4424 btrfs_add_free_space_unused(block_group, in find_free_extent()
4429 btrfs_inc_block_group_reservations(block_group); in find_free_extent()
4435 trace_btrfs_reserve_extent(block_group, ffe_ctl); in find_free_extent()
4436 btrfs_release_block_group(block_group, ffe_ctl->delalloc); in find_free_extent()
4442 btrfs_wait_block_group_cache_progress(block_group, in find_free_extent()
4448 release_block_group(block_group, ffe_ctl, ffe_ctl->delalloc); in find_free_extent()
4802 struct btrfs_block_group *block_group; in btrfs_alloc_logged_file_extent() local
4816 block_group = btrfs_lookup_block_group(fs_info, ins->objectid); in btrfs_alloc_logged_file_extent()
4817 if (!block_group) in btrfs_alloc_logged_file_extent()
4820 space_info = block_group->space_info; in btrfs_alloc_logged_file_extent()
4822 spin_lock(&block_group->lock); in btrfs_alloc_logged_file_extent()
4824 block_group->reserved += ins->offset; in btrfs_alloc_logged_file_extent()
4825 spin_unlock(&block_group->lock); in btrfs_alloc_logged_file_extent()
4832 btrfs_put_block_group(block_group); in btrfs_alloc_logged_file_extent()