diff options
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 955204ca0447..a83d486cc70c 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -167,6 +167,9 @@ loop: | |||
167 | 167 | ||
168 | spin_lock_init(&cur_trans->commit_lock); | 168 | spin_lock_init(&cur_trans->commit_lock); |
169 | spin_lock_init(&cur_trans->delayed_refs.lock); | 169 | spin_lock_init(&cur_trans->delayed_refs.lock); |
170 | atomic_set(&cur_trans->delayed_refs.procs_running_refs, 0); | ||
171 | atomic_set(&cur_trans->delayed_refs.ref_seq, 0); | ||
172 | init_waitqueue_head(&cur_trans->delayed_refs.wait); | ||
170 | 173 | ||
171 | INIT_LIST_HEAD(&cur_trans->pending_snapshots); | 174 | INIT_LIST_HEAD(&cur_trans->pending_snapshots); |
172 | INIT_LIST_HEAD(&cur_trans->ordered_operations); | 175 | INIT_LIST_HEAD(&cur_trans->ordered_operations); |
@@ -637,7 +640,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
637 | if (!list_empty(&trans->new_bgs)) | 640 | if (!list_empty(&trans->new_bgs)) |
638 | btrfs_create_pending_block_groups(trans, root); | 641 | btrfs_create_pending_block_groups(trans, root); |
639 | 642 | ||
640 | while (count < 2) { | 643 | while (count < 1) { |
641 | unsigned long cur = trans->delayed_ref_updates; | 644 | unsigned long cur = trans->delayed_ref_updates; |
642 | trans->delayed_ref_updates = 0; | 645 | trans->delayed_ref_updates = 0; |
643 | if (cur && | 646 | if (cur && |
@@ -649,6 +652,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
649 | } | 652 | } |
650 | count++; | 653 | count++; |
651 | } | 654 | } |
655 | |||
652 | btrfs_trans_release_metadata(trans, root); | 656 | btrfs_trans_release_metadata(trans, root); |
653 | trans->block_rsv = NULL; | 657 | trans->block_rsv = NULL; |
654 | 658 | ||
@@ -744,7 +748,9 @@ int btrfs_write_marked_extents(struct btrfs_root *root, | |||
744 | struct extent_state *cached_state = NULL; | 748 | struct extent_state *cached_state = NULL; |
745 | u64 start = 0; | 749 | u64 start = 0; |
746 | u64 end; | 750 | u64 end; |
751 | struct blk_plug plug; | ||
747 | 752 | ||
753 | blk_start_plug(&plug); | ||
748 | while (!find_first_extent_bit(dirty_pages, start, &start, &end, | 754 | while (!find_first_extent_bit(dirty_pages, start, &start, &end, |
749 | mark, &cached_state)) { | 755 | mark, &cached_state)) { |
750 | convert_extent_bit(dirty_pages, start, end, EXTENT_NEED_WAIT, | 756 | convert_extent_bit(dirty_pages, start, end, EXTENT_NEED_WAIT, |
@@ -758,6 +764,7 @@ int btrfs_write_marked_extents(struct btrfs_root *root, | |||
758 | } | 764 | } |
759 | if (err) | 765 | if (err) |
760 | werr = err; | 766 | werr = err; |
767 | blk_finish_plug(&plug); | ||
761 | return werr; | 768 | return werr; |
762 | } | 769 | } |
763 | 770 | ||