From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 6/8] nfs: add a rename_setup nfs_rpc_op for async renames
Date: Wed, 15 Sep 2010 09:23:59 -0400 [thread overview]
Message-ID: <1284557041-4375-7-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1284557041-4375-1-git-send-email-jlayton@redhat.com>
Add a call that can set up the arguments and the response container for
an asynchronous rename call.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfs/nfs3proc.c | 18 ++++++++++++++++++
fs/nfs/nfs4proc.c | 21 +++++++++++++++++++++
fs/nfs/proc.c | 12 ++++++++++++
include/linux/nfs_xdr.h | 1 +
4 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index c5cccf1..0654177 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -439,6 +439,23 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
}
static int
+nfs3_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
+{
+ struct nfs_renameres *res = msg->rpc_resp;
+
+ msg->rpc_proc = &nfs3_procedures[NFS3PROC_RENAME];
+
+ res->old_fattr = nfs_alloc_fattr();
+ res->new_fattr = nfs_alloc_fattr();
+ if (res->old_fattr != NULL && res->new_fattr != NULL)
+ return 0;
+
+ nfs_free_fattr(res->old_fattr);
+ nfs_free_fattr(res->new_fattr);
+ return -ENOMEM;
+}
+
+static int
nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name)
{
@@ -842,6 +859,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
.unlink_setup = nfs3_proc_unlink_setup,
.unlink_done = nfs3_proc_unlink_done,
.rename = nfs3_proc_rename,
+ .rename_setup = nfs3_proc_rename_setup,
.link = nfs3_proc_link,
.symlink = nfs3_proc_symlink,
.mkdir = nfs3_proc_mkdir,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 120a8a6..011dc90 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2671,6 +2671,26 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
return 1;
}
+static int nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
+{
+ struct nfs_server *server = NFS_SERVER(dir);
+ struct nfs_renameargs *arg = msg->rpc_argp;
+ struct nfs_renameres *res = msg->rpc_resp;
+
+ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME];
+ arg->bitmask = server->attr_bitmask;
+ res->server = server;
+
+ res->old_fattr = nfs_alloc_fattr();
+ res->new_fattr = nfs_alloc_fattr();
+ if (res->old_fattr != NULL && res->new_fattr != NULL)
+ return 0;
+
+ nfs_free_fattr(res->old_fattr);
+ nfs_free_fattr(res->new_fattr);
+ return -ENOMEM;
+}
+
static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name)
{
@@ -5443,6 +5463,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
.unlink_setup = nfs4_proc_unlink_setup,
.unlink_done = nfs4_proc_unlink_done,
.rename = nfs4_proc_rename,
+ .rename_setup = nfs4_proc_rename_setup,
.link = nfs4_proc_link,
.symlink = nfs4_proc_symlink,
.mkdir = nfs4_proc_mkdir,
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 5c70b58..1b02dee 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -366,6 +366,17 @@ static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir)
}
static int
+nfs_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
+{
+ struct nfs_renameres *res = msg->rpc_resp;
+
+ msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME];
+ res->old_fattr = NULL;
+ res->new_fattr = NULL;
+ return 0;
+}
+
+static int
nfs_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name)
{
@@ -703,6 +714,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
.unlink_setup = nfs_proc_unlink_setup,
.unlink_done = nfs_proc_unlink_done,
.rename = nfs_proc_rename,
+ .rename_setup = nfs_proc_rename_setup,
.link = nfs_proc_link,
.symlink = nfs_proc_symlink,
.mkdir = nfs_proc_mkdir,
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6265fa8..d470751 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1018,6 +1018,7 @@ struct nfs_rpc_ops {
int (*unlink_done) (struct rpc_task *, struct inode *);
int (*rename) (struct inode *, struct qstr *,
struct inode *, struct qstr *);
+ int (*rename_setup) (struct rpc_message *msg, struct inode *dir);
int (*link) (struct inode *, struct inode *, struct qstr *);
int (*symlink) (struct inode *, struct dentry *, struct page *,
unsigned int, struct iattr *);
--
1.7.1
next prev parent reply other threads:[~2010-09-15 13:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-15 13:23 [PATCH 0/8] nfs: ensure that sillyrenames run to completion (try #2) Jeff Layton
2010-09-15 13:23 ` [PATCH 1/8] nfs: eliminate nfs3_renameargs Jeff Layton
2010-09-15 13:23 ` [PATCH 2/8] nfs: convert nfs_renameargs to use qstr structs Jeff Layton
2010-09-15 13:23 ` [PATCH 3/8] nfs: eliminate nfs4_rename_arg Jeff Layton
2010-09-15 15:26 ` Chuck Lever
2010-09-15 15:34 ` Jeff Layton
2010-09-15 16:45 ` Trond Myklebust
2010-09-15 16:50 ` Chuck Lever
2010-09-15 13:23 ` [PATCH 4/8] nfs: standardize the rename response container Jeff Layton
2010-09-15 15:29 ` Chuck Lever
2010-09-15 15:38 ` Jeff Layton
2010-09-15 13:23 ` [PATCH 5/8] nfs: move nfs_sillyrename to unlink.c Jeff Layton
2010-09-15 13:23 ` Jeff Layton [this message]
2010-09-15 15:39 ` [PATCH 6/8] nfs: add a rename_setup nfs_rpc_op for async renames Chuck Lever
2010-09-15 17:23 ` Jeff Layton
2010-09-15 13:24 ` [PATCH 7/8] nfs: add rename_done nfs_rpc_op Jeff Layton
2010-09-15 13:24 ` [PATCH 8/8] nfs: make sillyrename an async operation Jeff Layton
2010-09-15 13:37 ` Jeff Layton
2010-09-15 15:04 ` Jeff Layton
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=1284557041-4375-7-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.com \
/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).