diff options
-rw-r--r-- | cmds-check.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmds-check.c b/cmds-check.c index 98199ce0..3cf59b61 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -6030,11 +6030,13 @@ static int pin_metadata_blocks(struct btrfs_fs_info *fs_info) static int reset_block_groups(struct btrfs_fs_info *fs_info) { + struct btrfs_block_group_cache *cache; struct btrfs_path *path; struct extent_buffer *leaf; struct btrfs_chunk *chunk; struct btrfs_key key; int ret; + u64 start; path = btrfs_alloc_path(); if (!path) @@ -6085,8 +6087,19 @@ static int reset_block_groups(struct btrfs_fs_info *fs_info) btrfs_chunk_type(leaf, chunk), key.objectid, key.offset, btrfs_chunk_length(leaf, chunk)); + set_extent_dirty(&fs_info->free_space_cache, key.offset, + key.offset + btrfs_chunk_length(leaf, chunk), + GFP_NOFS); path->slots[0]++; } + start = 0; + while (1) { + cache = btrfs_lookup_first_block_group(fs_info, start); + if (!cache) + break; + cache->cached = 1; + start = cache->key.objectid + cache->key.offset; + } btrfs_free_path(path); return 0; |