aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-05-15 03:48:29 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-06-14 11:29:48 -0400
commit3f1e3fa65c44b8ecdf2d6f14956c2cfe3a462a03 (patch)
tree63d404df29d4fc1d0d9c215736484e6cf1f6bcb5 /fs/btrfs/transaction.c
parent824366177aa108eb7b778dc67e4f38b9e01df93f (diff)
Btrfs: remove unnecessary varient ->num_joined in btrfs_transaction structure
We used ->num_joined track if there were some writers which join the current transaction when the committer was sleeping. If some writers joined the current transaction, we has to continue the while loop to do some necessary stuff, such as flush the ordered operations. But it is unnecessary because we will do it after the while loop. Besides that, tracking ->num_joined would make the committer drop into the while loop when there are lots of internal writers(TRANS_JOIN). So we remove ->num_joined and don't track if there are some writers which join the current transaction when the committer is sleeping. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 265db57b3341..75e7b150eb54 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -124,7 +124,6 @@ loop:
124 atomic_inc(&cur_trans->use_count); 124 atomic_inc(&cur_trans->use_count);
125 atomic_inc(&cur_trans->num_writers); 125 atomic_inc(&cur_trans->num_writers);
126 extwriter_counter_inc(cur_trans, type); 126 extwriter_counter_inc(cur_trans, type);
127 cur_trans->num_joined++;
128 spin_unlock(&fs_info->trans_lock); 127 spin_unlock(&fs_info->trans_lock);
129 return 0; 128 return 0;
130 } 129 }
@@ -157,7 +156,6 @@ loop:
157 156
158 atomic_set(&cur_trans->num_writers, 1); 157 atomic_set(&cur_trans->num_writers, 1);
159 extwriter_counter_init(cur_trans, type); 158 extwriter_counter_init(cur_trans, type);
160 cur_trans->num_joined = 0;
161 init_waitqueue_head(&cur_trans->writer_wait); 159 init_waitqueue_head(&cur_trans->writer_wait);
162 init_waitqueue_head(&cur_trans->commit_wait); 160 init_waitqueue_head(&cur_trans->commit_wait);
163 cur_trans->in_commit = 0; 161 cur_trans->in_commit = 0;
@@ -1566,7 +1564,6 @@ static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info)
1566int btrfs_commit_transaction(struct btrfs_trans_handle *trans, 1564int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1567 struct btrfs_root *root) 1565 struct btrfs_root *root)
1568{ 1566{
1569 unsigned long joined = 0;
1570 struct btrfs_transaction *cur_trans = trans->transaction; 1567 struct btrfs_transaction *cur_trans = trans->transaction;
1571 struct btrfs_transaction *prev_trans = NULL; 1568 struct btrfs_transaction *prev_trans = NULL;
1572 DEFINE_WAIT(wait); 1569 DEFINE_WAIT(wait);
@@ -1668,8 +1665,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1668 should_grow = 1; 1665 should_grow = 1;
1669 1666
1670 do { 1667 do {
1671 joined = cur_trans->num_joined;
1672
1673 WARN_ON(cur_trans != trans->transaction); 1668 WARN_ON(cur_trans != trans->transaction);
1674 1669
1675 ret = btrfs_flush_all_pending_stuffs(trans, root); 1670 ret = btrfs_flush_all_pending_stuffs(trans, root);
@@ -1685,8 +1680,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1685 schedule_timeout(1); 1680 schedule_timeout(1);
1686 1681
1687 finish_wait(&cur_trans->writer_wait, &wait); 1682 finish_wait(&cur_trans->writer_wait, &wait);
1688 } while (extwriter_counter_read(cur_trans) > 0 || 1683 } while (extwriter_counter_read(cur_trans) > 0);
1689 (should_grow && cur_trans->num_joined != joined));
1690 1684
1691 ret = btrfs_flush_all_pending_stuffs(trans, root); 1685 ret = btrfs_flush_all_pending_stuffs(trans, root);
1692 if (ret) 1686 if (ret)