aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/random-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/random-test.c')
-rw-r--r--fs/btrfs/random-test.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/random-test.c b/fs/btrfs/random-test.c
index a8ef0478991b..f05135f13f9a 100644
--- a/fs/btrfs/random-test.c
+++ b/fs/btrfs/random-test.c
@@ -18,6 +18,7 @@ static int setup_key(struct radix_tree_root *root, struct btrfs_key *key,
18 int ret; 18 int ret;
19 19
20 key->flags = 0; 20 key->flags = 0;
21 btrfs_set_key_type(key, BTRFS_STRING_ITEM_KEY);
21 key->offset = 0; 22 key->offset = 0;
22again: 23again:
23 ret = radix_tree_gang_lookup(root, (void **)res, num, 2); 24 ret = radix_tree_gang_lookup(root, (void **)res, num, 2);
@@ -157,6 +158,7 @@ static int empty_tree(struct btrfs_root *root, struct radix_tree_root *radix,
157 158
158 key.offset = 0; 159 key.offset = 0;
159 key.flags = 0; 160 key.flags = 0;
161 btrfs_set_key_type(&key, BTRFS_STRING_ITEM_KEY);
160 key.objectid = (unsigned long)-1; 162 key.objectid = (unsigned long)-1;
161 while(nr-- >= 0) { 163 while(nr-- >= 0) {
162 btrfs_init_path(&path); 164 btrfs_init_path(&path);
@@ -173,7 +175,8 @@ static int empty_tree(struct btrfs_root *root, struct radix_tree_root *radix,
173 path.slots[0] -= 1; 175 path.slots[0] -= 1;
174 } 176 }
175 slot = path.slots[0]; 177 slot = path.slots[0];
176 found=btrfs_key_objectid(&path.nodes[0]->leaf.items[slot].key); 178 found = btrfs_disk_key_objectid(
179 &path.nodes[0]->leaf.items[slot].key);
177 ret = btrfs_del_item(root, &path); 180 ret = btrfs_del_item(root, &path);
178 count++; 181 count++;
179 if (ret) { 182 if (ret) {
@@ -257,6 +260,7 @@ static int fill_radix(struct btrfs_root *root, struct radix_tree_root *radix)
257 260
258 key.offset = 0; 261 key.offset = 0;
259 key.flags = 0; 262 key.flags = 0;
263 btrfs_set_key_type(&key, BTRFS_STRING_ITEM_KEY);
260 key.objectid = (unsigned long)-1; 264 key.objectid = (unsigned long)-1;
261 while(1) { 265 while(1) {
262 btrfs_init_path(&path); 266 btrfs_init_path(&path);
@@ -274,8 +278,8 @@ static int fill_radix(struct btrfs_root *root, struct radix_tree_root *radix)
274 slot -= 1; 278 slot -= 1;
275 } 279 }
276 for (i = slot; i >= 0; i--) { 280 for (i = slot; i >= 0; i--) {
277 found = btrfs_key_objectid(&path.nodes[0]-> 281 found = btrfs_disk_key_objectid(&path.nodes[0]->
278 leaf.items[i].key); 282 leaf.items[i].key);
279 radix_tree_preload(GFP_KERNEL); 283 radix_tree_preload(GFP_KERNEL);
280 ret = radix_tree_insert(radix, found, (void *)found); 284 ret = radix_tree_insert(radix, found, (void *)found);
281 if (ret) { 285 if (ret) {