diff mbox series

[for-6.11,02/29] nfs: pass nfs_client to nfs_initiate_commit

Message ID 20240607142646.20924-3-snitzer@kernel.org (mailing list archive)
State New
Headers show
Series nfs/nfsd: add support for localio bypass | expand

Commit Message

Mike Snitzer June 7, 2024, 2:26 p.m. UTC
From: Weston Andros Adamson <dros@primarydata.com>

The nfs_client is needed for localio support.

Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 fs/nfs/filelayout/filelayout.c         | 3 ++-
 fs/nfs/flexfilelayout/flexfilelayout.c | 2 +-
 fs/nfs/internal.h                      | 3 ++-
 fs/nfs/pnfs_nfs.c                      | 3 ++-
 fs/nfs/write.c                         | 9 ++++++---
 5 files changed, 13 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 43e16e9e0176..0c4a1fbb6a19 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -1009,7 +1009,8 @@  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, NFS_PROTO(data->inode),
+	return nfs_initiate_commit(ds->ds_clp, ds_clnt, data,
+				   NFS_PROTO(data->inode),
 				   &filelayout_commit_call_ops, how,
 				   RPC_TASK_SOFTCONN);
 out_err:
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 327f1a5c9fbe..dee4bc560b8e 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1948,7 +1948,7 @@  static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
 	if (fh)
 		data->args.fh = fh;
 
-	ret = nfs_initiate_commit(ds_clnt, data, ds->ds_clp->rpc_ops,
+	ret = nfs_initiate_commit(ds->ds_clp, ds_clnt, data, ds->ds_clp->rpc_ops,
 				   vers == 3 ? &ff_layout_commit_call_ops_v3 :
 					       &ff_layout_commit_call_ops_v4,
 				   how, RPC_TASK_SOFTCONN);
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index a9c0c29f7804..13c28cae45c5 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -525,7 +525,8 @@  extern void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
 extern void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio);
 extern void nfs_commit_free(struct nfs_commit_data *p);
 extern void nfs_commit_prepare(struct rpc_task *task, void *calldata);
-extern int nfs_initiate_commit(struct rpc_clnt *clnt,
+extern int nfs_initiate_commit(struct nfs_client *clp,
+			       struct rpc_clnt *clnt,
 			       struct nfs_commit_data *data,
 			       const struct nfs_rpc_ops *nfs_ops,
 			       const struct rpc_call_ops *call_ops,
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
index 88e061bd711b..b29b50c2c933 100644
--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -534,7 +534,8 @@  pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
 		list_del(&data->list);
 		if (data->ds_commit_index < 0) {
 			nfs_init_commit(data, NULL, NULL, cinfo);
-			nfs_initiate_commit(NFS_CLIENT(inode), data,
+			nfs_initiate_commit(NFS_SERVER(inode)->nfs_client,
+					    NFS_CLIENT(inode), data,
 					    NFS_PROTO(data->inode),
 					    data->mds_ops, how,
 					    RPC_TASK_CRED_NOREF);
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2329cbb0e446..c9cfa1308264 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1667,7 +1667,9 @@  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,
+int nfs_initiate_commit(struct nfs_client *clp,
+			struct rpc_clnt *rpc_clnt,
+			struct nfs_commit_data *data,
 			const struct nfs_rpc_ops *nfs_ops,
 			const struct rpc_call_ops *call_ops,
 			int how, int flags)
@@ -1681,7 +1683,7 @@  int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data,
 	};
 	struct rpc_task_setup task_setup_data = {
 		.task = &data->task,
-		.rpc_client = clnt,
+		.rpc_client = rpc_clnt,
 		.rpc_message = &msg,
 		.callback_ops = call_ops,
 		.callback_data = data,
@@ -1814,7 +1816,8 @@  nfs_commit_list(struct inode *inode, struct list_head *head, int how,
 	nfs_init_commit(data, head, NULL, cinfo);
 	if (NFS_SERVER(inode)->nfs_client->cl_minorversion)
 		task_flags = RPC_TASK_MOVEABLE;
-	return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode),
+	return nfs_initiate_commit(NFS_SERVER(inode)->nfs_client,
+				   NFS_CLIENT(inode), data, NFS_PROTO(inode),
 				   data->mds_ops, how,
 				   RPC_TASK_CRED_NOREF | task_flags);
 }