diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-04-15 15:41:47 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:01 -0400 |
commit | e17cade25ff8074101d653557a78df09c16ca276 (patch) | |
tree | c4bddc201bf77c9a460e726a5cdd5ca1add8c256 /fs/btrfs/disk-io.c | |
parent | b248a4152956cbae1b23f4c70ef5b51d6ea2ecfb (diff) |
Btrfs: 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.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 9c94dddde704..79c284c87286 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1125,6 +1125,10 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1125 | blocksize); | 1125 | blocksize); |
1126 | BUG_ON(!chunk_root->node); | 1126 | BUG_ON(!chunk_root->node); |
1127 | 1127 | ||
1128 | read_extent_buffer(chunk_root->node, fs_info->chunk_tree_uuid, | ||
1129 | (unsigned long)btrfs_header_chunk_tree_uuid(chunk_root->node), | ||
1130 | BTRFS_UUID_SIZE); | ||
1131 | |||
1128 | ret = btrfs_read_chunk_tree(chunk_root); | 1132 | ret = btrfs_read_chunk_tree(chunk_root); |
1129 | BUG_ON(ret); | 1133 | BUG_ON(ret); |
1130 | 1134 | ||
@@ -1229,7 +1233,7 @@ int write_all_supers(struct btrfs_root *root) | |||
1229 | btrfs_set_device_sector_size(sb, dev_item, dev->sector_size); | 1233 | btrfs_set_device_sector_size(sb, dev_item, dev->sector_size); |
1230 | write_extent_buffer(sb, dev->uuid, | 1234 | write_extent_buffer(sb, dev->uuid, |
1231 | (unsigned long)btrfs_device_uuid(dev_item), | 1235 | (unsigned long)btrfs_device_uuid(dev_item), |
1232 | BTRFS_DEV_UUID_SIZE); | 1236 | BTRFS_UUID_SIZE); |
1233 | 1237 | ||
1234 | btrfs_set_header_flag(sb, BTRFS_HEADER_FLAG_WRITTEN); | 1238 | btrfs_set_header_flag(sb, BTRFS_HEADER_FLAG_WRITTEN); |
1235 | csum_tree_block(root, sb, 0); | 1239 | csum_tree_block(root, sb, 0); |