aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-09-11 11:15:39 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-09-11 11:15:39 -0400
commit5ce14bbcdd1b5d9233d26a1e89faf3a26c820c58 (patch)
tree6e2a2964e9b01c03dd1b4d58c976d76664747b64 /fs/btrfs/disk-io.c
parent0e2752a72cb37075b24899f01e9bc6a589de3b6c (diff)
Btrfs: Find and remove dead roots the first time a root is loaded.
Dead roots are trees left over after a crash, and they were either in the process of being removed or were waiting to be removed when the box crashed. Before, a search of the entire tree of root pointers was done on mount looking for dead roots. Now, the search is done the first time we load a root. This makes mount faster when there are a large number of snapshots, and it enables the block accounting code to properly update the block counts on the latest root as old versions of the root are reaped after a crash. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6c953a0e0aa3..4296839eea1a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -426,6 +426,10 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
426 return ERR_PTR(ret); 426 return ERR_PTR(ret);
427 } 427 }
428 428
429 ret = btrfs_find_dead_roots(fs_info->tree_root,
430 root->root_key.objectid, root);
431 BUG_ON(ret);
432
429 return root; 433 return root;
430} 434}
431 435
@@ -522,11 +526,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
522 btrfs_read_block_groups(extent_root); 526 btrfs_read_block_groups(extent_root);
523 527
524 fs_info->generation = btrfs_super_generation(disk_super) + 1; 528 fs_info->generation = btrfs_super_generation(disk_super) + 1;
525 ret = btrfs_find_dead_roots(tree_root);
526 if (ret) {
527 mutex_unlock(&fs_info->fs_mutex);
528 goto fail_tree_root;
529 }
530 mutex_unlock(&fs_info->fs_mutex); 529 mutex_unlock(&fs_info->fs_mutex);
531 return tree_root; 530 return tree_root;
532 531