diff options
-rw-r--r-- | fs/btrfs/TODO | 25 | ||||
-rw-r--r-- | fs/btrfs/ctree.c | 42 |
2 files changed, 39 insertions, 28 deletions
diff --git a/fs/btrfs/TODO b/fs/btrfs/TODO new file mode 100644 index 000000000000..5c4395c3784a --- /dev/null +++ b/fs/btrfs/TODO | |||
@@ -0,0 +1,25 @@ | |||
1 | * cleanup, add more error checking, get rid of BUG_ONs | ||
2 | * Make IO functions look more like the page cache | ||
3 | * Fix ENOSPC handling | ||
4 | * make blocksize a mkfs parameter instead of #define | ||
5 | * make a real mkfs and superblock | ||
6 | * Add shadowing and transactions | ||
7 | * Do checksumming | ||
8 | * Define FS objects in terms of different item types | ||
9 | * Add block mapping tree (simple dm layer) | ||
10 | * Add simple tree locking (semaphore per tree) | ||
11 | * Make allocator smarter | ||
12 | * Port into the kernel | ||
13 | * Add virtual filesystems, mountable snapshots | ||
14 | * Get rid of struct ctree_path, limiting tree levels held at one time | ||
15 | * Release | ||
16 | * Do real tree locking | ||
17 | * Add extent mirroring (backup copies of blocks) | ||
18 | * Add fancy interface to get access to incremental backups | ||
19 | * Add fancy striped extents to make big reads faster | ||
20 | * Use relocation to try and fix write errors | ||
21 | * Make allocator much smarter | ||
22 | * xattrs (directory streams for regular files) | ||
23 | * fsck | ||
24 | * Scrub & defrag | ||
25 | |||
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 */ |