aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-21 11:50:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-21 11:50:57 -0400
commit31ed8e6f93a27304c9e157dab0267772cd94eaad (patch)
tree2fd62bea73efa7e2920b0c3e1d81c425eb7bf71c /fs/namei.c
parent7e5cb5e151c5474b4a468f437f5038ba9f67ef4d (diff)
parent26fe575028703948880fce4355a210c76bb0536e (diff)
Merge branch 'dentry-cleanups' (dcache access cleanups and optimizations)
This branch simplifies and clarifies the dcache lookup, and allows us to do certain nice optimizations when comparing dentries. It also cleans up the interface to __d_lookup_rcu(), especially around passing the inode information around. * dentry-cleanups: vfs: make it possible to access the dentry hash/len as one 64-bit entry vfs: move dentry name length comparison from dentry_cmp() into callers vfs: do the careful dentry name access for all dentry_cmp cases vfs: remove unnecessary d_unhashed() check from __d_lookup_rcu vfs: clean up __d_lookup_rcu() and dentry_cmp() interfaces
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 709fb2c17b5f..f9e883c1b856 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1144,12 +1144,25 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
1144 */ 1144 */
1145 if (nd->flags & LOOKUP_RCU) { 1145 if (nd->flags & LOOKUP_RCU) {
1146 unsigned seq; 1146 unsigned seq;
1147 *inode = nd->inode; 1147 dentry = __d_lookup_rcu(parent, name, &seq, nd->inode);
1148 dentry = __d_lookup_rcu(parent, name, &seq, inode);
1149 if (!dentry) 1148 if (!dentry)
1150 goto unlazy; 1149 goto unlazy;
1151 1150
1152 /* Memory barrier in read_seqcount_begin of child is enough */ 1151 /*
1152 * This sequence count validates that the inode matches
1153 * the dentry name information from lookup.
1154 */
1155 *inode = dentry->d_inode;
1156 if (read_seqcount_retry(&dentry->d_seq, seq))
1157 return -ECHILD;
1158
1159 /*
1160 * This sequence count validates that the parent had no
1161 * changes while we did the lookup of the dentry above.
1162 *
1163 * The memory barrier in read_seqcount_begin of child is
1164 * enough, we can use __read_seqcount_retry here.
1165 */
1153 if (__read_seqcount_retry(&parent->d_seq, nd->seq)) 1166 if (__read_seqcount_retry(&parent->d_seq, nd->seq))
1154 return -ECHILD; 1167 return -ECHILD;
1155 nd->seq = seq; 1168 nd->seq = seq;