aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2015-09-24 16:17:39 -0400
committerChris Mason <clm@fb.com>2015-10-21 21:51:40 -0400
commit161c3549b45aeef05451b6822d8aaaf39c7bedce (patch)
treef14c534323f7b8d6bf181c9610df66313358360b /fs/btrfs/disk-io.c
parenta408365c62762c30419018587cffd2b89836434e (diff)
Btrfs: change how we wait for pending ordered extents
We have a mechanism to make sure we don't lose updates for ordered extents that were logged in the transaction that is currently running. We add the ordered extent to a transaction list and then the transaction waits on all the ordered extents in that list. However are substantially large file systems this list can be extremely large, and can give us soft lockups, since the ordered extents don't remove themselves from the list when they do complete. To fix this we simply add a counter to the transaction that is incremented any time we have a logged extent that needs to be completed in the current transaction. Then when the ordered extent finally completes it decrements the per transaction counter and wakes up the transaction if we are the last ones. This will eliminate the softlockup. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index bcbb596d9695..dceabb13ddc4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4326,25 +4326,6 @@ again:
4326 return 0; 4326 return 0;
4327} 4327}
4328 4328
4329static void btrfs_free_pending_ordered(struct btrfs_transaction *cur_trans,
4330 struct btrfs_fs_info *fs_info)
4331{
4332 struct btrfs_ordered_extent *ordered;
4333
4334 spin_lock(&fs_info->trans_lock);
4335 while (!list_empty(&cur_trans->pending_ordered)) {
4336 ordered = list_first_entry(&cur_trans->pending_ordered,
4337 struct btrfs_ordered_extent,
4338 trans_list);
4339 list_del_init(&ordered->trans_list);
4340 spin_unlock(&fs_info->trans_lock);
4341
4342 btrfs_put_ordered_extent(ordered);
4343 spin_lock(&fs_info->trans_lock);
4344 }
4345 spin_unlock(&fs_info->trans_lock);
4346}
4347
4348void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans, 4329void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
4349 struct btrfs_root *root) 4330 struct btrfs_root *root)
4350{ 4331{
@@ -4356,7 +4337,6 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
4356 cur_trans->state = TRANS_STATE_UNBLOCKED; 4337 cur_trans->state = TRANS_STATE_UNBLOCKED;
4357 wake_up(&root->fs_info->transaction_wait); 4338 wake_up(&root->fs_info->transaction_wait);
4358 4339
4359 btrfs_free_pending_ordered(cur_trans, root->fs_info);
4360 btrfs_destroy_delayed_inodes(root); 4340 btrfs_destroy_delayed_inodes(root);
4361 btrfs_assert_delayed_root_empty(root); 4341 btrfs_assert_delayed_root_empty(root);
4362 4342