From: Jeff Layton <jlayton@redhat.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 7/9] nfs: add a rename_setup nfs_rpc_op for async renames
Date: Fri, 10 Sep 2010 15:27:16 -0400 [thread overview]
Message-ID: <1284146838-1468-8-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1284146838-1468-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 | 8 ++++++++
include/linux/nfs_xdr.h | 1 +
4 files changed, 48 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..48410f9 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -366,6 +366,13 @@ 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)
+{
+ msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME];
+ 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 +710,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-10 19:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-10 19:27 [PATCH 0/9] nfs: make sure sillyrenames run to completion (try #1) Jeff Layton
2010-09-10 19:27 ` [PATCH 1/9] nfs: eliminate nfs3_renameargs Jeff Layton
2010-09-10 19:27 ` [PATCH 2/9] nfs: convert nfs_renameargs to use qstr structs Jeff Layton
2010-09-10 19:27 ` [PATCH 3/9] nfs: eliminate nfs4_rename_arg Jeff Layton
2010-09-10 19:27 ` [PATCH 4/9] nfs: standardize the rename response container Jeff Layton
2010-09-10 19:27 ` [PATCH 5/9] nfs: move nfs_sillyrename to unlink.c Jeff Layton
2010-09-10 19:27 ` [PATCH 6/9] nfs: eliminate qsilly var from nfs_sillyrename Jeff Layton
2010-09-10 19:27 ` Jeff Layton [this message]
2010-09-10 19:27 ` [PATCH 8/9] nfs: add rename_done nfs_rpc_op Jeff Layton
2010-09-10 19:27 ` [PATCH 9/9] nfs: make sillyrename an async operation 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=1284146838-1468-8-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=linux-nfs@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