* [PATCH] dcache.c: Replace smp_read_barrier_depends() with lockless_dereference()
@ 2016-03-26 9:12 He Kuang
0 siblings, 0 replies; only message in thread
From: He Kuang @ 2016-03-26 9:12 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel, wangnan0, hekuang
lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends(). The following PATCH makes the
change.
Signed-off-by: He Kuang <hekuang@huawei.com>
---
fs/dcache.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 32ceae3..593264c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -215,10 +215,9 @@ static inline int dentry_string_cmp(const unsigned char *cs, const unsigned char
static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount)
{
- const unsigned char *cs;
/*
* Be careful about RCU walk racing with rename:
- * use ACCESS_ONCE to fetch the name pointer.
+ * use 'lockless_dereference' to fetch the name pointer.
*
* NOTE! Even if a rename will mean that the length
* was not loaded atomically, we don't care. The
@@ -232,8 +231,8 @@ static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *c
* early because the data cannot match (there can
* be no NUL in the ct/tcount data)
*/
- cs = ACCESS_ONCE(dentry->d_name.name);
- smp_read_barrier_depends();
+ const unsigned char *cs = lockless_dereference(dentry->d_name.name);
+
return dentry_string_cmp(cs, ct, tcount);
}
--
1.8.5.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-26 9:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-26 9:12 [PATCH] dcache.c: Replace smp_read_barrier_depends() with lockless_dereference() He Kuang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®