diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-02-28 09:27:02 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-02-28 09:27:02 -0500 |
commit | 8e19f2cd452853d1ca0895c2488c24d40de3d255 (patch) | |
tree | 978ed54a881c863d4b58b7a82dc4daf8050c793d /fs/btrfs/ctree.c | |
parent | d16302ab0ed26e236e9bde8cd54fd604d7d97297 (diff) |
Btrfs: Take out the merge-during-search-on-delete code, it is buggy.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 25dc7b2f7426..0aea94224ba3 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -167,29 +167,6 @@ int search_slot(struct ctree_root *root, struct key *key, | |||
167 | b = p->nodes[level]; | 167 | b = p->nodes[level]; |
168 | c = &b->node; | 168 | c = &b->node; |
169 | slot = p->slots[level]; | 169 | slot = p->slots[level]; |
170 | } else if (ins_len < 0 && | ||
171 | c->header.nritems <= NODEPTRS_PER_BLOCK/4) { | ||
172 | u64 blocknr = b->blocknr; | ||
173 | slot = p->slots[level +1]; | ||
174 | b->count++; | ||
175 | if (push_node_left(root, p, level)) | ||
176 | push_node_right(root, p, level); | ||
177 | if (c->header.nritems == 0 && | ||
178 | level < MAX_LEVEL - 1 && | ||
179 | p->nodes[level + 1]) { | ||
180 | int tslot = p->slots[level + 1]; | ||
181 | |||
182 | p->slots[level + 1] = slot; | ||
183 | del_ptr(root, p, level + 1); | ||
184 | p->slots[level + 1] = tslot; | ||
185 | tree_block_release(root, b); | ||
186 | free_extent(root, blocknr, 1); | ||
187 | } else { | ||
188 | tree_block_release(root, b); | ||
189 | } | ||
190 | b = p->nodes[level]; | ||
191 | c = &b->node; | ||
192 | slot = p->slots[level]; | ||
193 | } | 170 | } |
194 | b = read_tree_block(root, c->blockptrs[slot]); | 171 | b = read_tree_block(root, c->blockptrs[slot]); |
195 | continue; | 172 | continue; |
@@ -618,7 +595,6 @@ int push_leaf_right(struct ctree_root *root, struct ctree_path *path, | |||
618 | &right->items[0].key, sizeof(struct key)); | 595 | &right->items[0].key, sizeof(struct key)); |
619 | write_tree_block(root, upper); | 596 | write_tree_block(root, upper); |
620 | /* then fixup the leaf pointer in the path */ | 597 | /* then fixup the leaf pointer in the path */ |
621 | // FIXME use nritems in here somehow | ||
622 | if (path->slots[0] >= left->header.nritems) { | 598 | if (path->slots[0] >= left->header.nritems) { |
623 | path->slots[0] -= left->header.nritems; | 599 | path->slots[0] -= left->header.nritems; |
624 | tree_block_release(root, path->nodes[0]); | 600 | tree_block_release(root, path->nodes[0]); |
@@ -847,8 +823,6 @@ int insert_item(struct ctree_root *root, struct key *key, | |||
847 | 823 | ||
848 | slot = path.slots[0]; | 824 | slot = path.slots[0]; |
849 | BUG_ON(slot < 0); | 825 | BUG_ON(slot < 0); |
850 | if (slot == 0) | ||
851 | fixup_low_keys(root, &path, key, 1); | ||
852 | if (slot != nritems) { | 826 | if (slot != nritems) { |
853 | int i; | 827 | int i; |
854 | unsigned int old_data = leaf->items[slot].offset + | 828 | unsigned int old_data = leaf->items[slot].offset + |
@@ -877,6 +851,8 @@ int insert_item(struct ctree_root *root, struct key *key, | |||
877 | memcpy(leaf->data + data_end - data_size, data, data_size); | 851 | memcpy(leaf->data + data_end - data_size, data, data_size); |
878 | leaf->header.nritems += 1; | 852 | leaf->header.nritems += 1; |
879 | write_tree_block(root, leaf_buf); | 853 | write_tree_block(root, leaf_buf); |
854 | if (slot == 0) | ||
855 | fixup_low_keys(root, &path, key, 1); | ||
880 | if (leaf_free_space(leaf) < 0) | 856 | if (leaf_free_space(leaf) < 0) |
881 | BUG(); | 857 | BUG(); |
882 | release_path(root, &path); | 858 | release_path(root, &path); |
@@ -914,13 +890,23 @@ int del_ptr(struct ctree_root *root, struct ctree_path *path, int level) | |||
914 | sizeof(u64) * (nritems - slot - 1)); | 890 | sizeof(u64) * (nritems - slot - 1)); |
915 | } | 891 | } |
916 | node->header.nritems--; | 892 | node->header.nritems--; |
917 | write_tree_block(root, t); | ||
918 | blocknr = t->blocknr; | 893 | blocknr = t->blocknr; |
894 | write_tree_block(root, t); | ||
919 | if (node->header.nritems != 0) { | 895 | if (node->header.nritems != 0) { |
896 | int tslot; | ||
920 | if (slot == 0) | 897 | if (slot == 0) |
921 | fixup_low_keys(root, path, node->keys, | 898 | fixup_low_keys(root, path, node->keys, |
922 | level + 1); | 899 | level + 1); |
923 | break; | 900 | tslot = path->slots[level + 1]; |
901 | t->count++; | ||
902 | if (push_node_left(root, path, level)) | ||
903 | push_node_right(root, path, level); | ||
904 | path->slots[level + 1] = tslot; | ||
905 | if (node->header.nritems != 0) { | ||
906 | tree_block_release(root, t); | ||
907 | break; | ||
908 | } | ||
909 | tree_block_release(root, t); | ||
924 | } | 910 | } |
925 | if (t == root->node) { | 911 | if (t == root->node) { |
926 | /* just turn the root into a leaf and break */ | 912 | /* just turn the root into a leaf and break */ |