public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux-Kernel Mailinglist <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	Andreas Gruenbacher <agruen@suse.de>
Subject: [patch 08/10] Introduce path_get()
Date: Tue, 09 Oct 2007 20:05:11 +0200	[thread overview]
Message-ID: <20071009180513.757397456@X40.localnet> (raw)
In-Reply-To: 20071009180503.075306583@X40.localnet

[-- Attachment #1: vfs/nameidata-path-5.diff --]
[-- Type: text/plain, Size: 2001 bytes --]

This introduces the symmetric function to path_put() for getting a reference
to the dentry and vfsmount of a struct path in the right order.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
---
 fs/namei.c            |   17 +++++++++++++++--
 include/linux/namei.h |    6 ------
 include/linux/path.h  |    1 +
 3 files changed, 16 insertions(+), 8 deletions(-)

Index: b/fs/namei.c
===================================================================
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -363,6 +363,19 @@ int deny_write_access(struct file * file
 }
 
 /**
+ * path_get - get a reference to a path
+ * @path: path to get the reference to
+ *
+ * Given a path increment the reference count to the dentry and the vfsmount.
+ */
+void path_get(struct path *path)
+{
+	mntget(path->mnt);
+	dget(path->dentry);
+}
+EXPORT_SYMBOL(path_get);
+
+/**
  * path_put - put a reference to a path
  * @path: path to put the reference to
  *
@@ -1161,8 +1174,8 @@ static int fastcall do_path_lookup(int d
 		if (retval)
 			goto fput_fail;
 
-		nd->path.mnt = mntget(file->f_path.mnt);
-		nd->path.dentry = dget(dentry);
+		nd->path = file->f_path;
+		path_get(&file->f_path);
 
 		fput_light(file, fput_needed);
 	}
Index: b/include/linux/namei.h
===================================================================
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -94,10 +94,4 @@ static inline char *nd_get_link(struct n
 	return nd->saved_names[nd->depth];
 }
 
-static inline void pathget(struct path *path)
-{
-	mntget(path->mnt);
-	dget(path->dentry);
-}
-
 #endif /* _LINUX_NAMEI_H */
Index: b/include/linux/path.h
===================================================================
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -9,6 +9,7 @@ struct path {
 	struct dentry *dentry;
 };
 
+extern void path_get(struct path *);
 extern void path_put(struct path *);
 
 #endif  /* _LINUX_PATH_H */

-- 


  parent reply	other threads:[~2007-10-09 18:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 18:05 [patch 00/10] Use struct path in struct nameidata Jan Blunck
2007-10-09 18:05 ` [patch 01/10] Dont touch fs_struct in drivers Jan Blunck
2007-10-09 18:05 ` [patch 02/10] Dont touch fs_struct in usermodehelper Jan Blunck
2007-10-09 18:05 ` [patch 03/10] Remove path_release_on_umount() Jan Blunck
2007-10-09 18:05 ` [patch 04/10] Move struct path into its own header Jan Blunck
2007-10-09 18:05 ` [patch 05/10] Embed a struct path into struct nameidata instead of nd->{dentry,mnt} Jan Blunck
2007-10-09 18:05 ` [patch 06/10] Introduce path_put() Jan Blunck
2007-10-09 18:05 ` [patch 07/10] Use path_put() in a few places instead of {mnt,d}put() Jan Blunck
2007-10-09 18:05 ` Jan Blunck [this message]
2007-10-09 18:05 ` [patch 09/10] Use struct path in fs_struct Jan Blunck
2007-10-09 18:05 ` [patch 10/10] Make set_fs_{root,pwd} take a struct path Jan Blunck
  -- strict thread matches above, loose matches on Subject: below --
2007-09-27 14:12 [patch 00/10] Use struct path in struct nameidata jblunck
2007-09-27 14:12 ` [patch 08/10] Introduce path_get() jblunck
2007-09-28 18:40   ` 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=20071009180513.757397456@X40.localnet \
    --to=jblunck@suse.de \
    --cc=agruen@suse.de \
    --cc=akpm@osdl.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox