From ffaff17911e4eb0c6177aa4661f90734f7af7b54 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 29 Aug 2007 15:56:44 -0400 Subject: 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, --- mkfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mkfs.c') 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); -- cgit v1.2.3