nfs: allow different protocol in nfs_initiate_commit
authorPeng Tao <tao.peng@primarydata.com>
Sun, 8 Jun 2014 23:10:14 +0000 (07:10 +0800)
committerTom Haynes <loghyr@primarydata.com>
Tue, 3 Feb 2015 19:06:35 +0000 (11:06 -0800)
pnfs flexfile layout client may want to use NFSv3 ops rather
than the default MDS v4 ops.

Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Tom Haynes <Thomas.Haynes@primarydata.com>
fs/nfs/filelayout/filelayout.c
fs/nfs/internal.h
fs/nfs/pnfs_nfs.c
fs/nfs/write.c

index 25c4896887ca2513980110eda7c5d325c5426b22..e5a3c5b1398f9fee75f0be1badf070314ca27daf 100644 (file)
@@ -1055,7 +1055,7 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how)
        fh = select_ds_fh_from_commit(lseg, data->ds_commit_index);
        if (fh)
                data->args.fh = fh;
-       return nfs_initiate_commit(ds_clnt, data,
+       return nfs_initiate_commit(ds_clnt, data, NFS_PROTO(data->inode),
                                   &filelayout_commit_call_ops, how,
                                   RPC_TASK_SOFTCONN);
 out_err:
index 1d15ffa949377a4d8b85028d5ae98471095a8db9..98dee834e9d6396a2ebc4afd46acdd3e59d809df 100644 (file)
@@ -436,6 +436,7 @@ extern void nfs_write_prepare(struct rpc_task *task, void *calldata);
 extern void nfs_commit_prepare(struct rpc_task *task, void *calldata);
 extern int nfs_initiate_commit(struct rpc_clnt *clnt,
                               struct nfs_commit_data *data,
+                              const struct nfs_rpc_ops *nfs_ops,
                               const struct rpc_call_ops *call_ops,
                               int how, int flags);
 extern void nfs_init_commit(struct nfs_commit_data *data,
index 23c851d4c9a9cb0f714ea2249452573802093746..c87f664587ee7372d7c547bfe7011ae9cc8a91e3 100644 (file)
@@ -278,6 +278,7 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
                if (!data->lseg) {
                        nfs_init_commit(data, mds_pages, NULL, cinfo);
                        nfs_initiate_commit(NFS_CLIENT(inode), data,
+                                           NFS_PROTO(data->inode),
                                            data->mds_ops, how, 0);
                } else {
                        struct pnfs_commit_bucket *buckets;
index 54d4857e0e2b1a649bd45b830ab2e75f9d563bb9..8800bd3b235d090b9c73f43573ef965593813691 100644 (file)
@@ -1465,6 +1465,7 @@ void nfs_commitdata_release(struct nfs_commit_data *data)
 EXPORT_SYMBOL_GPL(nfs_commitdata_release);
 
 int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data,
+                       const struct nfs_rpc_ops *nfs_ops,
                        const struct rpc_call_ops *call_ops,
                        int how, int flags)
 {
@@ -1486,7 +1487,7 @@ int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data,
                .priority = priority,
        };
        /* Set up the initial task struct.  */
-       NFS_PROTO(data->inode)->commit_setup(data, &msg);
+       nfs_ops->commit_setup(data, &msg);
 
        dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
 
@@ -1589,8 +1590,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how,
        /* Set up the argument struct */
        nfs_init_commit(data, head, NULL, cinfo);
        atomic_inc(&cinfo->mds->rpcs_out);
-       return nfs_initiate_commit(NFS_CLIENT(inode), data, data->mds_ops,
-                                  how, 0);
+       return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode),
+                                  data->mds_ops, how, 0);
  out_bad:
        nfs_retry_commit(head, NULL, cinfo);
        cinfo->completion_ops->error_cleanup(NFS_I(inode));