Btrfs-progs: chunk-recover: use right size when allocating chunk root node
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Wed, 27 Nov 2013 14:43:56 +0000 (22:43 +0800)
committerChris Mason <clm@fb.com>
Fri, 31 Jan 2014 16:22:06 +0000 (08:22 -0800)
When allocating chunk root node, we should use nodesize rather than sectorsize,
this will casue regression when making other nodesize choice.(for example 16k size now)

Reported-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
chunk-recover.c

index 44e8b83..e880bbc 100644 (file)
@@ -1034,7 +1034,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans,
        disk_key.type = BTRFS_DEV_ITEM_KEY;
        disk_key.offset = min_devid;
 
-       cow = btrfs_alloc_free_block(trans, root, root->sectorsize,
+       cow = btrfs_alloc_free_block(trans, root, root->nodesize,
                                     BTRFS_CHUNK_TREE_OBJECTID,
                                     &disk_key, 0, 0, 0);
        btrfs_set_header_bytenr(cow, cow->start);