From c6eb10a7a43390e975b3f63fdf32cea58af948ea Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 3 May 2013 21:00:52 +0000 Subject: Btrfs-progs: init free space ctl with proper unit btrfsck was blowing up when checking the free space cache when we ran xfstests with -l 64k. That is because I was init'ing the free space ctl to whatever the leafsize was, which isn't right for data block groups. With this patch btrfsck no longer complains. This also fixes a tiny little typo in free-space-cache.c I noticed while figuring this problem out. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- cmds-check.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cmds-check.c') diff --git a/cmds-check.c b/cmds-check.c index 9fd53f42..71f59595 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -2799,8 +2799,15 @@ static int check_space_cache(struct btrfs_root *root) start = cache->key.objectid + cache->key.offset; if (!cache->free_space_ctl) { - if (btrfs_init_free_space_ctl(cache, - root->leafsize)) { + 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)) { ret = -ENOMEM; break; } -- cgit v1.2.3