diff options
| -rw-r--r-- | fs/btrfs/extent-tree.c | 5 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 10 | ||||
| -rw-r--r-- | fs/btrfs/transaction.h | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2fe21fa74913..dc84daee6bc4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -302,10 +302,11 @@ again: | |||
| 302 | else if (ret) | 302 | else if (ret) |
| 303 | break; | 303 | break; |
| 304 | 304 | ||
| 305 | if (need_resched()) { | 305 | if (need_resched() || |
| 306 | btrfs_transaction_in_commit(fs_info)) { | ||
| 306 | btrfs_release_path(fs_info->extent_root, path); | 307 | btrfs_release_path(fs_info->extent_root, path); |
| 307 | up_read(&fs_info->extent_commit_sem); | 308 | up_read(&fs_info->extent_commit_sem); |
| 308 | cond_resched(); | 309 | schedule_timeout(1); |
| 309 | goto again; | 310 | goto again; |
| 310 | } | 311 | } |
| 311 | 312 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index de48e4ec808c..cdbb5022da52 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -857,6 +857,16 @@ static void update_super_roots(struct btrfs_root *root) | |||
| 857 | super->root_level = root_item->level; | 857 | super->root_level = root_item->level; |
| 858 | } | 858 | } |
| 859 | 859 | ||
| 860 | int btrfs_transaction_in_commit(struct btrfs_fs_info *info) | ||
| 861 | { | ||
| 862 | int ret = 0; | ||
| 863 | spin_lock(&info->new_trans_lock); | ||
| 864 | if (info->running_transaction) | ||
| 865 | ret = info->running_transaction->in_commit; | ||
| 866 | spin_unlock(&info->new_trans_lock); | ||
| 867 | return ret; | ||
| 868 | } | ||
| 869 | |||
| 860 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | 870 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
| 861 | struct btrfs_root *root) | 871 | struct btrfs_root *root) |
| 862 | { | 872 | { |
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 961c3ee5a2e1..663c67404918 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
| @@ -107,4 +107,5 @@ int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans, | |||
| 107 | struct btrfs_root *root); | 107 | struct btrfs_root *root); |
| 108 | int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, | 108 | int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, |
| 109 | struct extent_io_tree *dirty_pages); | 109 | struct extent_io_tree *dirty_pages); |
| 110 | int btrfs_transaction_in_commit(struct btrfs_fs_info *info); | ||
| 110 | #endif | 111 | #endif |
