Skip to content

Commit 18e35e0

Browse files
committed
Btrfs: Throttle less often waiting for snapshots to delete
Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent f87f057 commit 18e35e0

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

‎fs/btrfs/extent-tree.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,10 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
25352535
root_gen, 0, 0, 1);
25362536
BUG_ON(ret);
25372537
mutex_unlock(&root->fs_info->alloc_mutex);
2538+
2539+
atomic_inc(&root->fs_info->throttle_gen);
2540+
wake_up(&root->fs_info->transaction_throttle);
2541+
25382542
continue;
25392543
}
25402544
/*
@@ -2603,7 +2607,6 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
26032607
root_owner = btrfs_header_owner(parent);
26042608
root_gen = btrfs_header_generation(parent);
26052609

2606-
26072610
mutex_lock(&root->fs_info->alloc_mutex);
26082611
ret = __btrfs_free_extent(trans, root, bytenr, blocksize,
26092612
root_owner, root_gen, 0, 0, 1);
@@ -2726,7 +2729,6 @@ int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
27262729
}
27272730
}
27282731
while(1) {
2729-
atomic_inc(&root->fs_info->throttle_gen);
27302732
wret = walk_down_tree(trans, root, path, &level);
27312733
if (wret > 0)
27322734
break;
@@ -2742,6 +2744,7 @@ int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
27422744
ret = -EAGAIN;
27432745
break;
27442746
}
2747+
atomic_inc(&root->fs_info->throttle_gen);
27452748
wake_up(&root->fs_info->transaction_throttle);
27462749
}
27472750
for (i = 0; i <= orig_level; i++) {

‎fs/btrfs/transaction.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,9 @@ static void throttle_on_drops(struct btrfs_root *root)
211211
{
212212
struct btrfs_fs_info *info = root->fs_info;
213213

214-
harder:
215214
if (atomic_read(&info->throttles)) {
216215
DEFINE_WAIT(wait);
217216
int thr;
218-
int harder_count = 0;
219217
thr = atomic_read(&info->throttle_gen);
220218

221219
do {
@@ -228,18 +226,6 @@ static void throttle_on_drops(struct btrfs_root *root)
228226
schedule();
229227
finish_wait(&info->transaction_throttle, &wait);
230228
} while (thr == atomic_read(&info->throttle_gen));
231-
232-
if (harder_count < 5 &&
233-
info->total_ref_cache_size > 1 * 1024 * 1024) {
234-
harder_count++;
235-
goto harder;
236-
}
237-
238-
if (harder_count < 10 &&
239-
info->total_ref_cache_size > 5 * 1024 * 1024) {
240-
harder_count++;
241-
goto harder;
242-
}
243229
}
244230
}
245231

0 commit comments

Comments
 (0)