linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 11/11] sunrpc: rpc_pipefs cleanup
Date: Sun, 01 Dec 2013 05:14:52 -0800	[thread overview]
Message-ID: <20131201132011.734298838@bombadil.infradead.org> (raw)
In-Reply-To: 20131201131441.790963326@bombadil.infradead.org

[-- Attachment #1: 0011-sunrpc-rpc_pipefs-cleanup.patch --]
[-- Type: text/plain, Size: 5720 bytes --]

Remove or fold now unused pipe creation and removal functions.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 include/linux/sunrpc/rpc_pipe_fs.h |    8 +---
 net/sunrpc/rpc_pipe.c              |   87 ++++++++----------------------------
 2 files changed, 19 insertions(+), 76 deletions(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index d37a1e2..bed3845 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -62,18 +62,12 @@ extern struct dentry *rpc_create_cache_dir(struct net *n, const char *,
 		const char *, umode_t umode, struct cache_detail *);
 extern void rpc_remove_cache_dir(struct dentry *);
 
-extern int rpc_rmdir(struct dentry *dentry);
-
-struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
-void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
-extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
-					struct rpc_pipe *);
 extern struct rpc_pipe *rpc_mkpipe(struct net *, const char *, const char *,
 	const struct rpc_pipe_ops *, void *private, int);
 extern struct rpc_pipe *rpc_mkpipe_clnt(struct rpc_clnt *, const char *,
 		const struct rpc_pipe_ops *, void *, int);
 extern void rpc_rmpipe(struct rpc_pipe *);
-extern int rpc_unlink(struct dentry *);
+
 extern int register_rpc_pipefs(void);
 extern void unregister_rpc_pipefs(void);
 
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 6bce5f6..f70eec9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -526,42 +526,6 @@ static int __rpc_mkdir(struct inode *dir, struct dentry *dentry,
 	return 0;
 }
 
-static void
-init_pipe(struct rpc_pipe *pipe)
-{
-	pipe->nreaders = 0;
-	pipe->nwriters = 0;
-	INIT_LIST_HEAD(&pipe->in_upcall);
-	INIT_LIST_HEAD(&pipe->in_downcall);
-	INIT_LIST_HEAD(&pipe->pipe);
-	pipe->pipelen = 0;
-	INIT_DELAYED_WORK(&pipe->queue_timeout,
-			    rpc_timeout_upcall_queue);
-	pipe->ops = NULL;
-	spin_lock_init(&pipe->lock);
-	pipe->dentry = NULL;
-}
-
-void rpc_destroy_pipe_data(struct rpc_pipe *pipe)
-{
-	kfree(pipe);
-}
-EXPORT_SYMBOL_GPL(rpc_destroy_pipe_data);
-
-struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags)
-{
-	struct rpc_pipe *pipe;
-
-	pipe = kzalloc(sizeof(struct rpc_pipe), GFP_KERNEL);
-	if (!pipe)
-		return ERR_PTR(-ENOMEM);
-	init_pipe(pipe);
-	pipe->ops = ops;
-	pipe->flags = flags;
-	return pipe;
-}
-EXPORT_SYMBOL_GPL(rpc_mkpipe_data);
-
 static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry,
 			       umode_t mode,
 			       const struct file_operations *i_fop,
@@ -592,22 +556,6 @@ static int __rpc_rmdir(struct inode *dir, struct dentry *dentry)
 	return ret;
 }
 
-int rpc_rmdir(struct dentry *dentry)
-{
-	struct dentry *parent;
-	struct inode *dir;
-	int error;
-
-	parent = dget_parent(dentry);
-	dir = parent->d_inode;
-	mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
-	error = __rpc_rmdir(dir, dentry);
-	mutex_unlock(&dir->i_mutex);
-	dput(parent);
-	return error;
-}
-EXPORT_SYMBOL_GPL(rpc_rmdir);
-
 static int __rpc_unlink(struct inode *dir, struct dentry *dentry)
 {
 	int ret;
@@ -812,7 +760,7 @@ static int rpc_rmdir_depopulate(struct dentry *dentry,
  * The @private argument passed here will be available to all these methods
  * from the file pointer, via RPC_I(file_inode(file))->private.
  */
-struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
+static struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
 				 void *private, struct rpc_pipe *pipe)
 {
 	struct dentry *dentry;
@@ -843,7 +791,6 @@ out_err:
 			err);
 	goto out;
 }
-EXPORT_SYMBOL_GPL(rpc_mkpipe_dentry);
 
 struct rpc_pipe *
 __rpc_mkpipe(struct dentry *dir, const char *name,
@@ -852,10 +799,21 @@ __rpc_mkpipe(struct dentry *dir, const char *name,
 	struct rpc_pipe *pipe;
 	int err = -ENOENT;
 
-	pipe = rpc_mkpipe_data(ops, flags);
-	if (IS_ERR(pipe))
-		return pipe;
+	pipe = kzalloc(sizeof(struct rpc_pipe), GFP_KERNEL);
+	if (!pipe)
+		return ERR_PTR(-ENOMEM);
+
+	pipe->nreaders = 0;
+	pipe->nwriters = 0;
+	INIT_LIST_HEAD(&pipe->in_upcall);
+	INIT_LIST_HEAD(&pipe->in_downcall);
+	INIT_LIST_HEAD(&pipe->pipe);
+	pipe->pipelen = 0;
+	INIT_DELAYED_WORK(&pipe->queue_timeout, rpc_timeout_upcall_queue);
+	spin_lock_init(&pipe->lock);
 
+	pipe->ops = ops;
+	pipe->flags = flags;
 	pipe->dentry = rpc_mkpipe_dentry(dir, name, private, pipe);
 	if (IS_ERR(pipe->dentry)) {
 		err = PTR_ERR(pipe->dentry);
@@ -863,7 +821,7 @@ __rpc_mkpipe(struct dentry *dir, const char *name,
 	}
 	return pipe;
 out_destroy_pipe:
-	rpc_destroy_pipe_data(pipe);
+	kfree(pipe);
 	return ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(__rpc_mkpipe);
@@ -893,15 +851,7 @@ rpc_mkpipe_clnt(struct rpc_clnt *clnt, const char *name,
 }
 EXPORT_SYMBOL_GPL(rpc_mkpipe_clnt);
 
-/**
- * rpc_unlink - remove a pipe
- * @dentry: dentry for the pipe, as returned from rpc_mkpipe
- *
- * After this call, lookups will no longer find the pipe, and any
- * attempts to read or write using preexisting opens of the pipe will
- * return -EPIPE.
- */
-int
+static int
 rpc_unlink(struct dentry *dentry)
 {
 	struct dentry *parent;
@@ -916,13 +866,12 @@ rpc_unlink(struct dentry *dentry)
 	dput(parent);
 	return error;
 }
-EXPORT_SYMBOL_GPL(rpc_unlink);
 
 void rpc_rmpipe(struct rpc_pipe *pipe)
 {
 	if (pipe->dentry)
 		rpc_unlink(pipe->dentry);
-	rpc_destroy_pipe_data(pipe);
+	kfree(pipe);
 }
 EXPORT_SYMBOL_GPL(rpc_rmpipe);
 
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-12-01 13:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-01 13:14 [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Christoph Hellwig
2013-12-01 13:14 ` [PATCH 01/11] sunrpc: allocate pipefs inodes using kmalloc Christoph Hellwig
     [not found]   ` <20131201132009.815675002-PfSpb0PWhxZc2C7mugBRk2EX/6BAtgUQ@public.gmane.org>
2013-12-01 14:26     ` Jeff Layton
2013-12-01 13:14 ` [PATCH 02/11] rpc_pipefs: always mount on net namespace initialization Christoph Hellwig
2013-12-01 15:24   ` Jeff Layton
2013-12-01 13:14 ` [PATCH 03/11] sunrpc: remove the rpc_clients_block notifier Christoph Hellwig
2013-12-01 15:25   ` Jeff Layton
2013-12-01 13:14 ` [PATCH 04/11] sunrpc: no need to have a lock or superblock for rpc_unlink Christoph Hellwig
2013-12-01 13:14 ` [PATCH 05/11] sunprc: add sensible pipe creation and removal helpers Christoph Hellwig
2013-12-01 13:14 ` [PATCH 06/11] sunrpc: clean up rpc_pipefs client dir creation Christoph Hellwig
2013-12-01 13:14 ` [PATCH 07/11] sunrpc: make rpc_mkdir_populate net-namespace aware Christoph Hellwig
2013-12-01 13:14 ` [PATCH 08/11] sunrpc: rpc_get_sb_net, die, die, die Christoph Hellwig
2013-12-01 13:14 ` [PATCH 09/11] nfs: convert idmapper to rpc_mkpipe_clnt Christoph Hellwig
2013-12-01 13:14 ` [PATCH 10/11] auth_gss: convert " Christoph Hellwig
2013-12-01 13:14 ` Christoph Hellwig [this message]
     [not found] ` <20131201131441.790963326-PfSpb0PWhxZc2C7mugBRk2EX/6BAtgUQ@public.gmane.org>
2013-12-01 14:36   ` [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Jeff Layton
2013-12-01 15:44   ` Jeff Layton
2013-12-01 15:57     ` Jeff Layton
2013-12-01 18:13   ` Al Viro
     [not found]     ` <20131201181329.GC10323-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-12-02  8:12       ` Christoph Hellwig
2013-12-02 13:44         ` Trond Myklebust
2013-12-02 14:24           ` Stanislav Kinsbursky
     [not found]             ` <529C982B.2030906-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-12-02 15:36               ` Christoph Hellwig
2013-12-02 15:58               ` Trond Myklebust
     [not found]                 ` <5872AE74-DF03-42E2-A21B-F8E35634CD1D-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2013-12-03  7:24                   ` Stanislav Kinsbursky
     [not found]           ` <3C65EB4C-6592-44F8-B08D-E5A9EFD6C8C6-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2013-12-02 15:34             ` Christoph Hellwig
     [not found]               ` <20131202153435.GA2804-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-12-02 16:00                 ` Trond Myklebust
     [not found]                   ` <BCED1826-0743-4420-AD45-B38D67EF3D99-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2013-12-02 16:27                     ` Christoph Hellwig
     [not found]                       ` <20131202162716.GA17417-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-12-02 16:46                         ` Trond Myklebust
2013-12-02 16:33                   ` Jeff Layton
2013-12-02 16:37                     ` J. Bruce Fields
2013-12-02 16:45                       ` Jeff Layton
2013-12-02 15:57             ` Al Viro
2013-12-02 16:04               ` Trond Myklebust
2013-12-03  2:11       ` [RFC] alloc_pid() breakage Al Viro
2013-12-02  7:23   ` [PATCH 00/11] [RFC] repair net namespace damage to rpc_pipefs Stanislav Kinsbursky

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=20131201132011.734298838@bombadil.infradead.org \
    --to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.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;
as well as URLs for NNTP newsgroup(s).