@@ -197,6 +197,8 @@ int make_btrfs(int fd, const char *device, const char *label,
BUG_ON(ret != leafsize);
/* create the items for the extent tree */
+ memset(buf->data+sizeof(struct btrfs_header), 0,
+ leafsize-sizeof(struct btrfs_header));
nritems = 0;
itemoff = __BTRFS_LEAF_DATA_SIZE(leafsize);
for (i = 1; i < 7; i++) {
@@ -242,6 +244,8 @@ int make_btrfs(int fd, const char *device, const char *label,
BUG_ON(ret != leafsize);
/* create the chunk tree */
+ memset(buf->data+sizeof(struct btrfs_header), 0,
+ leafsize-sizeof(struct btrfs_header));
nritems = 0;
item_size = sizeof(*dev_item);
itemoff = __BTRFS_LEAF_DATA_SIZE(leafsize) - item_size;
@@ -323,6 +327,8 @@ int make_btrfs(int fd, const char *device, const char *label,
ret = pwrite(fd, buf->data, leafsize, blocks[3]);
/* create the device tree */
+ memset(buf->data+sizeof(struct btrfs_header), 0,
+ leafsize-sizeof(struct btrfs_header));
nritems = 0;
itemoff = __BTRFS_LEAF_DATA_SIZE(leafsize) -
sizeof(struct btrfs_dev_extent);
@@ -356,6 +362,8 @@ int make_btrfs(int fd, const char *device, const char *label,
ret = pwrite(fd, buf->data, leafsize, blocks[4]);
/* create the FS root */
+ memset(buf->data+sizeof(struct btrfs_header), 0,
+ leafsize-sizeof(struct btrfs_header));
btrfs_set_header_bytenr(buf, blocks[5]);
btrfs_set_header_owner(buf, BTRFS_FS_TREE_OBJECTID);
btrfs_set_header_nritems(buf, 0);
@@ -364,6 +372,8 @@ int make_btrfs(int fd, const char *device, const char *label,
BUG_ON(ret != leafsize);
/* finally create the csum root */
+ memset(buf->data+sizeof(struct btrfs_header), 0,
+ leafsize-sizeof(struct btrfs_header));
btrfs_set_header_bytenr(buf, blocks[6]);
btrfs_set_header_owner(buf, BTRFS_CSUM_TREE_OBJECTID);
btrfs_set_header_nritems(buf, 0);