[pnfs] [PATCH 03/10] pnfs: Add args to try_to_commit.

Dean Hildebrand seattleplus at gmail.com
Tue Jul 8 17:53:59 EDT 2008


This fixes a problem where nfs code was
using a pnfs only element of nfs_write_data.
In addition, it aligns try_to_commit
with try_to_write signature.

Signed-off-by: Dean Hildebrand <dhildeb at us.ibm.com>
---
 fs/nfs/pnfs.c  |    5 ++++-
 fs/nfs/pnfs.h  |   13 +++++++++----
 fs/nfs/write.c |    4 +---
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 1c79a31..96cf2e0 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1712,7 +1712,8 @@ int _pnfs_try_to_write_data(struct nfs_write_data *data,
 	}
 }
 
-int _pnfs_try_to_commit(struct nfs_write_data *data)
+int _pnfs_try_to_commit(struct nfs_write_data *data,
+			const struct rpc_call_ops *call_ops, int how)
 {
 	struct inode *inode = data->inode;
 	int status;
@@ -1723,6 +1724,8 @@ int _pnfs_try_to_commit(struct nfs_write_data *data)
 	} else {
 		/* data->call_ops and data->how set in nfs_commit_rpcsetup */
 		dprintk("%s: Utilizing pNFS I/O\n", __func__);
+		data->pdata.call_ops = call_ops;
+		data->pdata.how = how;
 		status = pnfs_commit(data, data->pdata.how);
 		return status;
 	}
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index e9e9032..340ebb3 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -49,7 +49,8 @@ void pnfs_need_layoutcommit(struct nfs_inode *nfsi, struct nfs_open_context *ctx
 unsigned int pnfs_getiosize(struct nfs_server *server);
 void pnfs_set_ds_iosize(struct nfs_server *server);
 int pnfs_commit(struct nfs_write_data *data, int sync);
-int _pnfs_try_to_commit(struct nfs_write_data *);
+int _pnfs_try_to_commit(struct nfs_write_data *data,
+			const struct rpc_call_ops *call_ops, int how);
 void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, struct nfs_open_context *, struct list_head *, size_t *);
 void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *);
 void pnfs_update_layout_commit(struct inode *, struct list_head *, pgoff_t, unsigned int);
@@ -108,7 +109,9 @@ static inline int pnfs_try_to_write_data(struct nfs_write_data *data,
 	return 1;
 }
 
-static inline int pnfs_try_to_commit(struct nfs_write_data *data)
+static inline int pnfs_try_to_commit(struct nfs_write_data *data,
+				     const struct rpc_call_ops *call_ops,
+				     int how)
 {
 	struct inode *inode = data->inode;
 	struct nfs_server *nfss = NFS_SERVER(inode);
@@ -118,7 +121,7 @@ static inline int pnfs_try_to_commit(struct nfs_write_data *data)
 	   the commit method MUST be defined by the LD */
 	/* FIXME: write_pagelist should probably be mandated */
 	if (PNFS_EXISTS_LDIO_OP(nfss, write_pagelist))
-		return _pnfs_try_to_commit(data);
+		return _pnfs_try_to_commit(data, call_ops, how);
 
 	return 1;
 }
@@ -214,7 +217,9 @@ static inline int pnfs_try_to_write_data(struct nfs_write_data *data,
 	return 1;
 }
 
-static inline int pnfs_try_to_commit(struct nfs_write_data *data)
+static inline int pnfs_try_to_commit(struct nfs_write_data *data,
+				     const struct rpc_call_ops *call_ops,
+				     int how)
 {
 	return 1;
 }
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index ff97ccf..fbffb57 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1312,9 +1312,7 @@ static int nfs_commit_rpcsetup(struct list_head *head,
 	nfs_fattr_init(&data->fattr);
 
 	data->args.context = first->wb_context;  /* used by commit done */
-	data->pdata.call_ops = &nfs_commit_ops;
-	data->pdata.how = how;
-	ret = pnfs_try_to_commit(data);
+	ret = pnfs_try_to_commit(data, &nfs_commit_ops, how);
 	if (ret <= 0)
 		return ret;
 
-- 
1.5.3.3



More information about the pNFS mailing list