linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 2/6] btrfs: add barrier for waitqueue_active in clear_btree_io_tree
Date: Sun, 11 Oct 2015 19:50:23 +0200	[thread overview]
Message-ID: <b666a9cd993c6a49c4bf23a1ed476359c978f60b.1444579885.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1444579885.git.dsterba@suse.com>

waitqueue_active should be preceded by a barrier, in this function we
don't need to call it all the time.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/transaction.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 74bc3338418b..e8e5b5a10719 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -82,6 +82,12 @@ void btrfs_put_transaction(struct btrfs_transaction *transaction)
 static void clear_btree_io_tree(struct extent_io_tree *tree)
 {
 	spin_lock(&tree->lock);
+	/*
+	 * Do a single barrier for the waitqueue_active check here, the state
+	 * of the waitqueue should not change once clear_btree_io_tree is
+	 * called.
+	 */
+	smp_mb();
 	while (!RB_EMPTY_ROOT(&tree->state)) {
 		struct rb_node *node;
 		struct extent_state *state;
-- 
2.1.3


  parent reply	other threads:[~2015-10-11 17:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-11 17:50 [PULL][PATCH 0/6] Barriers around waitqueue_active (V2) David Sterba
2015-10-11 17:50 ` [PATCH 1/6] btrfs: remove waitqueue_active check from btrfs_rm_dev_replace_unblocked David Sterba
2015-10-11 17:50 ` David Sterba [this message]
2015-10-11 17:50 ` [PATCH 3/6] btrfs: comment waitqueue_active implied by locks David Sterba
2015-10-11 17:50 ` [PATCH 4/6] btrfs: add comments to barriers before waitqueue_active David Sterba
2015-10-11 17:50 ` [PATCH 5/6] btrfs: remove extra barrier " David Sterba
2015-10-11 17:50 ` [PATCH 6/6] btrfs: comment the rest of implicit barriers " David Sterba

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=b666a9cd993c6a49c4bf23a1ed476359c978f60b.1444579885.git.dsterba@suse.com \
    --to=dsterba@suse.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).