Commit 81e6f520898edbda56e8680d338ace4f5694874e

Authored by Al Viro
1 parent a32555466c

untangling do_lookup() - take __lookup_hash()-calling case out of line.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 16 additions and 15 deletions Side-by-side Diff

... ... @@ -1208,22 +1208,14 @@
1208 1208 dentry = __d_lookup(parent, name);
1209 1209 }
1210 1210  
1211   - if (dentry && unlikely(d_need_lookup(dentry))) {
  1211 + if (unlikely(!dentry))
  1212 + goto need_lookup;
  1213 +
  1214 + if (unlikely(d_need_lookup(dentry))) {
1212 1215 dput(dentry);
1213   - dentry = NULL;
  1216 + goto need_lookup;
1214 1217 }
1215   -retry:
1216   - if (unlikely(!dentry)) {
1217   - struct inode *dir = parent->d_inode;
1218   - BUG_ON(nd->inode != dir);
1219 1218  
1220   - mutex_lock(&dir->i_mutex);
1221   - dentry = __lookup_hash(name, parent, nd);
1222   - mutex_unlock(&dir->i_mutex);
1223   - if (IS_ERR(dentry))
1224   - return PTR_ERR(dentry);
1225   - goto done;
1226   - }
1227 1219 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
1228 1220 status = d_revalidate(dentry, nd);
1229 1221 if (unlikely(status <= 0)) {
... ... @@ -1233,8 +1225,7 @@
1233 1225 }
1234 1226 if (!d_invalidate(dentry)) {
1235 1227 dput(dentry);
1236   - dentry = NULL;
1237   - goto retry;
  1228 + goto need_lookup;
1238 1229 }
1239 1230 }
1240 1231 done:
... ... @@ -1249,6 +1240,16 @@
1249 1240 nd->flags |= LOOKUP_JUMPED;
1250 1241 *inode = path->dentry->d_inode;
1251 1242 return 0;
  1243 +
  1244 +need_lookup:
  1245 + BUG_ON(nd->inode != parent->d_inode);
  1246 +
  1247 + mutex_lock(&parent->d_inode->i_mutex);
  1248 + dentry = __lookup_hash(name, parent, nd);
  1249 + mutex_unlock(&parent->d_inode->i_mutex);
  1250 + if (IS_ERR(dentry))
  1251 + return PTR_ERR(dentry);
  1252 + goto done;
1252 1253 }
1253 1254  
1254 1255 static inline int may_lookup(struct nameidata *nd)