Displaying 5 results from an estimated 5 matches for "btrfs_lookup_first_block_group".
2008 Sep 30
0
[PATCH] fix seekiness due to finding the wrong block group
Hello,
This patch fixes a problem where we end up seeking too much when *last_ptr is
valid. This happens because btrfs_lookup_first_block_group only returns a block
group that starts on or after the given search start, so if the search_start is
in the middle of a block group it will return the block group after the given
search_start, which is suboptimal. This patch fixes that by doing a
btrfs_lookup_block_group, which will return the blo...
2008 Oct 10
1
[PATCH] fix enospc when there is plenty of space
...);
- if (ret)
- goto out;
-
- if (cache->ro || !block_group_bits(cache, data))
- goto new_group;
-
- info = btrfs_find_free_space(cache, last, num);
- if (info) {
- *start_ret = info->offset;
- return 0;
- }
-
-new_group:
- last = cache->key.objectid + cache->key.offset;
-
- cache = btrfs_lookup_first_block_group(root->fs_info, last);
- if (!cache)
- goto out;
-
- *cache_ret = cache;
- goto again;
-
-out:
- return -ENOSPC;
-}
-
-static u64 div_factor(u64 num, int factor)
-{
- if (factor == 10)
- return num;
- num *= factor;
- do_div(num, 10);
- return num;
-}
-
static struct btrfs_space_info *__find_s...
2009 Jun 03
0
[PATCH] Make sure all dirty blocks are written at commit time
...he_node);
- if (entry->dirty) {
- cache = entry;
- break;
- }
+ if (last == 0) {
+ err = btrfs_run_delayed_refs(trans, root,
+ (unsigned long)-1);
+ BUG_ON(err);
}
- spin_unlock(&root->fs_info->block_group_cache_lock);
- if (!cache)
- break;
+ cache = btrfs_lookup_first_block_group(root->fs_info, last);
+ while (cache) {
+ if (cache->dirty)
+ break;
+ cache = next_block_group(root, cache);
+ }
+ if (!cache) {
+ if (last == 0)
+ break;
+ last = 0;
+ continue;
+ }
cache->dirty = 0;
- last += cache->key.offset;
+ last = cache->key.object...
2009 Mar 20
1
[PATCH 2/4] Btrfs: clean up find_free_extent
...eeded += empty_size;
+ down_read(&space_info->groups_sem);
+ goto have_block_group;
+ }
+
empty_size += empty_cluster;
+ using_hint = 0;
}
- total_needed += empty_size;
- block_group = btrfs_lookup_block_group(root->fs_info, search_start);
- if (!block_group)
- block_group = btrfs_lookup_first_block_group(root->fs_info,
- search_start);
- space_info = __find_space_info(root->fs_info, data);
-
+search:
down_read(&space_info->groups_sem);
- while (1) {
+ list_for_each_entry(block_group, &space_info->block_groups, list) {
struct btrfs_free_space *free_space;
- /*
-...
2013 Apr 03
0
[PATCH] Btrfs-progs: add a free space cache checker to fsck
...s_super_generation(root->fs_info->super_copy) !=
+ btrfs_super_cache_generation(root->fs_info->super_copy)) {
+ printf("cache and super generation don''t match, space cache "
+ "will be invalidated\n");
+ return 0;
+ }
+
+ while (1) {
+ cache = btrfs_lookup_first_block_group(root->fs_info, start);
+ if (!cache)
+ break;
+
+ start = cache->key.objectid + cache->key.offset;
+ if (!cache->free_space_ctl) {
+ if (btrfs_init_free_space_ctl(cache,
+ root->leafsize)) {
+ ret = -ENOMEM;
+ break;
+ }
+ } else {
+ btrfs_remove_free_spa...