aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-10 12:13:09 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-10 12:13:09 -0400
commit1b05da2ee6217e7d55460d04335813fec25be4ca (patch)
tree250a3e789777c7a6d17dccf0bf5a57b00ef1bdac /fs/btrfs/disk-io.c
parentc5739bba5260a59cebd20a51a55080592c8d3b07 (diff)
Btrfs: drop the inode map tree
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6b097ede80b1..760fdc9a7664 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -264,6 +264,8 @@ static int __setup_root(int blocksize,
264 root->fs_info = fs_info; 264 root->fs_info = fs_info;
265 root->objectid = objectid; 265 root->objectid = objectid;
266 root->last_trans = 0; 266 root->last_trans = 0;
267 root->highest_inode = 0;
268 root->last_inode_alloc = 0;
267 memset(&root->root_key, 0, sizeof(root->root_key)); 269 memset(&root->root_key, 0, sizeof(root->root_key));
268 memset(&root->root_item, 0, sizeof(root->root_item)); 270 memset(&root->root_item, 0, sizeof(root->root_item));
269 return 0; 271 return 0;
@@ -295,6 +297,7 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
295 struct btrfs_root *tree_root = fs_info->tree_root; 297 struct btrfs_root *tree_root = fs_info->tree_root;
296 struct btrfs_path *path; 298 struct btrfs_path *path;
297 struct btrfs_leaf *l; 299 struct btrfs_leaf *l;
300 u64 highest_inode;
298 int ret = 0; 301 int ret = 0;
299 302
300printk("read_fs_root looking for %Lu %Lu %u\n", location->objectid, location->offset, location->flags); 303printk("read_fs_root looking for %Lu %Lu %u\n", location->objectid, location->offset, location->flags);
@@ -354,6 +357,12 @@ printk("radix_tree_insert gives us %d\n", ret);
354 kfree(root); 357 kfree(root);
355 return ERR_PTR(ret); 358 return ERR_PTR(ret);
356 } 359 }
360 ret = btrfs_find_highest_inode(root, &highest_inode);
361 if (ret == 0) {
362 root->highest_inode = highest_inode;
363 root->last_inode_alloc = highest_inode;
364printk("highest inode is %Lu\n", highest_inode);
365 }
357printk("all worked\n"); 366printk("all worked\n");
358 return root; 367 return root;
359} 368}
@@ -364,8 +373,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
364 GFP_NOFS); 373 GFP_NOFS);
365 struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root), 374 struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root),
366 GFP_NOFS); 375 GFP_NOFS);
367 struct btrfs_root *inode_root = kmalloc(sizeof(struct btrfs_root),
368 GFP_NOFS);
369 struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info), 376 struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info),
370 GFP_NOFS); 377 GFP_NOFS);
371 int ret; 378 int ret;
@@ -378,9 +385,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
378 fs_info->running_transaction = NULL; 385 fs_info->running_transaction = NULL;
379 fs_info->tree_root = tree_root; 386 fs_info->tree_root = tree_root;
380 fs_info->extent_root = extent_root; 387 fs_info->extent_root = extent_root;
381 fs_info->inode_root = inode_root;
382 fs_info->last_inode_alloc = 0;
383 fs_info->highest_inode = 0;
384 fs_info->sb = sb; 388 fs_info->sb = sb;
385 fs_info->btree_inode = new_inode(sb); 389 fs_info->btree_inode = new_inode(sb);
386 fs_info->btree_inode->i_ino = 1; 390 fs_info->btree_inode->i_ino = 1;
@@ -425,14 +429,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
425 BTRFS_EXTENT_TREE_OBJECTID, extent_root); 429 BTRFS_EXTENT_TREE_OBJECTID, extent_root);
426 BUG_ON(ret); 430 BUG_ON(ret);
427 431
428 ret = find_and_setup_root(sb->s_blocksize, tree_root, fs_info,
429 BTRFS_INODE_MAP_OBJECTID, inode_root);
430 BUG_ON(ret);
431
432 fs_info->generation = btrfs_super_generation(disk_super) + 1; 432 fs_info->generation = btrfs_super_generation(disk_super) + 1;
433 ret = btrfs_find_highest_inode(tree_root, &fs_info->last_inode_alloc);
434 if (ret == 0)
435 fs_info->highest_inode = fs_info->last_inode_alloc;
436 memset(&fs_info->kobj, 0, sizeof(fs_info->kobj)); 433 memset(&fs_info->kobj, 0, sizeof(fs_info->kobj));
437 kobj_set_kset_s(fs_info, btrfs_subsys); 434 kobj_set_kset_s(fs_info, btrfs_subsys);
438 kobject_set_name(&fs_info->kobj, "%s", sb->s_id); 435 kobject_set_name(&fs_info->kobj, "%s", sb->s_id);
@@ -512,9 +509,6 @@ int close_ctree(struct btrfs_root *root)
512 if (fs_info->extent_root->node) 509 if (fs_info->extent_root->node)
513 btrfs_block_release(fs_info->extent_root, 510 btrfs_block_release(fs_info->extent_root,
514 fs_info->extent_root->node); 511 fs_info->extent_root->node);
515 if (fs_info->inode_root->node)
516 btrfs_block_release(fs_info->inode_root,
517 fs_info->inode_root->node);
518 if (fs_info->tree_root->node) 512 if (fs_info->tree_root->node)
519 btrfs_block_release(fs_info->tree_root, 513 btrfs_block_release(fs_info->tree_root,
520 fs_info->tree_root->node); 514 fs_info->tree_root->node);
@@ -524,7 +518,6 @@ int close_ctree(struct btrfs_root *root)
524 iput(fs_info->btree_inode); 518 iput(fs_info->btree_inode);
525 del_fs_roots(fs_info); 519 del_fs_roots(fs_info);
526 kfree(fs_info->extent_root); 520 kfree(fs_info->extent_root);
527 kfree(fs_info->inode_root);
528 kfree(fs_info->tree_root); 521 kfree(fs_info->tree_root);
529 kobject_unregister(&fs_info->kobj); 522 kobject_unregister(&fs_info->kobj);
530 return 0; 523 return 0;