aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-08-07 15:52:19 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-08-07 15:52:19 -0400
commit9f3a742736cecda5a8778be70faa2f779458839f (patch)
tree500ef3701521e63254dbe82e5c71e7ccff746275 /fs/btrfs/ctree.c
parent8578f0f1fda41f8429a1037022b720275102ca65 (diff)
Btrfs: Do snapshot deletion in smaller chunks.
Before, snapshot deletion was a single atomic unit. This caused considerable lock contention and required an unbounded amount of space. Now, the drop_progress field in the root item is used to indicate how far along snapshot deletion is, and to resume where it left off. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 19a30b7c3a28..aa824e2c521f 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -659,9 +659,16 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
659 struct buffer_head *b; 659 struct buffer_head *b;
660 struct buffer_head *cow_buf; 660 struct buffer_head *cow_buf;
661 struct btrfs_node *c; 661 struct btrfs_node *c;
662 struct btrfs_root_item *root_item = &root->root_item;
662 int slot; 663 int slot;
663 int ret; 664 int ret;
664 int level; 665 int level;
666 u8 lowest_level = 0;
667
668 if (btrfs_root_refs(root_item) == 0 && root->ref_cows) {
669 lowest_level = root_item->drop_level;
670 WARN_ON(ins_len || cow);
671 }
665 672
666 WARN_ON(p->nodes[0] != NULL); 673 WARN_ON(p->nodes[0] != NULL);
667 WARN_ON(!mutex_is_locked(&root->fs_info->fs_mutex)); 674 WARN_ON(!mutex_is_locked(&root->fs_info->fs_mutex));
@@ -718,6 +725,9 @@ again:
718 slot = p->slots[level]; 725 slot = p->slots[level];
719 BUG_ON(btrfs_header_nritems(&c->header) == 1); 726 BUG_ON(btrfs_header_nritems(&c->header) == 1);
720 } 727 }
728 /* this is only true while dropping a snapshot */
729 if (level == lowest_level)
730 break;
721 b = read_tree_block(root, btrfs_node_blockptr(c, slot)); 731 b = read_tree_block(root, btrfs_node_blockptr(c, slot));
722 } else { 732 } else {
723 struct btrfs_leaf *l = (struct btrfs_leaf *)c; 733 struct btrfs_leaf *l = (struct btrfs_leaf *)c;