Skip to content

Commit

Permalink
in do_lookup() split RCU and non-RCU cases of need_revalidate
Browse files Browse the repository at this point in the history
and use unlikely() instead of gotos, for fsck sake...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Feb 15, 2011
1 parent 844a391 commit 2464308
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,9 +1259,15 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
return -ECHILD;

nd->seq = seq;
if (dentry->d_flags & DCACHE_OP_REVALIDATE)
goto need_revalidate;
done2:
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
dentry = do_revalidate(dentry, nd);
if (!dentry)
goto need_lookup;
if (IS_ERR(dentry))
goto fail;
if (!(nd->flags & LOOKUP_RCU))
goto done;
}
path->mnt = mnt;
path->dentry = dentry;
if (likely(__follow_mount_rcu(nd, path, inode, false)))
Expand All @@ -1274,8 +1280,13 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
if (!dentry)
goto need_lookup;
found:
if (dentry->d_flags & DCACHE_OP_REVALIDATE)
goto need_revalidate;
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
dentry = do_revalidate(dentry, nd);
if (!dentry)
goto need_lookup;
if (IS_ERR(dentry))
goto fail;
}
done:
path->mnt = mnt;
path->dentry = dentry;
Expand Down Expand Up @@ -1317,16 +1328,6 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
mutex_unlock(&dir->i_mutex);
goto found;

need_revalidate:
dentry = do_revalidate(dentry, nd);
if (!dentry)
goto need_lookup;
if (IS_ERR(dentry))
goto fail;
if (nd->flags & LOOKUP_RCU)
goto done2;
goto done;

fail:
return PTR_ERR(dentry);
}
Expand Down

0 comments on commit 2464308

Please sign in to comment.