[PATCH 05/10] VFS: export done_path_update()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This function will be useful to nfsd, so export it.  As most callers
will want "with_wq" to be true, rename the current done_path_update() to
__done_path_update() and add a new done_path_update() which sets with_wq
to true.

done_path_create_wq() is now simple enough to be "static inline"
rather than an explicit export.

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---
 fs/namei.c            |   16 +++++-----------
 include/linux/namei.h |   16 ++++++++++++++--
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 8df09c19f2b0..13f8ac9721be 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1723,8 +1723,8 @@ struct dentry *lookup_hash_update_len(const char *name, int nlen,
 }
 EXPORT_SYMBOL(lookup_hash_update_len);
 
-static void done_path_update(struct path *path, struct dentry *dentry,
-			     bool with_wq)
+void __done_path_update(struct path *path, struct dentry *dentry,
+			bool with_wq)
 {
 	struct inode *dir = path->dentry->d_inode;
 
@@ -1737,6 +1737,7 @@ static void done_path_update(struct path *path, struct dentry *dentry,
 	dput(dentry);
 	mnt_drop_write(path->mnt);
 }
+EXPORT_SYMBOL(__done_path_update);
 
 static struct dentry *lookup_fast(struct nameidata *nd)
 {
@@ -3987,13 +3988,6 @@ struct dentry *kern_path_create(int dfd, const char *pathname,
 }
 EXPORT_SYMBOL(kern_path_create);
 
-void done_path_create_wq(struct path *path, struct dentry *dentry, bool with_wq)
-{
-	done_path_update(path, dentry, with_wq);
-	path_put(path);
-}
-EXPORT_SYMBOL(done_path_create_wq);
-
 inline struct dentry *user_path_create(int dfd, const char __user *pathname,
 				       struct path *path, unsigned int lookup_flags)
 {
@@ -4309,7 +4303,7 @@ int do_rmdir(int dfd, struct filename *name)
 	mnt_userns = mnt_user_ns(path.mnt);
 	error = vfs_rmdir(mnt_userns, path.dentry->d_inode, dentry);
 exit3:
-	done_path_update(&path, dentry, true);
+	done_path_update(&path, dentry);
 exit2:
 	path_put(&path);
 	if (retry_estale(error, lookup_flags)) {
@@ -4443,7 +4437,7 @@ int do_unlinkat(int dfd, struct filename *name)
 		error = vfs_unlink(mnt_userns, path.dentry->d_inode, dentry,
 				   &delegated_inode);
 exit3:
-		done_path_update(&path, dentry, true);
+		done_path_update(&path, dentry);
 	}
 	if (inode)
 		iput(inode);	/* truncate the inode here */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index b7a123b489b1..b1a210a51210 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -64,11 +64,23 @@ extern struct dentry *user_path_create(int, const char __user *, struct path *,
 extern struct dentry *lookup_hash_update_len(const char *name, int nlen,
 					     struct path *path, unsigned int flags,
 					     wait_queue_head_t *wq);
-extern void done_path_create_wq(struct path *, struct dentry *, bool);
+extern void __done_path_update(struct path *, struct dentry *, bool);
+static inline void done_path_update(struct path *path, struct dentry *dentry)
+{
+	__done_path_update(path, dentry, true);
+}
 static inline void done_path_create(struct path *path, struct dentry *dentry)
 {
-	done_path_create_wq(path, dentry, false);
+	__done_path_update(path, dentry, false);
+	path_put(path);
 }
+static inline void done_path_create_wq(struct path *path, struct dentry *dentry,
+				       bool with_wq)
+{
+	__done_path_update(path, dentry, with_wq);
+	path_put(path);
+}
+
 extern struct dentry *kern_path_locked(const char *, struct path *);
 
 extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int);





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux