diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-04-10 12:36:36 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-04-10 12:36:36 -0400 |
commit | d0dbc6245cefa36e19dff49c557ccf05e3063e9c (patch) | |
tree | 88d01c9d2dbfc92aea35523f77e32d81310e3e56 /fs/btrfs | |
parent | 1b05da2ee6217e7d55460d04335813fec25be4ca (diff) |
Btrfs: drop owner and parentid
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 25 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 2 | ||||
-rw-r--r-- | fs/btrfs/print-tree.c | 4 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 6 |
6 files changed, 6 insertions, 47 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 39b551564fcf..f31ac843bf2e 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -688,8 +688,6 @@ static int insert_new_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
688 | btrfs_set_header_level(&c->header, level); | 688 | btrfs_set_header_level(&c->header, level); |
689 | btrfs_set_header_blocknr(&c->header, t->b_blocknr); | 689 | btrfs_set_header_blocknr(&c->header, t->b_blocknr); |
690 | btrfs_set_header_generation(&c->header, trans->transid); | 690 | btrfs_set_header_generation(&c->header, trans->transid); |
691 | btrfs_set_header_parentid(&c->header, | ||
692 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | ||
693 | lower = btrfs_buffer_node(path->nodes[level-1]); | 691 | lower = btrfs_buffer_node(path->nodes[level-1]); |
694 | memcpy(c->header.fsid, root->fs_info->disk_super->fsid, | 692 | memcpy(c->header.fsid, root->fs_info->disk_super->fsid, |
695 | sizeof(c->header.fsid)); | 693 | sizeof(c->header.fsid)); |
@@ -784,8 +782,6 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root | |||
784 | btrfs_set_header_level(&split->header, btrfs_header_level(&c->header)); | 782 | btrfs_set_header_level(&split->header, btrfs_header_level(&c->header)); |
785 | btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr); | 783 | btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr); |
786 | btrfs_set_header_generation(&split->header, trans->transid); | 784 | btrfs_set_header_generation(&split->header, trans->transid); |
787 | btrfs_set_header_parentid(&split->header, | ||
788 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | ||
789 | memcpy(split->header.fsid, root->fs_info->disk_super->fsid, | 785 | memcpy(split->header.fsid, root->fs_info->disk_super->fsid, |
790 | sizeof(split->header.fsid)); | 786 | sizeof(split->header.fsid)); |
791 | mid = (c_nritems + 1) / 2; | 787 | mid = (c_nritems + 1) / 2; |
@@ -1145,8 +1141,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1145 | btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); | 1141 | btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); |
1146 | btrfs_set_header_generation(&right->header, trans->transid); | 1142 | btrfs_set_header_generation(&right->header, trans->transid); |
1147 | btrfs_set_header_level(&right->header, 0); | 1143 | btrfs_set_header_level(&right->header, 0); |
1148 | btrfs_set_header_parentid(&right->header, | ||
1149 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | ||
1150 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, | 1144 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, |
1151 | sizeof(right->header.fsid)); | 1145 | sizeof(right->header.fsid)); |
1152 | if (mid <= slot) { | 1146 | if (mid <= slot) { |
@@ -1237,8 +1231,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1237 | btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); | 1231 | btrfs_set_header_blocknr(&right->header, right_buffer->b_blocknr); |
1238 | btrfs_set_header_generation(&right->header, trans->transid); | 1232 | btrfs_set_header_generation(&right->header, trans->transid); |
1239 | btrfs_set_header_level(&right->header, 0); | 1233 | btrfs_set_header_level(&right->header, 0); |
1240 | btrfs_set_header_parentid(&right->header, | ||
1241 | btrfs_header_parentid(btrfs_buffer_header(root->node))); | ||
1242 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, | 1234 | memcpy(right->header.fsid, root->fs_info->disk_super->fsid, |
1243 | sizeof(right->header.fsid)); | 1235 | sizeof(right->header.fsid)); |
1244 | btrfs_cpu_key_to_disk(&disk_key, ins_key); | 1236 | btrfs_cpu_key_to_disk(&disk_key, ins_key); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5103709bb2b9..0ba560f0d2a6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -60,7 +60,6 @@ struct btrfs_header { | |||
60 | u8 fsid[16]; /* FS specific uuid */ | 60 | u8 fsid[16]; /* FS specific uuid */ |
61 | __le64 blocknr; /* which block this node is supposed to live in */ | 61 | __le64 blocknr; /* which block this node is supposed to live in */ |
62 | __le64 generation; | 62 | __le64 generation; |
63 | __le64 parentid; /* objectid of the tree root */ | ||
64 | __le16 nritems; | 63 | __le16 nritems; |
65 | __le16 flags; | 64 | __le16 flags; |
66 | u8 level; | 65 | u8 level; |
@@ -147,7 +146,6 @@ struct btrfs_path { | |||
147 | */ | 146 | */ |
148 | struct btrfs_extent_item { | 147 | struct btrfs_extent_item { |
149 | __le32 refs; | 148 | __le32 refs; |
150 | __le64 owner; | ||
151 | } __attribute__ ((__packed__)); | 149 | } __attribute__ ((__packed__)); |
152 | 150 | ||
153 | struct btrfs_inode_timespec { | 151 | struct btrfs_inode_timespec { |
@@ -443,16 +441,6 @@ static inline void btrfs_set_timespec_nsec(struct btrfs_inode_timespec *ts, | |||
443 | ts->nsec = cpu_to_le32(val); | 441 | ts->nsec = cpu_to_le32(val); |
444 | } | 442 | } |
445 | 443 | ||
446 | static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei) | ||
447 | { | ||
448 | return le64_to_cpu(ei->owner); | ||
449 | } | ||
450 | |||
451 | static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val) | ||
452 | { | ||
453 | ei->owner = cpu_to_le64(val); | ||
454 | } | ||
455 | |||
456 | static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei) | 444 | static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei) |
457 | { | 445 | { |
458 | return le32_to_cpu(ei->refs); | 446 | return le32_to_cpu(ei->refs); |
@@ -652,17 +640,6 @@ static inline void btrfs_set_header_generation(struct btrfs_header *h, | |||
652 | h->generation = cpu_to_le64(val); | 640 | h->generation = cpu_to_le64(val); |
653 | } | 641 | } |
654 | 642 | ||
655 | static inline u64 btrfs_header_parentid(struct btrfs_header *h) | ||
656 | { | ||
657 | return le64_to_cpu(h->parentid); | ||
658 | } | ||
659 | |||
660 | static inline void btrfs_set_header_parentid(struct btrfs_header *h, | ||
661 | u64 parentid) | ||
662 | { | ||
663 | h->parentid = cpu_to_le64(parentid); | ||
664 | } | ||
665 | |||
666 | static inline u16 btrfs_header_nritems(struct btrfs_header *h) | 643 | static inline u16 btrfs_header_nritems(struct btrfs_header *h) |
667 | { | 644 | { |
668 | return le16_to_cpu(h->nritems); | 645 | return le16_to_cpu(h->nritems); |
@@ -919,7 +896,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
919 | struct btrfs_root *root); | 896 | struct btrfs_root *root); |
920 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root | 897 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root |
921 | *root, u64 num_blocks, u64 search_start, u64 | 898 | *root, u64 num_blocks, u64 search_start, u64 |
922 | search_end, u64 owner, struct btrfs_key *ins); | 899 | search_end, struct btrfs_key *ins); |
923 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 900 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
924 | struct buffer_head *buf); | 901 | struct buffer_head *buf); |
925 | int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root | 902 | int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index efc604eea0b0..be9630df506c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -157,8 +157,6 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, struct | |||
157 | struct btrfs_fs_info *info = extent_root->fs_info; | 157 | struct btrfs_fs_info *info = extent_root->fs_info; |
158 | 158 | ||
159 | btrfs_set_extent_refs(&extent_item, 1); | 159 | btrfs_set_extent_refs(&extent_item, 1); |
160 | btrfs_set_extent_owner(&extent_item, | ||
161 | btrfs_header_parentid(btrfs_buffer_header(extent_root->node))); | ||
162 | ins.offset = 1; | 160 | ins.offset = 1; |
163 | ins.flags = 0; | 161 | ins.flags = 0; |
164 | btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY); | 162 | btrfs_set_key_type(&ins, BTRFS_EXTENT_ITEM_KEY); |
@@ -457,7 +455,7 @@ error: | |||
457 | */ | 455 | */ |
458 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root | 456 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root |
459 | *root, u64 num_blocks, u64 search_start, u64 | 457 | *root, u64 num_blocks, u64 search_start, u64 |
460 | search_end, u64 owner, struct btrfs_key *ins) | 458 | search_end, struct btrfs_key *ins) |
461 | { | 459 | { |
462 | int ret; | 460 | int ret; |
463 | int pending_ret; | 461 | int pending_ret; |
@@ -467,7 +465,6 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root | |||
467 | struct btrfs_extent_item extent_item; | 465 | struct btrfs_extent_item extent_item; |
468 | 466 | ||
469 | btrfs_set_extent_refs(&extent_item, 1); | 467 | btrfs_set_extent_refs(&extent_item, 1); |
470 | btrfs_set_extent_owner(&extent_item, owner); | ||
471 | 468 | ||
472 | if (root == extent_root) { | 469 | if (root == extent_root) { |
473 | BUG_ON(extent_root->fs_info->current_insert.offset == 0); | 470 | BUG_ON(extent_root->fs_info->current_insert.offset == 0); |
@@ -510,8 +507,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
510 | int ret; | 507 | int ret; |
511 | struct buffer_head *buf; | 508 | struct buffer_head *buf; |
512 | 509 | ||
513 | ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1, | 510 | ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1, &ins); |
514 | btrfs_header_parentid(btrfs_buffer_header(root->node)), &ins); | ||
515 | if (ret) { | 511 | if (ret) { |
516 | BUG(); | 512 | BUG(); |
517 | return NULL; | 513 | return NULL; |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 2c98b620c594..d9fd7f4d3794 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -19,7 +19,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans, | |||
19 | BUG_ON(!path); | 19 | BUG_ON(!path); |
20 | btrfs_init_path(path); | 20 | btrfs_init_path(path); |
21 | ret = btrfs_alloc_extent(trans, root, num_blocks, hint_block, | 21 | ret = btrfs_alloc_extent(trans, root, num_blocks, hint_block, |
22 | (u64)-1, objectid, &ins); | 22 | (u64)-1, &ins); |
23 | BUG_ON(ret); | 23 | BUG_ON(ret); |
24 | file_key.objectid = objectid; | 24 | file_key.objectid = objectid; |
25 | file_key.offset = offset; | 25 | file_key.offset = offset; |
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 854d47d9bdc9..0732a2fbb23a 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -50,8 +50,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) | |||
50 | break; | 50 | break; |
51 | case BTRFS_EXTENT_ITEM_KEY: | 51 | case BTRFS_EXTENT_ITEM_KEY: |
52 | ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); | 52 | ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); |
53 | printk("\t\textent data refs %u owner %Lu\n", | 53 | printk("\t\textent data refs %u\n", |
54 | btrfs_extent_refs(ei), btrfs_extent_owner(ei)); | 54 | btrfs_extent_refs(ei)); |
55 | break; | 55 | break; |
56 | case BTRFS_STRING_ITEM_KEY: | 56 | case BTRFS_STRING_ITEM_KEY: |
57 | printk("\t\titem data %.*s\n", btrfs_item_size(item), | 57 | printk("\t\titem data %.*s\n", btrfs_item_size(item), |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 54978d1bd958..f64c1729b0e1 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -163,7 +163,6 @@ int add_dirty_roots(struct btrfs_trans_handle *trans, | |||
163 | int i; | 163 | int i; |
164 | int ret; | 164 | int ret; |
165 | int err; | 165 | int err; |
166 | printk("add dirty\n"); | ||
167 | while(1) { | 166 | while(1) { |
168 | ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0, | 167 | ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0, |
169 | ARRAY_SIZE(gang), | 168 | ARRAY_SIZE(gang), |
@@ -188,7 +187,6 @@ printk("add dirty\n"); | |||
188 | dirty->commit_root = root->commit_root; | 187 | dirty->commit_root = root->commit_root; |
189 | root->commit_root = NULL; | 188 | root->commit_root = NULL; |
190 | dirty->root = root; | 189 | dirty->root = root; |
191 | printk("adding dirty root %Lu gen %Lu blocknr %Lu\n", root->root_key.objectid, root->root_key.offset, dirty->commit_root->b_blocknr); | ||
192 | root->root_key.offset = root->fs_info->generation; | 190 | root->root_key.offset = root->fs_info->generation; |
193 | btrfs_set_root_blocknr(&root->root_item, | 191 | btrfs_set_root_blocknr(&root->root_item, |
194 | root->node->b_blocknr); | 192 | root->node->b_blocknr); |
@@ -199,7 +197,6 @@ printk("adding dirty root %Lu gen %Lu blocknr %Lu\n", root->root_key.objectid, r | |||
199 | list_add(&dirty->list, list); | 197 | list_add(&dirty->list, list); |
200 | } | 198 | } |
201 | } | 199 | } |
202 | printk("add dirty done\n"); | ||
203 | return 0; | 200 | return 0; |
204 | } | 201 | } |
205 | 202 | ||
@@ -213,12 +210,10 @@ int drop_dirty_roots(struct btrfs_root *tree_root, struct list_head *list) | |||
213 | dirty = list_entry(list->next, struct dirty_root, list); | 210 | dirty = list_entry(list->next, struct dirty_root, list); |
214 | list_del_init(&dirty->list); | 211 | list_del_init(&dirty->list); |
215 | trans = btrfs_start_transaction(tree_root, 1); | 212 | trans = btrfs_start_transaction(tree_root, 1); |
216 | printk("drop snapshot root %p, commit_root blocknr %Lu generation %Lu\n", dirty->root, dirty->commit_root->b_blocknr, dirty->snap_key.offset); | ||
217 | ret = btrfs_drop_snapshot(trans, dirty->root, | 213 | ret = btrfs_drop_snapshot(trans, dirty->root, |
218 | dirty->commit_root); | 214 | dirty->commit_root); |
219 | BUG_ON(ret); | 215 | BUG_ON(ret); |
220 | 216 | ||
221 | printk("del root objectid %Lu, offset %Lu\n", dirty->snap_key.objectid, dirty->snap_key.offset); | ||
222 | ret = btrfs_del_root(trans, tree_root, &dirty->snap_key); | 217 | ret = btrfs_del_root(trans, tree_root, &dirty->snap_key); |
223 | BUG_ON(ret); | 218 | BUG_ON(ret); |
224 | ret = btrfs_end_transaction(trans, tree_root); | 219 | ret = btrfs_end_transaction(trans, tree_root); |
@@ -240,7 +235,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
240 | 235 | ||
241 | mutex_lock(&root->fs_info->trans_mutex); | 236 | mutex_lock(&root->fs_info->trans_mutex); |
242 | if (trans->transaction->in_commit) { | 237 | if (trans->transaction->in_commit) { |
243 | printk("already in commit!, waiting\n"); | ||
244 | cur_trans = trans->transaction; | 238 | cur_trans = trans->transaction; |
245 | trans->transaction->use_count++; | 239 | trans->transaction->use_count++; |
246 | btrfs_end_transaction(trans, root); | 240 | btrfs_end_transaction(trans, root); |