diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-04-05 14:28:50 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-04-05 14:28:50 -0400 |
commit | 3eb0314dc1053b1ae617dcc8d6d93f776c5baa31 (patch) | |
tree | b670433f8d7d9f80b2f3389f1a44f285bf223e53 /fs/btrfs | |
parent | 5be6f7f174146d91039a27ebb2f1b4ac599172b3 (diff) |
Btrfs: uuids
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/TODO | 1 | ||||
-rw-r--r-- | fs/btrfs/ctree.c | 12 | ||||
-rw-r--r-- | fs/btrfs/super.c | 4 |
3 files changed, 13 insertions, 4 deletions
diff --git a/fs/btrfs/TODO b/fs/btrfs/TODO index db986c46a554..ea4c38c790b4 100644 --- a/fs/btrfs/TODO +++ b/fs/btrfs/TODO | |||
@@ -3,7 +3,6 @@ | |||
3 | * Add block mapping tree (simple dm layer) | 3 | * Add block mapping tree (simple dm layer) |
4 | * Make allocator smarter | 4 | * Make allocator smarter |
5 | * add a block group to struct inode | 5 | * add a block group to struct inode |
6 | * Make directory hashing work on 32 bit | ||
7 | * Make sure nobh stuff is working properly for cows | 6 | * Make sure nobh stuff is working properly for cows |
8 | * Do actual block accounting | 7 | * Do actual block accounting |
9 | * Check compat and incompat flags on the inode | 8 | * Check compat and incompat flags on the inode |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 864ee423b300..39b551564fcf 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -200,6 +200,10 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path, | |||
200 | static int check_block(struct btrfs_root *root, struct btrfs_path *path, | 200 | static int check_block(struct btrfs_root *root, struct btrfs_path *path, |
201 | int level) | 201 | int level) |
202 | { | 202 | { |
203 | struct btrfs_node *node = btrfs_buffer_node(path->nodes[level]); | ||
204 | if (memcmp(node->header.fsid, root->fs_info->disk_super->fsid, | ||
205 | sizeof(node->header.fsid))) | ||
206 | BUG(); | ||
203 | if (level == 0) | 207 | if (level == 0) |
204 | return check_leaf(root, path, level); | 208 | return check_leaf(root, path, level); |
205 | return check_node(root, path, level); | 209 | return check_node(root, path, level); |
@@ -687,6 +691,8 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
687 | btrfs_set_header_parentid(&c->header, | 691 | btrfs_set_header_parentid(&c->header, |
688 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | 692 | btrfs_header_parentid(btrfs_buffer_header(root->node))); |
689 | lower = btrfs_buffer_node(path->nodes[level-1]); | 693 | lower = btrfs_buffer_node(path->nodes[level-1]); |
694 | memcpy(c->header.fsid, root->fs_info->disk_super->fsid, | ||
695 | sizeof(c->header.fsid)); | ||
690 | if (btrfs_is_leaf(lower)) | 696 | if (btrfs_is_leaf(lower)) |
691 | lower_key = &((struct btrfs_leaf *)lower)->items[0].key; | 697 | lower_key = &((struct btrfs_leaf *)lower)->items[0].key; |
692 | else | 698 | else |
@@ -780,6 +786,8 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root | |||
780 | btrfs_set_header_generation(&split->header, trans->transid); | 786 | btrfs_set_header_generation(&split->header, trans->transid); |
781 | btrfs_set_header_parentid(&split->header, | 787 | btrfs_set_header_parentid(&split->header, |
782 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | 788 | btrfs_header_parentid(btrfs_buffer_header(root->node))); |
789 | memcpy(split->header.fsid, root->fs_info->disk_super->fsid, | ||
790 | sizeof(split->header.fsid)); | ||
783 | mid = (c_nritems + 1) / 2; | 791 | mid = (c_nritems + 1) / 2; |
784 | btrfs_memcpy(root, split, split->ptrs, c->ptrs + mid, | 792 | btrfs_memcpy(root, split, split->ptrs, c->ptrs + mid, |
785 | (c_nritems - mid) * sizeof(struct btrfs_key_ptr)); | 793 | (c_nritems - mid) * sizeof(struct btrfs_key_ptr)); |
@@ -1139,6 +1147,8 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1139 | btrfs_set_header_level(&right->header, 0); | 1147 | btrfs_set_header_level(&right->header, 0); |
1140 | btrfs_set_header_parentid(&right->header, | 1148 | btrfs_set_header_parentid(&right->header, |
1141 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | 1149 | btrfs_header_parentid(btrfs_buffer_header(root->node))); |
1150 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, | ||
1151 | sizeof(right->header.fsid)); | ||
1142 | if (mid <= slot) { | 1152 | if (mid <= slot) { |
1143 | if (nritems == 1 || | 1153 | if (nritems == 1 || |
1144 | leaf_space_used(l, mid, nritems - mid) + space_needed > | 1154 | leaf_space_used(l, mid, nritems - mid) + space_needed > |
@@ -1229,6 +1239,8 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1229 | btrfs_set_header_level(&right->header, 0); | 1239 | btrfs_set_header_level(&right->header, 0); |
1230 | btrfs_set_header_parentid(&right->header, | 1240 | btrfs_set_header_parentid(&right->header, |
1231 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | 1241 | btrfs_header_parentid(btrfs_buffer_header(root->node))); |
1242 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, | ||
1243 | sizeof(right->header.fsid)); | ||
1232 | btrfs_cpu_key_to_disk(&disk_key, ins_key); | 1244 | btrfs_cpu_key_to_disk(&disk_key, ins_key); |
1233 | btrfs_set_header_nritems(&right->header, 0); | 1245 | btrfs_set_header_nritems(&right->header, 0); |
1234 | wret = insert_ptr(trans, root, path, | 1246 | wret = insert_ptr(trans, root, path, |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d4ee78046b86..32224ffdcecd 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -483,10 +483,8 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
483 | if (btrfs_disk_key_objectid(&item->key) != key.objectid) | 483 | if (btrfs_disk_key_objectid(&item->key) != key.objectid) |
484 | break; | 484 | break; |
485 | if (btrfs_disk_key_offset(&item->key) > | 485 | if (btrfs_disk_key_offset(&item->key) > |
486 | root->fs_info->highest_inode) { | 486 | root->fs_info->highest_inode) |
487 | printk("stopping at highest inode %Lu\n", root->fs_info->highest_inode); | ||
488 | break; | 487 | break; |
489 | } | ||
490 | if (btrfs_disk_key_type(&item->key) != BTRFS_DIR_INDEX_KEY) | 488 | if (btrfs_disk_key_type(&item->key) != BTRFS_DIR_INDEX_KEY) |
491 | continue; | 489 | continue; |
492 | if (btrfs_disk_key_offset(&item->key) < filp->f_pos) | 490 | if (btrfs_disk_key_offset(&item->key) < filp->f_pos) |