[pnfs] [PATCH 04/29] nfs41: nfs41_validate_seq_args change

Benny Halevy bhalevy at panasas.com
Fri Dec 28 03:44:19 EST 2007


From: Andy Adamson <andros at umich.edu>

Replace struct nfs_server with struct nfs4_session so that
data server sessions can be used.

The 2.6.24 sessions port moved the sessions bookeeping from the 2.6.18.3
include/linux/nfs4_fs.h: struct nfs_client to include/linux/nfs_fs_sb.h:
struct nfs_server. This makes sense for a the  2.6.24 non-pNFS NFSv4.1
sessions where the struct nfs_client holds the nfsv4.0 open, lock, and
delegation state and the struct nfs_server holds the connection information
for a mount point.

It does not make sense for the pNFS filelayout data servers which are not
mounted, and use the MDS struct nfs_server for all bookkeeping.

The filelayout data servers use struct nfs_client to reference the
struct nfs4_session.

The 2.6.18.3 sessions code placed two new calls in each rpc for NFSv4.1
rpc_ops->setup_sequence and rpc_ops->sequence_done.
The 2.6.24 sessions code does this in much cleaner way: using the rpc layer
rpc_call_ops rpc_call_prepare, and rpc_call_done.

This patch re factors the nfs4_server inteface to the rpc_call_ops:rpc_call_prepare function nfs41_validate_seq_args() to use struct nfs4_sessions so that
the filelayout data server struct nfs_client->cl_ds_session and the
non-pnfs (or MDS) struct nfs_server->session can both be serviced.

This new interface will be use in subsequent patches that implement the
filelayout I/O

Signed-off-by: Andy Adamson<andros at umich.edu>
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/nfs4proc.c       |    4 ++--
 fs/nfs/read.c           |    5 +++--
 fs/nfs/unlink.c         |    4 ++--
 fs/nfs/write.c          |    5 +++--
 include/linux/nfs_xdr.h |    2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e6d406d..cd90bf8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -388,13 +388,13 @@ static int nfs41_setup_sequence(struct nfs4_session *session,
 	return 0;
 }
 
-static int nfs41_validate_seq_args(struct nfs_server *server,
+static int nfs41_validate_seq_args(struct nfs4_session *session,
 					void *args,
 					void *res,
 					int cache_this,
 					struct rpc_task *task)
 {
-	return nfs41_setup_sequence(server->session,
+	return nfs41_setup_sequence(session,
 					args, res,
 					cache_this, task);
 }
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 42d8a5c..3034651 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -429,12 +429,13 @@ void nfs_read_validate(struct rpc_task *task, void *calldata)
 {
 	struct nfs_read_data *data = calldata;
 	struct nfs_server *server = data->args.server;
-	int (*setup_sequence)(struct nfs_server *,
+	struct nfs4_session *session = server->session;
+	int (*setup_sequence)(struct nfs4_session *,
 				void *, void *, int, struct rpc_task *);
 
 	setup_sequence = server->nfs_client->rpc_ops->validate_sequence_args;
 
-	if (!setup_sequence || !setup_sequence(server,
+	if (!setup_sequence || !setup_sequence(session,
 						&data->args.seq_args,
 						&data->res.seq_res,
 						0, task))
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 96780d5..d1b4773 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -121,12 +121,12 @@ void nfs_unlink_validate(struct rpc_task *task, void *calldata)
 {
 	struct nfs_unlinkdata *data = calldata;
 	struct nfs_server *server = NFS_SERVER(data->dir);
-	int (*setup_sequence)(struct nfs_server *,
+	int (*setup_sequence)(struct nfs4_session *,
 				void *, void *, int, struct rpc_task *);
 
 	setup_sequence = NFS_PROTO(data->dir)->validate_sequence_args;
 
-	if (!setup_sequence || !setup_sequence(server,
+	if (!setup_sequence || !setup_sequence(server->session,
 						&data->args.seq_args,
 						&data->res.seq_res,
 						1, task))
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 6512e86..22cacde 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1045,12 +1045,13 @@ void nfs_write_validate(struct rpc_task *task, void *calldata)
 {
 	struct nfs_write_data *data = calldata;
 	struct nfs_server *server = NFS_SERVER(data->inode);
-	int (*setup_sequence)(struct nfs_server *,
+	struct nfs4_session *session = server->session;
+	int (*setup_sequence)(struct nfs4_session *,
 				void *, void *, int, struct rpc_task *);
 
 	setup_sequence = NFS_PROTO(data->inode)->validate_sequence_args;
 
-	if (!setup_sequence || !setup_sequence(server,
+	if (!setup_sequence || !setup_sequence(session,
 						&data->args.seq_args,
 						&data->res.seq_res,
 						1, task))
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index e199a47..bccc4bd 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1156,7 +1156,7 @@ struct nfs_rpc_ops {
 	int	(*file_release) (struct inode *, struct file *);
 	int	(*lock)(struct file *, int, struct file_lock *);
 	void	(*clear_acl_cache)(struct inode *);
-	int 	(*validate_sequence_args)(struct nfs_server *,
+	int	(*validate_sequence_args)(struct nfs4_session *,
 						void *args,
 						void *res,
 						int,
-- 
1.5.3.3



More information about the pNFS mailing list