summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-15 15:42:08 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2008-04-15 15:42:08 -0400
commit951fd7371c5719f0491e0a8a524cf5be43729412 (patch)
tree9930eafb1f6d38600e101c3c965b6a6723254000 /mkfs.c
parent7e7628ec4ebec9a5046025b4a139d55ac3a69d49 (diff)
Add chunk uuids and update multi-device back references
Block headers now store the chunk tree uuid Chunk items records the device uuid for each stripes Device extent items record better back refs to the chunk tree Block groups record better back refs to the chunk tree The chunk tree format has also changed. The objectid of BTRFS_CHUNK_ITEM_KEY used to be the logical offset of the chunk. Now it is a chunk tree id, with the logical offset being stored in the offset field of the key. This allows a single chunk tree to record multiple logical address spaces, upping the number of bytes indexed by a chunk tree from 2^64 to 2^128.
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mkfs.c b/mkfs.c
index 8eabc41d..741edc67 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -82,16 +82,17 @@ static int make_root_dir(int fd, const char *device_name) {
root->fs_info->force_system_allocs = 1;
ret = btrfs_make_block_group(trans, root, bytes_used,
BTRFS_BLOCK_GROUP_SYSTEM,
- BTRFS_CHUNK_TREE_OBJECTID,
+ BTRFS_FIRST_CHUNK_TREE_OBJECTID,
0, BTRFS_MKFS_SYSTEM_GROUP_SIZE);
BUG_ON(ret);
+
ret = btrfs_alloc_chunk(trans, root->fs_info->extent_root,
&chunk_start, &chunk_size,
BTRFS_BLOCK_GROUP_METADATA);
BUG_ON(ret);
ret = btrfs_make_block_group(trans, root, 0,
BTRFS_BLOCK_GROUP_METADATA,
- BTRFS_CHUNK_TREE_OBJECTID,
+ BTRFS_FIRST_CHUNK_TREE_OBJECTID,
chunk_start, chunk_size);
BUG_ON(ret);
@@ -106,7 +107,7 @@ static int make_root_dir(int fd, const char *device_name) {
BUG_ON(ret);
ret = btrfs_make_block_group(trans, root, 0,
BTRFS_BLOCK_GROUP_DATA,
- BTRFS_CHUNK_TREE_OBJECTID,
+ BTRFS_FIRST_CHUNK_TREE_OBJECTID,
chunk_start, chunk_size);
BUG_ON(ret);
@@ -186,7 +187,7 @@ static int create_one_raid_group(struct btrfs_trans_handle *trans,
&chunk_start, &chunk_size, type);
BUG_ON(ret);
ret = btrfs_make_block_group(trans, root->fs_info->extent_root, 0,
- type, BTRFS_CHUNK_TREE_OBJECTID,
+ type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
chunk_start, chunk_size);
BUG_ON(ret);
return ret;