mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-26 16:12:34 +00:00
Btrfs-progs: fix free space cache checks
This fixes two bugs with the free space cache checker. First is we apparently always use root->sectorsize for our unit in the kernel so we have to do that in progs otherwise bitmaps turn out to not look right if we have leafsize != sectorsize. The second is a small issue if we had skinny metadata extents set, we wouldn't advance last properly because we unconditionally use key.offset instead of root->leafsize. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
439ce45e48
commit
e0ac34931a
16
cmds-check.c
16
cmds-check.c
@ -2853,7 +2853,10 @@ static int verify_space_cache(struct btrfs_root *root,
|
||||
}
|
||||
|
||||
if (last == key.objectid) {
|
||||
last = key.objectid + key.offset;
|
||||
if (key.type == BTRFS_EXTENT_ITEM_KEY)
|
||||
last = key.objectid + key.offset;
|
||||
else
|
||||
last = key.objectid + root->leafsize;
|
||||
path->slots[0]++;
|
||||
continue;
|
||||
}
|
||||
@ -2906,15 +2909,8 @@ static int check_space_cache(struct btrfs_root *root)
|
||||
|
||||
start = cache->key.objectid + cache->key.offset;
|
||||
if (!cache->free_space_ctl) {
|
||||
int sectorsize;
|
||||
|
||||
if (cache->flags & (BTRFS_BLOCK_GROUP_METADATA |
|
||||
BTRFS_BLOCK_GROUP_SYSTEM))
|
||||
sectorsize = root->leafsize;
|
||||
else
|
||||
sectorsize = root->sectorsize;
|
||||
|
||||
if (btrfs_init_free_space_ctl(cache, sectorsize)) {
|
||||
if (btrfs_init_free_space_ctl(cache,
|
||||
root->sectorsize)) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user