Btrfs: Remove unnecessary finish_wait() in wait_current_trans()
authorZhao Lei <zhaolei@cn.fujitsu.com>
Thu, 25 Mar 2010 12:35:14 +0000 (12:35 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 31 Mar 2010 01:19:08 +0000 (21:19 -0400)
We only need to call finish_wait() after wait loop.

By the way, this patch makes code of waiting loop similar to
example in wait.h(no functional change)

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/transaction.c

index 2d654c1c794d2f7690409a53bfcbc02ae95890a9..43054285f6389ba70fc3f767f903e69552b1f723 100644 (file)
@@ -147,18 +147,13 @@ static void wait_current_trans(struct btrfs_root *root)
                while (1) {
                        prepare_to_wait(&root->fs_info->transaction_wait, &wait,
                                        TASK_UNINTERRUPTIBLE);
-                       if (cur_trans->blocked) {
-                               mutex_unlock(&root->fs_info->trans_mutex);
-                               schedule();
-                               mutex_lock(&root->fs_info->trans_mutex);
-                               finish_wait(&root->fs_info->transaction_wait,
-                                           &wait);
-                       } else {
-                               finish_wait(&root->fs_info->transaction_wait,
-                                           &wait);
+                       if (!cur_trans->blocked)
                                break;
-                       }
+                       mutex_unlock(&root->fs_info->trans_mutex);
+                       schedule();
+                       mutex_lock(&root->fs_info->trans_mutex);
                }
+               finish_wait(&root->fs_info->transaction_wait, &wait);
                put_transaction(cur_trans);
        }
 }