aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 0236de711989..a429704dd95f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7552,11 +7552,6 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7552 wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root); 7552 wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root);
7553 7553
7554 while (1) { 7554 while (1) {
7555 if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
7556 pr_debug("btrfs: drop snapshot early exit\n");
7557 err = -EAGAIN;
7558 goto out_end_trans;
7559 }
7560 7555
7561 ret = walk_down_tree(trans, root, path, wc); 7556 ret = walk_down_tree(trans, root, path, wc);
7562 if (ret < 0) { 7557 if (ret < 0) {
@@ -7584,7 +7579,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7584 } 7579 }
7585 7580
7586 BUG_ON(wc->level == 0); 7581 BUG_ON(wc->level == 0);
7587 if (btrfs_should_end_transaction(trans, tree_root)) { 7582 if (btrfs_should_end_transaction(trans, tree_root) ||
7583 (!for_reloc && btrfs_need_cleaner_sleep(root))) {
7588 ret = btrfs_update_root(trans, tree_root, 7584 ret = btrfs_update_root(trans, tree_root,
7589 &root->root_key, 7585 &root->root_key,
7590 root_item); 7586 root_item);
@@ -7595,6 +7591,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7595 } 7591 }
7596 7592
7597 btrfs_end_transaction_throttle(trans, tree_root); 7593 btrfs_end_transaction_throttle(trans, tree_root);
7594 if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
7595 pr_debug("btrfs: drop snapshot early exit\n");
7596 err = -EAGAIN;
7597 goto out_free;
7598 }
7599
7598 trans = btrfs_start_transaction(tree_root, 0); 7600 trans = btrfs_start_transaction(tree_root, 0);
7599 if (IS_ERR(trans)) { 7601 if (IS_ERR(trans)) {
7600 err = PTR_ERR(trans); 7602 err = PTR_ERR(trans);