summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@redhat.com>2007-08-29 15:56:44 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-08-29 15:56:44 -0400
commitffaff17911e4eb0c6177aa4661f90734f7af7b54 (patch)
tree2397e812d960a76464f987465b9663e1152b5875 /mkfs.c
parentdbd1848d1ffa2e4e00b49e7766c46f0ba512a8aa (diff)
btrfs-progs support for root block accounting
This adds support for keeping track of the number of blocks used by root_item's. This makes it so that mkfs lays down the "default" subvol with the correct block accounting in place. Thank you,
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mkfs.c b/mkfs.c
index bd664672..c7de6df5 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -166,7 +166,7 @@ static int make_root_dir(int fd) {
memcpy(&location, &root->fs_info->fs_root->root_key, sizeof(location));
location.offset = (u64)-1;
ret = btrfs_insert_dir_item(trans, root->fs_info->tree_root,
- "default", strlen("default"),
+ "default", 7,
btrfs_super_root_dir(root->fs_info->disk_super),
&location, BTRFS_FT_DIR);
if (ret)
@@ -242,6 +242,7 @@ int mkfs(int fd, char *pathname, u64 num_blocks, u32 blocksize)
&root_item, sizeof(root_item));
btrfs_set_root_blocknr(&root_item, start_block + 3);
+ btrfs_set_root_blocks_used(&root_item, 1);
itemoff = itemoff - sizeof(root_item);
btrfs_set_item_offset(&item, itemoff);
btrfs_set_disk_key_objectid(&item.key, BTRFS_FS_TREE_OBJECTID);