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 3/6] btrfs: update barrier in should_cow_block
Date: Tue, 27 Mar 2018 20:48:27 +0200	[thread overview]
Message-ID: <fd48cd0164b296422da688c00ff3b8c0942b0289.1522176187.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1522176187.git.dsterba@suse.com>

Once there was a simple int force_cow that was used with the plain
barriers, and then converted to a bit, so we should use the appropriate
barrier helper.

Other variables in the complex if condition do not depend on a barrier,
so we should be fine in case the atomic barrier becomes a no-op.

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

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index b88a79e69ddf..4c75df2eea2e 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1502,8 +1502,8 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans,
 	if (btrfs_is_testing(root->fs_info))
 		return 0;
 
-	/* ensure we can see the force_cow */
-	smp_rmb();
+	/* Ensure we can see the FORCE_COW bit */
+	smp_mb__before_atomic();
 
 	/*
 	 * We do not need to cow a block if
-- 
2.16.2


  parent reply	other threads:[~2018-03-27 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 18:48 [PATCH 0/6] Btrfs lockdep and locking cleanups David Sterba
2018-03-27 18:48 ` [PATCH 1/6] btrfs: use lockdep_assert_held for spinlocks David Sterba
2018-03-27 18:48 ` [PATCH 2/6] btrfs: use lockdep_assert_held for mutexes David Sterba
2018-03-27 18:48 ` David Sterba [this message]
2018-03-27 18:48 ` [PATCH 4/6] btrfs: use RCU in btrfs_show_devname for device list traversal David Sterba
2018-03-27 20:09   ` Anand Jain
2018-03-27 18:48 ` [PATCH 5/6] btrfs: remove stale comments about fs_mutex David Sterba
2018-03-27 18:48 ` [PATCH 6/6] btrfs: split dev-replace locking helpers for read and write 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=fd48cd0164b296422da688c00ff3b8c0942b0289.1522176187.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).