Btrfs: Find and remove dead roots the first time a root is loaded.
[linux-2.6-block.git] / fs / btrfs / transaction.c
index 2b15daa3a9f21f973c59e29eda7b5079b4173fd4..29755593de651c5dcac657996ee6b69fa703c1ed 100644 (file)
@@ -239,7 +239,9 @@ struct dirty_root {
        struct btrfs_root *latest_root;
 };
 
-int btrfs_add_dead_root(struct btrfs_root *root, struct list_head *dead_list)
+int btrfs_add_dead_root(struct btrfs_root *root,
+                       struct btrfs_root *latest,
+                       struct list_head *dead_list)
 {
        struct dirty_root *dirty;
 
@@ -247,6 +249,7 @@ int btrfs_add_dead_root(struct btrfs_root *root, struct list_head *dead_list)
        if (!dirty)
                return -ENOMEM;
        dirty->root = root;
+       dirty->latest_root = latest;
        list_add(&dirty->list, dead_list);
        return 0;
 }
@@ -412,7 +415,6 @@ static int drop_dirty_roots(struct btrfs_root *tree_root,
 
                while(1) {
                        trans = btrfs_start_transaction(tree_root, 1);
-
                        ret = btrfs_drop_snapshot(trans, dirty->root);
                        if (ret != -EAGAIN) {
                                break;