aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/mkfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/mkfs.c')
-rw-r--r--fs/btrfs/mkfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/mkfs.c b/fs/btrfs/mkfs.c
index bab98c6d6fa7..584aba44e801 100644
--- a/fs/btrfs/mkfs.c
+++ b/fs/btrfs/mkfs.c
@@ -18,12 +18,13 @@ int mkfs(int fd)
18 struct extent_item extent_item; 18 struct extent_item extent_item;
19 int ret; 19 int ret;
20 20
21 /* setup the super block area */
21 memset(info, 0, sizeof(info)); 22 memset(info, 0, sizeof(info));
22 info[0].blocknr = 16; 23 info[0].blocknr = 16;
23 info[0].objectid = 1; 24 info[0].objectid = 1;
24 info[0].tree_root = 17; 25 info[0].tree_root = 17;
25 info[0].alloc_extent.blocknr = 0; 26 info[0].alloc_extent.blocknr = 0;
26 info[0].alloc_extent.num_blocks = 20; 27 info[0].alloc_extent.num_blocks = 64;
27 /* 0-17 are used (inclusive) */ 28 /* 0-17 are used (inclusive) */
28 info[0].alloc_extent.num_used = 18; 29 info[0].alloc_extent.num_used = 18;
29 30
@@ -31,12 +32,14 @@ int mkfs(int fd)
31 info[1].objectid = 2; 32 info[1].objectid = 2;
32 info[1].tree_root = 64; 33 info[1].tree_root = 64;
33 info[1].alloc_extent.blocknr = 64; 34 info[1].alloc_extent.blocknr = 64;
34 info[1].alloc_extent.num_blocks = 8; 35 info[1].alloc_extent.num_blocks = 64;
35 info[1].alloc_extent.num_used = 1; 36 info[1].alloc_extent.num_used = 1;
36 ret = pwrite(fd, info, sizeof(info), 37 ret = pwrite(fd, info, sizeof(info),
37 CTREE_SUPER_INFO_OFFSET(CTREE_BLOCKSIZE)); 38 CTREE_SUPER_INFO_OFFSET(CTREE_BLOCKSIZE));
38 if (ret != sizeof(info)) 39 if (ret != sizeof(info))
39 return -1; 40 return -1;
41
42 /* create leaves for the tree root and extent root */
40 memset(&empty_leaf, 0, sizeof(empty_leaf)); 43 memset(&empty_leaf, 0, sizeof(empty_leaf));
41 empty_leaf.header.parentid = 1; 44 empty_leaf.header.parentid = 1;
42 empty_leaf.header.blocknr = 17; 45 empty_leaf.header.blocknr = 17;