fold lookup_real() into __lookup_hash()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro
2018-03-08 11:00:45 -05:00
parent 903ddaf493
commit a03ece5ff2

View File

@@ -1473,21 +1473,29 @@ static struct dentry *lookup_dcache(const struct qstr *name,
} }
/* /*
* Call i_op->lookup on the dentry. The dentry must be negative and * Parent directory has inode locked exclusive. This is one
* unhashed. * and only case when ->lookup() gets called on non in-lookup
* * dentries - as the matter of fact, this only gets called
* dir->d_inode->i_mutex must be held * when directory is guaranteed to have no in-lookup children
* at all.
*/ */
static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry, static struct dentry *__lookup_hash(const struct qstr *name,
unsigned int flags) struct dentry *base, unsigned int flags)
{ {
struct dentry *dentry = lookup_dcache(name, base, flags);
struct dentry *old; struct dentry *old;
struct inode *dir = base->d_inode;
if (dentry)
return dentry;
/* Don't create child dentry for a dead directory. */ /* Don't create child dentry for a dead directory. */
if (unlikely(IS_DEADDIR(dir))) { if (unlikely(IS_DEADDIR(dir)))
dput(dentry);
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
}
dentry = d_alloc(base, name);
if (unlikely(!dentry))
return ERR_PTR(-ENOMEM);
old = dir->i_op->lookup(dir, dentry, flags); old = dir->i_op->lookup(dir, dentry, flags);
if (unlikely(old)) { if (unlikely(old)) {
@@ -1497,21 +1505,6 @@ static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry,
return dentry; return dentry;
} }
static struct dentry *__lookup_hash(const struct qstr *name,
struct dentry *base, unsigned int flags)
{
struct dentry *dentry = lookup_dcache(name, base, flags);
if (dentry)
return dentry;
dentry = d_alloc(base, name);
if (unlikely(!dentry))
return ERR_PTR(-ENOMEM);
return lookup_real(base->d_inode, dentry, flags);
}
static int lookup_fast(struct nameidata *nd, static int lookup_fast(struct nameidata *nd,
struct path *path, struct inode **inode, struct path *path, struct inode **inode,
unsigned *seqp) unsigned *seqp)