File aufs-push-lookup-down of Package aufs

From: Jeff Mahoney <jeffm@suse.com>
Subject: aufs: Push qstr processing down to au_lkup_hash_dlgt

 This patch pushes the qstr processing down into au_lkup_hash_dlgt so
 that lookup_one_len doesn't end up duplicating the qstr setup. This
 is used in later patches.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/aufs25/br_nfs.c |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

--- a/fs/aufs25/br_nfs.c
+++ b/fs/aufs25/br_nfs.c
@@ -268,20 +268,24 @@ static void au_call_lookup_hash(void *ar
 }
 
 static struct dentry *
-au_lkup_hash_dlgt(struct qstr *this, struct dentry *parent,
+au_lkup_hash_dlgt(const char *name, int len, struct dentry *parent,
 		  struct nameidata *nd, unsigned int flags)
 {
 	struct dentry *dentry;
 	int dirperm1;
+	struct qstr this;
+	int err = __lookup_one_len(name, &this, parent, len);
+	if (err)
+		return ERR_PTR(err);
 
 	dirperm1 = au_ftest_ndx(flags, DIRPERM1);
 	if (!dirperm1 && !au_ftest_ndx(flags, DLGT))
-		dentry = vfsub__lookup_hash(this, parent, nd);
+		dentry = vfsub__lookup_hash(&this, parent, nd);
 	else {
 		int wkq_err;
 		struct au_lookup_hash_args args = {
 			.errp	= &dentry,
-			.name	= this,
+			.name	= &this,
 			.base	= parent,
 			.nd	= nd
 		};
@@ -296,10 +300,14 @@ au_lkup_hash_dlgt(struct qstr *this, str
 }
 #else
 static struct dentry *
-au_lkup_hash_dlgt(struct qstr *this, struct dentry *parent,
+au_lkup_hash_dlgt(const char *name, int len, struct dentry *parent,
 		  struct nameidata *nd, unsigned int flags)
 {
-	return vfsub__lookup_hash(this, parent, nd);
+	struct qstr this;
+	int err = __lookup_one_len(name, &this, parent, len);
+	if (err)
+		return ERR_PTR(err);
+	return vfsub__lookup_hash(&this, parent, nd);
 }
 #endif /* CONFIG_AUFS_DLGT */
 
@@ -307,17 +315,11 @@ struct dentry *au_lkup_hash(const char *
 			    int len, struct au_ndx *ndx)
 {
 	struct dentry *dentry;
-	struct qstr this;
 	struct nameidata tmp_nd, *ndo;
 	int err;
 
 	LKTRTrace("%.*s/%.*s\n", AuDLNPair(parent), len, name);
 
-	err = __lookup_one_len(name, &this, parent, len);
-	dentry = ERR_PTR(err);
-	if (err)
-		goto out;
-
 	ndo = ndx->nd;
 	if (ndo) {
 		tmp_nd = *ndo;
@@ -331,7 +333,7 @@ struct dentry *au_lkup_hash(const char *
 	tmp_nd.path.dentry = parent;
 	tmp_nd.path.mnt = ndx->nfsmnt;
 	path_get(&tmp_nd.path);
-	dentry = au_lkup_hash_dlgt(&this, parent, &tmp_nd, ndx->flags);
+	dentry = au_lkup_hash_dlgt(name, len, parent, &tmp_nd, ndx->flags);
 	if (!IS_ERR(dentry)) {
 		/* why negative dentry for a new dir was unhashed? */
 		if (unlikely(d_unhashed(dentry)))
@@ -345,10 +347,10 @@ struct dentry *au_lkup_hash(const char *
 	}
 	path_put(&tmp_nd.path);
 
- out_intent:
+out_intent:
 	if (tmp_nd.intent.open.file)
 		put_filp(tmp_nd.intent.open.file);
- out:
+
 	AuTraceErrPtr(dentry);
 	return dentry;
 }
openSUSE Build Service is sponsored by