aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 9d84daf1000..cf73342e821 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -210,7 +210,9 @@ static noinline int wait_for_commit(struct btrfs_root *root,
210static void throttle_on_drops(struct btrfs_root *root) 210static void throttle_on_drops(struct btrfs_root *root)
211{ 211{
212 struct btrfs_fs_info *info = root->fs_info; 212 struct btrfs_fs_info *info = root->fs_info;
213 int harder_count = 0;
213 214
215harder:
214 if (atomic_read(&info->throttles)) { 216 if (atomic_read(&info->throttles)) {
215 DEFINE_WAIT(wait); 217 DEFINE_WAIT(wait);
216 int thr; 218 int thr;
@@ -226,6 +228,19 @@ static void throttle_on_drops(struct btrfs_root *root)
226 schedule(); 228 schedule();
227 finish_wait(&info->transaction_throttle, &wait); 229 finish_wait(&info->transaction_throttle, &wait);
228 } while (thr == atomic_read(&info->throttle_gen)); 230 } while (thr == atomic_read(&info->throttle_gen));
231 harder_count++;
232
233 if (root->fs_info->total_ref_cache_size > 1 * 1024 * 1024 &&
234 harder_count < 2)
235 goto harder;
236
237 if (root->fs_info->total_ref_cache_size > 5 * 1024 * 1024 &&
238 harder_count < 10)
239 goto harder;
240
241 if (root->fs_info->total_ref_cache_size > 10 * 1024 * 1024 &&
242 harder_count < 20)
243 goto harder;
229 } 244 }
230} 245}
231 246