aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-10-25 05:31:03 -0400
committerJosef Bacik <jbacik@fusionio.com>2012-12-11 13:31:37 -0500
commit25287e0a16c0ad068aa89ab01aea6c699b31ec12 (patch)
tree3badf12a84d2e2e437fc4b432ea41c197a9cbc99 /fs/btrfs/transaction.c
parent8ccf6f19b67f7e0921063cc309f4672a6afcb528 (diff)
Btrfs: make ordered operations be handled by multi-task
The process of the ordered operations is similar to the delalloc inode flush, so we handle them by flush workers. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 9c466f9f817..259f74eabdb 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1412,15 +1412,21 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1412 struct btrfs_transaction *cur_trans = trans->transaction; 1412 struct btrfs_transaction *cur_trans = trans->transaction;
1413 struct btrfs_transaction *prev_trans = NULL; 1413 struct btrfs_transaction *prev_trans = NULL;
1414 DEFINE_WAIT(wait); 1414 DEFINE_WAIT(wait);
1415 int ret = -EIO; 1415 int ret;
1416 int should_grow = 0; 1416 int should_grow = 0;
1417 unsigned long now = get_seconds(); 1417 unsigned long now = get_seconds();
1418 int flush_on_commit = btrfs_test_opt(root, FLUSHONCOMMIT); 1418 int flush_on_commit = btrfs_test_opt(root, FLUSHONCOMMIT);
1419 1419
1420 btrfs_run_ordered_operations(root, 0); 1420 ret = btrfs_run_ordered_operations(root, 0);
1421 if (ret) {
1422 btrfs_abort_transaction(trans, root, ret);
1423 goto cleanup_transaction;
1424 }
1421 1425
1422 if (cur_trans->aborted) 1426 if (cur_trans->aborted) {
1427 ret = cur_trans->aborted;
1423 goto cleanup_transaction; 1428 goto cleanup_transaction;
1429 }
1424 1430
1425 /* make a pass through all the delayed refs we have so far 1431 /* make a pass through all the delayed refs we have so far
1426 * any runnings procs may add more while we are here 1432 * any runnings procs may add more while we are here
@@ -1523,7 +1529,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1523 * it here and no for sure that nothing new will be added 1529 * it here and no for sure that nothing new will be added
1524 * to the list 1530 * to the list
1525 */ 1531 */
1526 btrfs_run_ordered_operations(root, 1); 1532 ret = btrfs_run_ordered_operations(root, 1);
1533 if (ret) {
1534 btrfs_abort_transaction(trans, root, ret);
1535 goto cleanup_transaction;
1536 }
1527 1537
1528 prepare_to_wait(&cur_trans->writer_wait, &wait, 1538 prepare_to_wait(&cur_trans->writer_wait, &wait,
1529 TASK_UNINTERRUPTIBLE); 1539 TASK_UNINTERRUPTIBLE);