NFS: Remove nfs4_setup_sequence from generic rename code
authorBryan Schumaker <bjschuma@netapp.com>
Mon, 19 Mar 2012 18:54:42 +0000 (14:54 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 21 Mar 2012 13:31:46 +0000 (09:31 -0400)
This is an NFS v4 specific operation, so it belongs in the NFS v4 code
and not the generic client.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/proc.c
fs/nfs/unlink.c
include/linux/nfs_xdr.h

index 7f3f957f677c472079544aba71bcb80d71cf9eca..5242eae6711a0b5323b1dcec13d57ecf01c47986 100644 (file)
@@ -450,6 +450,11 @@ nfs3_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
        msg->rpc_proc = &nfs3_procedures[NFS3PROC_RENAME];
 }
 
+static void nfs3_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
+{
+       rpc_call_start(task);
+}
+
 static int
 nfs3_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
                      struct inode *new_dir)
@@ -883,6 +888,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
        .unlink_done    = nfs3_proc_unlink_done,
        .rename         = nfs3_proc_rename,
        .rename_setup   = nfs3_proc_rename_setup,
+       .rename_rpc_prepare = nfs3_proc_rename_rpc_prepare,
        .rename_done    = nfs3_proc_rename_done,
        .link           = nfs3_proc_link,
        .symlink        = nfs3_proc_symlink,
index 9c247fa7915a40dbdb71f5f95b28ea9df37d3394..b76dd0efae75b345cf5465c28aab1cb770424aa7 100644 (file)
@@ -2814,6 +2814,16 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
        nfs41_init_sequence(&arg->seq_args, &res->seq_res, 1);
 }
 
+static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
+{
+       if (nfs4_setup_sequence(NFS_SERVER(data->old_dir),
+                               &data->args.seq_args,
+                               &data->res.seq_res,
+                               task))
+               return;
+       rpc_call_start(task);
+}
+
 static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
                                 struct inode *new_dir)
 {
@@ -6465,6 +6475,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
        .unlink_done    = nfs4_proc_unlink_done,
        .rename         = nfs4_proc_rename,
        .rename_setup   = nfs4_proc_rename_setup,
+       .rename_rpc_prepare = nfs4_proc_rename_rpc_prepare,
        .rename_done    = nfs4_proc_rename_done,
        .link           = nfs4_proc_link,
        .symlink        = nfs4_proc_symlink,
index 528b9a2fae05892322ff4d60ae99665ba19252d3..b63b6f4d14fbd5f54bdf265461c2a0069cbc5db0 100644 (file)
@@ -377,6 +377,11 @@ nfs_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
        msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME];
 }
 
+static void nfs_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
+{
+       rpc_call_start(task);
+}
+
 static int
 nfs_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
                     struct inode *new_dir)
@@ -740,6 +745,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
        .unlink_done    = nfs_proc_unlink_done,
        .rename         = nfs_proc_rename,
        .rename_setup   = nfs_proc_rename_setup,
+       .rename_rpc_prepare = nfs_proc_rename_rpc_prepare,
        .rename_done    = nfs_proc_rename_done,
        .link           = nfs_proc_link,
        .symlink        = nfs_proc_symlink,
index 9c5a7980e2444b02244e6ebb9a0cd14780831c99..3210a03342f924e886e5c7f174c9147de54911a4 100644 (file)
@@ -323,18 +323,6 @@ nfs_cancel_async_unlink(struct dentry *dentry)
        spin_unlock(&dentry->d_lock);
 }
 
-struct nfs_renamedata {
-       struct nfs_renameargs   args;
-       struct nfs_renameres    res;
-       struct rpc_cred         *cred;
-       struct inode            *old_dir;
-       struct dentry           *old_dentry;
-       struct nfs_fattr        old_fattr;
-       struct inode            *new_dir;
-       struct dentry           *new_dentry;
-       struct nfs_fattr        new_fattr;
-};
-
 /**
  * nfs_async_rename_done - Sillyrename post-processing
  * @task: rpc_task of the sillyrename
@@ -385,25 +373,16 @@ static void nfs_async_rename_release(void *calldata)
        kfree(data);
 }
 
-#if defined(CONFIG_NFS_V4_1)
 static void nfs_rename_prepare(struct rpc_task *task, void *calldata)
 {
        struct nfs_renamedata *data = calldata;
-       struct nfs_server *server = NFS_SERVER(data->old_dir);
-
-       if (nfs4_setup_sequence(server, &data->args.seq_args,
-                               &data->res.seq_res, task))
-               return;
-       rpc_call_start(task);
+       NFS_PROTO(data->old_dir)->rename_rpc_prepare(task, data);
 }
-#endif /* CONFIG_NFS_V4_1 */
 
 static const struct rpc_call_ops nfs_rename_ops = {
        .rpc_call_done = nfs_async_rename_done,
        .rpc_release = nfs_async_rename_release,
-#if defined(CONFIG_NFS_V4_1)
        .rpc_call_prepare = nfs_rename_prepare,
-#endif /* CONFIG_NFS_V4_1 */
 };
 
 /**
index 8d93e688188d11641068edce0f5ab35f5eaee009..bfd0d1bf67072e9a5a6f6c143e80f56fcc6238aa 100644 (file)
@@ -1201,6 +1201,18 @@ struct nfs_unlinkdata {
        struct nfs_fattr dir_attr;
 };
 
+struct nfs_renamedata {
+       struct nfs_renameargs   args;
+       struct nfs_renameres    res;
+       struct rpc_cred         *cred;
+       struct inode            *old_dir;
+       struct dentry           *old_dentry;
+       struct nfs_fattr        old_fattr;
+       struct inode            *new_dir;
+       struct dentry           *new_dentry;
+       struct nfs_fattr        new_fattr;
+};
+
 struct nfs_access_entry;
 struct nfs_client;
 struct rpc_timeout;
@@ -1235,6 +1247,7 @@ struct nfs_rpc_ops {
        int     (*rename)  (struct inode *, struct qstr *,
                            struct inode *, struct qstr *);
        void    (*rename_setup)  (struct rpc_message *msg, struct inode *dir);
+       void    (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
        int     (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
        int     (*link)    (struct inode *, struct inode *, struct qstr *);
        int     (*symlink) (struct inode *, struct dentry *, struct page *,