diff options
author | Chris Mason <chris.mason@oracle.com> | 2012-02-09 09:29:19 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-02-09 09:29:19 -0500 |
commit | 0bc5e18aace8d2535adc57cfa95c2481e94d60f7 (patch) | |
tree | 60eadd708202429de536f986c3b0fb8190a9f305 /extent-tree.c | |
parent | d01fcebeb5187569d2ac29ba8aa2518f76e4f2b0 (diff) |
btrfsck: make sure to dirty all block groups as we fix accounting
The code that corrects the count of bytes used in each block group
was only marking block groups dirty when they contained extents. This
fixes things to dirty all the block groups, so any empty block groups
are written with their correct (zero) count.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r-- | extent-tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/extent-tree.c b/extent-tree.c index 544ab2ff..5c4057e6 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -3378,6 +3378,8 @@ int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans, struct btrfs_block_group_cache *cache; struct btrfs_fs_info *fs_info = root->fs_info; + root = root->fs_info->extent_root; + while(1) { cache = btrfs_lookup_block_group(fs_info, start); if (!cache) @@ -3385,6 +3387,10 @@ int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans, start = cache->key.objectid + cache->key.offset; btrfs_set_block_group_used(&cache->item, 0); cache->space_info->bytes_used = 0; + set_extent_bits(&root->fs_info->block_group_cache, + cache->key.objectid, + cache->key.objectid + cache->key.offset -1, + BLOCK_GROUP_DIRTY, GFP_NOFS); } btrfs_init_path(&path); |