diff options
author | Chris Mason <chris.mason@oracle.com> | 2010-05-25 10:12:41 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-05-25 10:34:58 -0400 |
commit | ed3b3d314cd2f16fac42676839854a68cab2e22b (patch) | |
tree | a38462cdfbaa0dce3bbd26fe7167fe7368439a47 /fs/btrfs | |
parent | 11c65dccf70be9ace5dbd3906778e1a099b1fee1 (diff) |
Btrfs: don't walk around with task->state != TASK_RUNNING
Yan Zheng noticed two places we were doing a lot of work
without task->state set to TASK_RUNNING. This sets the state
properly after we get ready to sleep but decide not to.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/async-thread.c | 1 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 462859a30141..7ec14097fef1 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -377,6 +377,7 @@ again: | |||
377 | if (!list_empty(&worker->pending) || | 377 | if (!list_empty(&worker->pending) || |
378 | !list_empty(&worker->prio_pending)) { | 378 | !list_empty(&worker->prio_pending)) { |
379 | spin_unlock_irq(&worker->lock); | 379 | spin_unlock_irq(&worker->lock); |
380 | set_current_state(TASK_RUNNING); | ||
380 | goto again; | 381 | goto again; |
381 | } | 382 | } |
382 | 383 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index c346d320173a..66e4c66cc63b 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1063,9 +1063,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1063 | snap_pending = 1; | 1063 | snap_pending = 1; |
1064 | 1064 | ||
1065 | WARN_ON(cur_trans != trans->transaction); | 1065 | WARN_ON(cur_trans != trans->transaction); |
1066 | prepare_to_wait(&cur_trans->writer_wait, &wait, | ||
1067 | TASK_UNINTERRUPTIBLE); | ||
1068 | |||
1069 | if (cur_trans->num_writers > 1) | 1066 | if (cur_trans->num_writers > 1) |
1070 | timeout = MAX_SCHEDULE_TIMEOUT; | 1067 | timeout = MAX_SCHEDULE_TIMEOUT; |
1071 | else if (should_grow) | 1068 | else if (should_grow) |
@@ -1088,6 +1085,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1088 | */ | 1085 | */ |
1089 | btrfs_run_ordered_operations(root, 1); | 1086 | btrfs_run_ordered_operations(root, 1); |
1090 | 1087 | ||
1088 | prepare_to_wait(&cur_trans->writer_wait, &wait, | ||
1089 | TASK_UNINTERRUPTIBLE); | ||
1090 | |||
1091 | smp_mb(); | 1091 | smp_mb(); |
1092 | if (cur_trans->num_writers > 1 || should_grow) | 1092 | if (cur_trans->num_writers > 1 || should_grow) |
1093 | schedule_timeout(timeout); | 1093 | schedule_timeout(timeout); |