From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.com, mathieu.desnoyers@efficios.com,
Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 2/3] btrfs: Remove redundant memory barrier
Date: Fri, 20 Oct 2017 18:10:58 +0300 [thread overview]
Message-ID: <1508512259-16867-2-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1508512259-16867-1-git-send-email-nborisov@suse.com>
As per atomic_t.txt documentation :
- RMW operations that have a return value are fully ordered;
atomic_xchg is one such operation so it already includes everything it needs
w.r.t memory ordering and add a comment ot be more explicit about that.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/volumes.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index c5dd48eb7b3d..0b8ddcbf8462 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -520,7 +520,13 @@ static inline int btrfs_dev_stat_read_and_reset(struct btrfs_device *dev,
int ret;
ret = atomic_xchg(dev->dev_stat_values + index, 0);
- smp_mb__before_atomic();
+ /*
+ * atomic_xchg implies a full memory barriers as per atomic_t.txt:
+ * - RMW operations that have a return value are fully ordered;
+ *
+ * This implicit memory barriers is paired with the smp_rmb in
+ * btrfs_run_dev_stats
+ */
atomic_inc(&dev->dev_stats_ccnt);
return ret;
}
--
2.7.4
next prev parent reply other threads:[~2017-10-20 15:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 15:10 [PATCH 1/3] btrfs: Fix memory barriers usage with device stats counters Nikolay Borisov
2017-10-20 15:10 ` Nikolay Borisov [this message]
2017-10-30 12:55 ` [PATCH 2/3] btrfs: Remove redundant memory barrier David Sterba
2017-10-20 15:10 ` [PATCH 3/3] btrfs: Remove unused function Nikolay Borisov
2017-10-20 15:26 ` [PATCH 1/3] btrfs: Fix memory barriers usage with device stats counters Mathieu Desnoyers
2017-10-24 10:47 ` [PATCH v2] " Nikolay Borisov
2017-10-24 13:24 ` Mathieu Desnoyers
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=1508512259-16867-2-git-send-email-nborisov@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
/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).