All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ram <linuxram@us.ibm.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jeff Mahoney <jeffm@suse.com>, Andrew Morton <akpm@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vfs: namei operations should pass nameidata when available
Date: Fri, 10 Jun 2005 12:05:11 -0700	[thread overview]
Message-ID: <1118430311.4227.10.camel@localhost> (raw)
In-Reply-To: <20050328201728.GA12668@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On Mon, 2005-03-28 at 12:17, Christoph Hellwig wrote:
> > +	dentry = __lookup_hash(&nd->last, nd->dentry, nd);
> 
> Please add a tiny wrapper lookup_hash_nd(struct nameidata *nd)
> that expands to the above instead of opencoding it everywhere.
> 
> Or just call it lookup_hash() after you removed the original version..

Jeff,

   I have incorporated the Christophs' comments. 
   lookup_hash() now takes a third
   nameidata argument. I touch tested it. If you like the patch can
   your forward it to Andrew.

Thanks,
RP

> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

[-- Attachment #2: lookup.patch --]
[-- Type: text/x-patch, Size: 7880 bytes --]

diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/drivers/usb/core/inode.c linux-2.6.12-rc4/drivers/usb/core/inode.c
--- /home/linux/views/linux-2.6.12-rc4/drivers/usb/core/inode.c	2005-05-06 23:22:26.000000000 -0700
+++ linux-2.6.12-rc4/drivers/usb/core/inode.c	2005-05-23 13:41:10.000000000 -0700
@@ -460,7 +460,7 @@ static struct dentry * get_dentry(struct
 	qstr.name = name;
 	qstr.len = strlen(name);
 	qstr.hash = full_name_hash(name,qstr.len);
-	return lookup_hash(&qstr,parent);
+	return lookup_hash(&qstr,parent,NULL);
 }               
 
 
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/fs/debugfs/inode.c linux-2.6.12-rc4/fs/debugfs/inode.c
--- /home/linux/views/linux-2.6.12-rc4/fs/debugfs/inode.c	2005-03-02 02:59:59.000000000 -0800
+++ linux-2.6.12-rc4/fs/debugfs/inode.c	2005-05-23 13:41:46.000000000 -0700
@@ -117,7 +117,7 @@ static struct dentry * get_dentry(struct
 	qstr.name = name;
 	qstr.len = strlen(name);
 	qstr.hash = full_name_hash(name,qstr.len);
-	return lookup_hash(&qstr,parent);
+	return lookup_hash(&qstr,parent,NULL);
 }               
 
 static struct super_block *debug_get_sb(struct file_system_type *fs_type,
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/fs/ext3/super.c linux-2.6.12-rc4/fs/ext3/super.c
--- /home/linux/views/linux-2.6.12-rc4/fs/ext3/super.c	2005-05-06 23:22:29.000000000 -0700
+++ linux-2.6.12-rc4/fs/ext3/super.c	2005-05-23 13:42:07.000000000 -0700
@@ -2346,7 +2346,7 @@ static int ext3_quota_on_mount(struct su
 			     .hash = 0,
 			     .len = strlen(EXT3_SB(sb)->s_qf_names[type])};
 
-	dentry = lookup_hash(&name, sb->s_root);
+	dentry = lookup_hash(&name, sb->s_root, NULL);
 	if (IS_ERR(dentry))
 		return PTR_ERR(dentry);
 	err = vfs_quota_on_mount(type, EXT3_SB(sb)->s_jquota_fmt, dentry);
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/fs/namei.c linux-2.6.12-rc4/fs/namei.c
--- /home/linux/views/linux-2.6.12-rc4/fs/namei.c	2005-05-06 23:22:29.000000000 -0700
+++ linux-2.6.12-rc4/fs/namei.c	2005-05-23 13:42:56.000000000 -0700
@@ -1075,9 +1075,10 @@ out:
 	return dentry;
 }
 
-struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
+struct dentry * lookup_hash(struct qstr *name, struct dentry * base, 
+			struct nameidata *nd)
 {
-	return __lookup_hash(name, base, NULL);
+	return __lookup_hash(name, base, nd);
 }
 
 /* SMP-safe */
@@ -1101,7 +1102,7 @@ struct dentry * lookup_one_len(const cha
 	}
 	this.hash = end_name_hash(hash);
 
-	return lookup_hash(&this, base);
+	return lookup_hash(&this, base, NULL);
 access:
 	return ERR_PTR(-EACCES);
 }
@@ -1568,7 +1569,7 @@ struct dentry *lookup_create(struct name
 	if (nd->last_type != LAST_NORM)
 		goto fail;
 	nd->flags &= ~LOOKUP_PARENT;
-	dentry = lookup_hash(&nd->last, nd->dentry);
+	dentry = lookup_hash(&nd->last, nd->dentry, nd);
 	if (IS_ERR(dentry))
 		goto fail;
 	if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
@@ -1800,7 +1801,7 @@ asmlinkage long sys_rmdir(const char __u
 			goto exit1;
 	}
 	down(&nd.dentry->d_inode->i_sem);
-	dentry = lookup_hash(&nd.last, nd.dentry);
+	dentry = lookup_hash(&nd.last, nd.dentry, &nd);
 	error = PTR_ERR(dentry);
 	if (!IS_ERR(dentry)) {
 		error = vfs_rmdir(nd.dentry->d_inode, dentry);
@@ -1869,7 +1870,7 @@ asmlinkage long sys_unlink(const char __
 	if (nd.last_type != LAST_NORM)
 		goto exit1;
 	down(&nd.dentry->d_inode->i_sem);
-	dentry = lookup_hash(&nd.last, nd.dentry);
+	dentry = lookup_hash(&nd.last, nd.dentry, &nd);
 	error = PTR_ERR(dentry);
 	if (!IS_ERR(dentry)) {
 		/* Why not before? Because we want correct error value */
@@ -2218,7 +2219,7 @@ static inline int do_rename(const char *
 
 	trap = lock_rename(new_dir, old_dir);
 
-	old_dentry = lookup_hash(&oldnd.last, old_dir);
+	old_dentry = lookup_hash(&oldnd.last, old_dir, &oldnd);
 	error = PTR_ERR(old_dentry);
 	if (IS_ERR(old_dentry))
 		goto exit3;
@@ -2238,7 +2239,7 @@ static inline int do_rename(const char *
 	error = -EINVAL;
 	if (old_dentry == trap)
 		goto exit4;
-	new_dentry = lookup_hash(&newnd.last, new_dir);
+	new_dentry = lookup_hash(&newnd.last, new_dir, &newnd);
 	error = PTR_ERR(new_dentry);
 	if (IS_ERR(new_dentry))
 		goto exit4;
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/fs/reiserfs/super.c linux-2.6.12-rc4/fs/reiserfs/super.c
--- /home/linux/views/linux-2.6.12-rc4/fs/reiserfs/super.c	2005-05-06 23:22:29.000000000 -0700
+++ linux-2.6.12-rc4/fs/reiserfs/super.c	2005-05-23 13:43:11.000000000 -0700
@@ -1941,7 +1941,7 @@ static int reiserfs_quota_on_mount(struc
                          .hash = 0,
                          .len = strlen(REISERFS_SB(sb)->s_qf_names[type])};
 
-    dentry = lookup_hash(&name, sb->s_root);
+    dentry = lookup_hash(&name, sb->s_root, NULL);
     if (IS_ERR(dentry))
             return PTR_ERR(dentry);
     err = vfs_quota_on_mount(type, REISERFS_SB(sb)->s_jquota_fmt, dentry);
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/fs/sysfs/inode.c linux-2.6.12-rc4/fs/sysfs/inode.c
--- /home/linux/views/linux-2.6.12-rc4/fs/sysfs/inode.c	2005-05-06 23:22:30.000000000 -0700
+++ linux-2.6.12-rc4/fs/sysfs/inode.c	2005-05-23 13:43:35.000000000 -0700
@@ -83,7 +83,7 @@ struct dentry * sysfs_get_dentry(struct 
 	qstr.name = name;
 	qstr.len = strlen(name);
 	qstr.hash = full_name_hash(name,qstr.len);
-	return lookup_hash(&qstr,parent);
+	return lookup_hash(&qstr,parent,NULL);
 }
 
 /*
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/include/linux/namei.h linux-2.6.12-rc4/include/linux/namei.h
--- /home/linux/views/linux-2.6.12-rc4/include/linux/namei.h	2005-05-06 23:22:33.000000000 -0700
+++ linux-2.6.12-rc4/include/linux/namei.h	2005-05-23 13:28:44.000000000 -0700
@@ -66,7 +66,8 @@ extern void path_release(struct nameidat
 extern void path_release_on_umount(struct nameidata *);
 
 extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
-extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
+extern struct dentry * lookup_hash(struct qstr *, struct dentry *, 
+		struct nameidata *);
 
 extern int follow_down(struct vfsmount **, struct dentry **);
 extern int follow_up(struct vfsmount **, struct dentry **);
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/net/sunrpc/rpc_pipe.c linux-2.6.12-rc4/net/sunrpc/rpc_pipe.c
--- /home/linux/views/linux-2.6.12-rc4/net/sunrpc/rpc_pipe.c	2005-03-02 03:00:24.000000000 -0800
+++ linux-2.6.12-rc4/net/sunrpc/rpc_pipe.c	2005-05-23 13:51:08.000000000 -0700
@@ -601,7 +601,7 @@ rpc_lookup_negative(char *path, struct n
 		return ERR_PTR(error);
 	dir = nd->dentry->d_inode;
 	down(&dir->i_sem);
-	dentry = lookup_hash(&nd->last, nd->dentry);
+	dentry = lookup_hash(&nd->last, nd->dentry, nd);
 	if (IS_ERR(dentry))
 		goto out_err;
 	if (dentry->d_inode) {
@@ -663,7 +663,7 @@ rpc_rmdir(char *path)
 		return error;
 	dir = nd.dentry->d_inode;
 	down(&dir->i_sem);
-	dentry = lookup_hash(&nd.last, nd.dentry);
+	dentry = lookup_hash(&nd.last, nd.dentry, &nd);
 	if (IS_ERR(dentry)) {
 		error = PTR_ERR(dentry);
 		goto out_release;
@@ -724,7 +724,7 @@ rpc_unlink(char *path)
 		return error;
 	dir = nd.dentry->d_inode;
 	down(&dir->i_sem);
-	dentry = lookup_hash(&nd.last, nd.dentry);
+	dentry = lookup_hash(&nd.last, nd.dentry, &nd);
 	if (IS_ERR(dentry)) {
 		error = PTR_ERR(dentry);
 		goto out_release;
diff -Nrup -X dontdiff /home/linux/views/linux-2.6.12-rc4/net/unix/af_unix.c linux-2.6.12-rc4/net/unix/af_unix.c
--- /home/linux/views/linux-2.6.12-rc4/net/unix/af_unix.c	2005-05-06 23:22:35.000000000 -0700
+++ linux-2.6.12-rc4/net/unix/af_unix.c	2005-05-23 13:51:22.000000000 -0700
@@ -784,7 +784,7 @@ static int unix_bind(struct socket *sock
 		/*
 		 * Do the final lookup.
 		 */
-		dentry = lookup_hash(&nd.last, nd.dentry);
+		dentry = lookup_hash(&nd.last, nd.dentry, &nd);
 		err = PTR_ERR(dentry);
 		if (IS_ERR(dentry))
 			goto out_mknod_unlock;

  reply	other threads:[~2005-06-10 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-28 20:06 [PATCH] vfs: namei operations should pass nameidata when available Jeff Mahoney
2005-03-28 20:17 ` Christoph Hellwig
2005-06-10 19:05   ` Ram [this message]
2005-06-10 20:09     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118430311.4227.10.camel@localhost \
    --to=linuxram@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=jeffm@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.