aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2013-03-12 11:13:28 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:54:21 -0400
commit9d1a2a3ad59f7ae810bf04a5a05995bf2d79300c (patch)
tree1648c620a5264275004bd09c207292697b450367 /fs/btrfs/extent-tree.c
parent6841ebee6b02abe178abd30f40806e385cd96777 (diff)
btrfs: clean snapshots one by one
Each time pick one dead root from the list and let the caller know if it's needed to continue. This should improve responsiveness during umount and balance which at some point waits for cleaning all currently queued dead roots. A new dead root is added to the end of the list, so the snapshots disappear in the order of deletion. The snapshot cleaning work is now done only from the cleaner thread and the others wake it if needed. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7505856df9f3..be09157ff91b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7286,6 +7286,8 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
7286 * reference count by one. if update_ref is true, this function 7286 * reference count by one. if update_ref is true, this function
7287 * also make sure backrefs for the shared block and all lower level 7287 * also make sure backrefs for the shared block and all lower level
7288 * blocks are properly updated. 7288 * blocks are properly updated.
7289 *
7290 * If called with for_reloc == 0, may exit early with -EAGAIN
7289 */ 7291 */
7290int btrfs_drop_snapshot(struct btrfs_root *root, 7292int btrfs_drop_snapshot(struct btrfs_root *root,
7291 struct btrfs_block_rsv *block_rsv, int update_ref, 7293 struct btrfs_block_rsv *block_rsv, int update_ref,
@@ -7386,6 +7388,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7386 wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root); 7388 wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root);
7387 7389
7388 while (1) { 7390 while (1) {
7391 if (!for_reloc && btrfs_fs_closing(root->fs_info)) {
7392 pr_debug("btrfs: drop snapshot early exit\n");
7393 err = -EAGAIN;
7394 goto out_end_trans;
7395 }
7396
7389 ret = walk_down_tree(trans, root, path, wc); 7397 ret = walk_down_tree(trans, root, path, wc);
7390 if (ret < 0) { 7398 if (ret < 0) {
7391 err = ret; 7399 err = ret;