aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-03-08 11:00:45 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-03-29 15:07:47 -0400
commita03ece5ff2bd7a9abaa0e8ddfe5f79d79e5984c8 (patch)
tree44e770c2479e830e652fa8490133aae57bc31281
parent903ddaf49329076862d65f7284d825759ff67bd6 (diff)
fold lookup_real() into __lookup_hash()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 921ae32dbc80..a3cd028e8a9b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1473,43 +1473,36 @@ static struct dentry *lookup_dcache(const struct qstr *name,
1473} 1473}
1474 1474
1475/* 1475/*
1476 * Call i_op->lookup on the dentry. The dentry must be negative and 1476 * Parent directory has inode locked exclusive. This is one
1477 * unhashed. 1477 * and only case when ->lookup() gets called on non in-lookup
1478 * 1478 * dentries - as the matter of fact, this only gets called
1479 * dir->d_inode->i_mutex must be held 1479 * when directory is guaranteed to have no in-lookup children
1480 * at all.
1480 */ 1481 */
1481static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry,
1482 unsigned int flags)
1483{
1484 struct dentry *old;
1485
1486 /* Don't create child dentry for a dead directory. */
1487 if (unlikely(IS_DEADDIR(dir))) {
1488 dput(dentry);
1489 return ERR_PTR(-ENOENT);
1490 }
1491
1492 old = dir->i_op->lookup(dir, dentry, flags);
1493 if (unlikely(old)) {
1494 dput(dentry);
1495 dentry = old;
1496 }
1497 return dentry;
1498}
1499
1500static struct dentry *__lookup_hash(const struct qstr *name, 1482static struct dentry *__lookup_hash(const struct qstr *name,
1501 struct dentry *base, unsigned int flags) 1483 struct dentry *base, unsigned int flags)
1502{ 1484{
1503 struct dentry *dentry = lookup_dcache(name, base, flags); 1485 struct dentry *dentry = lookup_dcache(name, base, flags);
1486 struct dentry *old;
1487 struct inode *dir = base->d_inode;
1504 1488
1505 if (dentry) 1489 if (dentry)
1506 return dentry; 1490 return dentry;
1507 1491
1492 /* Don't create child dentry for a dead directory. */
1493 if (unlikely(IS_DEADDIR(dir)))
1494 return ERR_PTR(-ENOENT);
1495
1508 dentry = d_alloc(base, name); 1496 dentry = d_alloc(base, name);
1509 if (unlikely(!dentry)) 1497 if (unlikely(!dentry))
1510 return ERR_PTR(-ENOMEM); 1498 return ERR_PTR(-ENOMEM);
1511 1499
1512 return lookup_real(base->d_inode, dentry, flags); 1500 old = dir->i_op->lookup(dir, dentry, flags);
1501 if (unlikely(old)) {
1502 dput(dentry);
1503 dentry = old;
1504 }
1505 return dentry;
1513} 1506}
1514 1507
1515static int lookup_fast(struct nameidata *nd, 1508static int lookup_fast(struct nameidata *nd,