aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-15 15:41:47 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:01 -0400
commite17cade25ff8074101d653557a78df09c16ca276 (patch)
treec4bddc201bf77c9a460e726a5cdd5ca1add8c256 /fs/btrfs/ctree.c
parentb248a4152956cbae1b23f4c70ef5b51d6ea2ecfb (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/ctree.c')
-rw-r--r--fs/btrfs/ctree.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index e8bf6c221e4e..618e526c9046 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1382,6 +1382,11 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
1382 write_extent_buffer(c, root->fs_info->fsid, 1382 write_extent_buffer(c, root->fs_info->fsid,
1383 (unsigned long)btrfs_header_fsid(c), 1383 (unsigned long)btrfs_header_fsid(c),
1384 BTRFS_FSID_SIZE); 1384 BTRFS_FSID_SIZE);
1385
1386 write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
1387 (unsigned long)btrfs_header_chunk_tree_uuid(c),
1388 BTRFS_UUID_SIZE);
1389
1385 btrfs_set_node_key(c, &lower_key, 0); 1390 btrfs_set_node_key(c, &lower_key, 0);
1386 btrfs_set_node_blockptr(c, 0, lower->start); 1391 btrfs_set_node_blockptr(c, 0, lower->start);
1387 lower_gen = btrfs_header_generation(lower); 1392 lower_gen = btrfs_header_generation(lower);
@@ -1513,6 +1518,9 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
1513 write_extent_buffer(split, root->fs_info->fsid, 1518 write_extent_buffer(split, root->fs_info->fsid,
1514 (unsigned long)btrfs_header_fsid(split), 1519 (unsigned long)btrfs_header_fsid(split),
1515 BTRFS_FSID_SIZE); 1520 BTRFS_FSID_SIZE);
1521 write_extent_buffer(split, root->fs_info->chunk_tree_uuid,
1522 (unsigned long)btrfs_header_chunk_tree_uuid(split),
1523 BTRFS_UUID_SIZE);
1516 1524
1517 mid = (c_nritems + 1) / 2; 1525 mid = (c_nritems + 1) / 2;
1518 1526
@@ -2043,6 +2051,10 @@ again:
2043 write_extent_buffer(right, root->fs_info->fsid, 2051 write_extent_buffer(right, root->fs_info->fsid,
2044 (unsigned long)btrfs_header_fsid(right), 2052 (unsigned long)btrfs_header_fsid(right),
2045 BTRFS_FSID_SIZE); 2053 BTRFS_FSID_SIZE);
2054
2055 write_extent_buffer(right, root->fs_info->chunk_tree_uuid,
2056 (unsigned long)btrfs_header_chunk_tree_uuid(right),
2057 BTRFS_UUID_SIZE);
2046 if (mid <= slot) { 2058 if (mid <= slot) {
2047 if (nritems == 1 || 2059 if (nritems == 1 ||
2048 leaf_space_used(l, mid, nritems - mid) + space_needed > 2060 leaf_space_used(l, mid, nritems - mid) + space_needed >