From: Miao Xie <miaox@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Cc: alex.btrfs@zadarastorage.com
Subject: [PATCH 15/17] Btrfs: remove unnecessary varient ->num_joined in btrfs_transaction structure
Date: Wed, 15 May 2013 15:48:29 +0800 [thread overview]
Message-ID: <1368604111-25073-16-git-send-email-miaox@cn.fujitsu.com> (raw)
In-Reply-To: <1368604111-25073-1-git-send-email-miaox@cn.fujitsu.com>
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>
---
fs/btrfs/transaction.c | 8 +-------
fs/btrfs/transaction.h | 2 --
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 265db57..75e7b15 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -124,7 +124,6 @@ loop:
atomic_inc(&cur_trans->use_count);
atomic_inc(&cur_trans->num_writers);
extwriter_counter_inc(cur_trans, type);
- cur_trans->num_joined++;
spin_unlock(&fs_info->trans_lock);
return 0;
}
@@ -157,7 +156,6 @@ loop:
atomic_set(&cur_trans->num_writers, 1);
extwriter_counter_init(cur_trans, type);
- cur_trans->num_joined = 0;
init_waitqueue_head(&cur_trans->writer_wait);
init_waitqueue_head(&cur_trans->commit_wait);
cur_trans->in_commit = 0;
@@ -1566,7 +1564,6 @@ static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info)
int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
struct btrfs_root *root)
{
- unsigned long joined = 0;
struct btrfs_transaction *cur_trans = trans->transaction;
struct btrfs_transaction *prev_trans = NULL;
DEFINE_WAIT(wait);
@@ -1668,8 +1665,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
should_grow = 1;
do {
- joined = cur_trans->num_joined;
-
WARN_ON(cur_trans != trans->transaction);
ret = btrfs_flush_all_pending_stuffs(trans, root);
@@ -1685,8 +1680,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
schedule_timeout(1);
finish_wait(&cur_trans->writer_wait, &wait);
- } while (extwriter_counter_read(cur_trans) > 0 ||
- (should_grow && cur_trans->num_joined != joined));
+ } while (extwriter_counter_read(cur_trans) > 0);
ret = btrfs_flush_all_pending_stuffs(trans, root);
if (ret)
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 5cc77b0..0fc45e2 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -37,8 +37,6 @@ struct btrfs_transaction {
atomic_t num_writers;
atomic_t use_count;
- unsigned long num_joined;
-
spinlock_t commit_lock;
int in_commit;
int commit_done;
--
1.8.1.4
next prev parent reply other threads:[~2013-05-15 7:48 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 7:48 [PATCH 00/17] improve the block time during the transaction commit Miao Xie
2013-05-15 7:48 ` [PATCH 01/17] Btrfs: fix accessing a freed tree root Miao Xie
2013-05-15 7:48 ` [PATCH 02/17] Btrfs: fix unprotected root node of the subvolume's inode rb-tree Miao Xie
2013-05-15 7:48 ` [PATCH 03/17] Btrfs: pause the space balance when remounting to R/O Miao Xie
2013-05-15 7:48 ` [PATCH 04/17] Btrfs: remove BUG_ON() in btrfs_read_fs_tree_no_radix() Miao Xie
2013-05-15 7:48 ` [PATCH 05/17] Btrfs: cleanup the similar code of the fs root read Miao Xie
2013-05-15 7:48 ` [PATCH 06/17] Btrfs: introduce grab/put functions for the root of the fs/file tree Miao Xie
2013-05-16 3:36 ` Liu Bo
2013-05-16 4:31 ` Miao Xie
2013-05-16 5:15 ` Liu Bo
2013-05-16 5:34 ` Miao Xie
2013-05-16 6:15 ` Liu Bo
2013-05-16 7:22 ` Miao Xie
2013-05-16 11:54 ` Chris Mason
2013-05-16 14:31 ` Liu Bo
2013-05-16 14:34 ` Chris Mason
2013-05-16 14:57 ` Liu Bo
2013-05-17 1:50 ` Miao Xie
2013-05-16 12:05 ` Liu Bo
2013-05-15 7:48 ` [PATCH 07/17] Btrfs: don't invoke btrfs_invalidate_inodes() in the spin lock context Miao Xie
2013-05-15 7:48 ` [PATCH 08/17] Btrfs: introduce per-subvolume delalloc inode list Miao Xie
2013-05-15 7:48 ` [PATCH 09/17] Btrfs: introduce per-subvolume ordered extent list Miao Xie
2013-05-15 7:48 ` [PATCH 10/17] Btrfs: just flush the delalloc inodes in the source tree before snapshot creation Miao Xie
2013-05-16 3:20 ` Liu Bo
2013-05-16 4:00 ` Miao Xie
2013-05-15 7:48 ` [PATCH 11/17] Btrfs: cleanup unnecessary assignment when cleaning up all the residual transaction Miao Xie
2013-05-15 7:48 ` [PATCH 12/17] Btrfs: remove the code for the impossible case in cleanup_transaction() Miao Xie
2013-05-15 7:48 ` [PATCH 13/17] Btrfs: don't wait for all the writers circularly during the transaction commit Miao Xie
2013-05-15 7:48 ` [PATCH 14/17] Btrfs: don't flush the delalloc inodes in the while loop if flushoncommit is set Miao Xie
2013-05-15 7:48 ` Miao Xie [this message]
2013-05-15 7:48 ` [PATCH 16/17] Btrfs: remove the time check in btrfs_commit_transaction() Miao Xie
2013-05-15 7:48 ` [PATCH 17/17] Btrfs: make the state of the transaction more readable Miao Xie
2013-05-17 3:53 ` [PATCH V2 " Miao Xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368604111-25073-16-git-send-email-miaox@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=alex.btrfs@zadarastorage.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).