[PATCH 2/3] CONFIG_PNFS cleanup: nfs client side

Benny Halevy bhalevy at ns1.bhalevy.com
Wed May 23 14:20:13 EDT 2007


Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/file.c              |    2 ++
 fs/nfs/inode.c             |    8 +++++---
 fs/nfs/nfs4filelayout.c    |    4 ++++
 fs/nfs/nfs4filelayoutdev.c |    4 ++++
 fs/nfs/nfs4proc.c          |   20 ++++++++++++++++++++
 fs/nfs/nfs4xdr.c           |   15 ++++++++++++++-
 fs/nfs/pnfs.c              |    3 +++
 fs/nfs/pnfs.h              |    2 ++
 8 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 3b6584e..191d366 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -67,6 +67,7 @@ const struct file_operations nfs_file_operations = {
 	.check_flags	= nfs_check_flags,
 };
 
+#ifdef CONFIG_PNFS
 const struct file_operations pnfs_file_operations = {
 	.llseek		= nfs_file_llseek,
 	.read           = pnfs_file_read,
@@ -83,6 +84,7 @@ const struct file_operations pnfs_file_operations = {
 	.sendfile	= nfs_file_sendfile,
 	.check_flags	= nfs_check_flags,
 };
+#endif /* CONFIG_PNFS */
 
 struct inode_operations nfs_file_inode_operations = {
 	.permission	= nfs_permission,
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 3f45895..97e0421 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1072,8 +1072,10 @@ void nfs4_clear_inode(struct inode *inode)
 	/* First call standard NFS clear_inode() code */
 	nfs_clear_inode(inode);
 
+#ifdef CONFIG_PNFS
 	/* Return the layout and free it if this inode has a cached layout */
 	pnfs_return_layout(inode);
+#endif
 
 	/* Now clear out any remaining state */
 	while (!list_empty(&nfsi->open_states)) {
@@ -1196,7 +1198,7 @@ static int __init init_nfs_fs(void)
 	if (err)
 		goto out0;
 
-#if defined(CONFIG_NFS_V4)
+#ifdef CONFIG_PNFS
 	err = pnfs_initialize();
 	if (err)
                 goto out00;
@@ -1212,7 +1214,7 @@ out:
 #ifdef CONFIG_PROC_FS
 	rpc_proc_unregister("nfs");
 #endif
-#if defined(CONFIG_NFS_V4) /* XXXX CONFIG_PNFS */
+#ifdef CONFIG_PNFS
 out00:
 	pnfs_uninitialize();
 #endif
@@ -1231,7 +1233,7 @@ out4:
 
 static void __exit exit_nfs_fs(void)
 {
-#if defined(CONFIG_NFS_V4) /* XXX CONFIG_PNFS */
+#ifdef CONFIG_PNFS
 	pnfs_uninitialize();
 #endif
 	nfs_destroy_directcache();
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 1e6b4ba..3153249 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -53,6 +53,8 @@
 #include "nfs4filelayout.h"
 #include "nfs4_fs.h"
 
+#ifdef CONFIG_PNFS
+
 #define NFSDBG_FACILITY         NFSDBG_FILELAYOUT
 
 MODULE_LICENSE("GPL");
@@ -683,3 +685,5 @@ static void __exit nfs4filelayout_exit(void)
 
 module_init(nfs4filelayout_init);
 module_exit(nfs4filelayout_exit);
+
+#endif /* CONFIG_PNFS */
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 8861f4f..7f30b09 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -47,6 +47,8 @@
 
 #include <asm/div64.h>
 
+#ifdef CONFIG_PNFS
+
 #include "nfs4filelayout.h"
 #include "nfs4_fs.h"
 
@@ -474,3 +476,5 @@ nfs4_pnfs_device_put(struct nfs_server *server, struct nfs4_pnfs_dev_hlist *hlis
 	server->rpc_ops->put_client(dev->clp);
 	atomic_dec(&dev->count);
 }
+
+#endif /* CONFIG_PNFS */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 574464b..59ec57a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2007,6 +2007,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
 	return status;
 }
 
+#ifdef CONFIG_PNFS
 /*
  * Return layout before issueing a setattr
  */
@@ -2033,6 +2034,7 @@ pnfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
 
 	return nfs4_proc_setattr(dentry, fattr, sattr);
 }
+#endif /* CONFIG_PNFS */
 
 static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name,
 		struct nfs_fh *fhandle, struct nfs_fattr *fattr)
@@ -2290,6 +2292,7 @@ static int _nfs4_proc_read(struct nfs_read_data *rdata, struct rpc_clnt *clnt, s
 	return status;
 }
 
+#ifdef CONFIG_PNFS
 static int nfs4_proc_pnfs_layoutget(struct nfs4_pnfs_layoutget* layout)
 {
 	struct inode* ino = layout->args->inode;
@@ -2472,6 +2475,7 @@ int nfs4_pnfs_getdeviceinfo(struct nfs_server *server,
 
 	return err;
 }
+#endif /* CONFIG_PNFS */
 
 static int nfs4_proc_read(struct nfs_read_data *rdata)
 {
@@ -2486,6 +2490,7 @@ static int nfs4_proc_read(struct nfs_read_data *rdata)
 	return err;
 }
 
+#ifdef CONFIG_PNFS
 static int pnfs4_proc_read(struct nfs_read_data *rdata)
 {
 	struct nfs4_exception exception = { };
@@ -2514,6 +2519,7 @@ static int pnfs4_proc_read(struct nfs_read_data *rdata)
 	} while (exception.retry);
 	return err;
 }
+#endif /* CONFIG_PNFS */
 
 static int _nfs4_proc_write(struct nfs_write_data *wdata, struct rpc_clnt *clnt)
 {
@@ -2572,6 +2578,7 @@ static int nfs4_proc_write(struct nfs_write_data *wdata)
 	return err;
 }
 
+#ifdef CONFIG_PNFS
 static int _pnfs4_proc_write(struct nfs_write_data *wdata, struct rpc_clnt *clnt, struct nfs4_session *session)
 {
 	int rpcflags = wdata->flags;
@@ -2683,6 +2690,7 @@ static int pnfs_proc_layoutcommit(struct pnfs_layoutcommit_data *cdata)
 	} while (exception.retry);
 	return err;
 }
+#endif /* CONFIG_PNFS */
 
 static int _nfs4_proc_commit(struct nfs_write_data *cdata)
 {
@@ -3521,6 +3529,7 @@ out:
 	return 0;
 }
 
+#ifdef CONFIG_PNFS
 /*
  * We know:
  *	the superblock supports pnfs.
@@ -3544,6 +3553,7 @@ static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
 			data->res.minorversion_info, task->tk_status);
 	return 0;
 }
+#endif /* CONFIG_PNFS */
 
 static void nfs4_proc_read_setup(struct nfs_read_data *data)
 {
@@ -3609,6 +3619,7 @@ out:
 	return ret;
 }
 
+#ifdef CONFIG_PNFS
 static int pnfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
 {
 	struct inode *inode = data->inode;
@@ -3636,6 +3647,7 @@ out:
 
 	return ret;
 }
+#endif /* CONFIG_PNFS */
 
 static void nfs4_proc_write_setup(struct nfs_write_data *data, int how)
 {
@@ -3674,6 +3686,7 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, int how)
 	rpc_call_setup(&data->task, &msg, 0);
 }
 
+#ifdef CONFIG_PNFS
 static void pnfs4_proc_write_setup(struct nfs_write_data *data, int how)
 {
 	struct rpc_message msg = {
@@ -3724,6 +3737,7 @@ static void pnfs4_proc_write_setup(struct nfs_write_data *data, int how)
 	/* Finalize the task. */
 	rpc_call_setup(&data->task, &msg, 0);
 }
+#endif /* CONFIG_PNFS */
 
 static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
 {
@@ -3748,6 +3762,7 @@ out:
 	return ret;
 }
 
+#ifdef CONFIG_PNFS
 static int pnfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
 {
 	struct inode *inode = data->inode;
@@ -3795,6 +3810,7 @@ nfs4_proc_pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data* data)
 
 	rpc_call_setup(task, &msg, 0);
 }
+#endif /* CONFIG_PNFS */
 
 static void nfs4_proc_commit_setup(struct nfs_write_data *data, int how)
 {
@@ -3824,6 +3840,7 @@ static void nfs4_proc_commit_setup(struct nfs_write_data *data, int how)
 	rpc_call_setup(&data->task, &msg, 0);
 }
 
+#ifdef CONFIG_PNFS
 static void pnfs4_proc_commit_setup(struct nfs_write_data *data, int how)
 {
 	struct rpc_message msg = {
@@ -3863,6 +3880,7 @@ static void pnfs4_proc_commit_setup(struct nfs_write_data *data, int how)
 
 	rpc_call_setup(&data->task, &msg, 0);
 }
+#endif /* CONFIG_PNFS */
 
 /*
  * nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special
@@ -5859,6 +5877,7 @@ struct nfs_rpc_ops	nfs_v41_clientops = {
         .get_client     = nfs4_get_client,
 };
 
+#ifdef CONFIG_PNFS
 struct nfs_rpc_ops	pnfs_v4_clientops = {
 	.version	= 4,			/* protocol version */
 	.dentry_ops	= &nfs4_dentry_operations,
@@ -5916,6 +5935,7 @@ struct nfs_rpc_ops	pnfs_v4_clientops = {
         .get_client     = nfs4_get_client,
         .put_client     = nfs4_put_client,
 };
+#endif /* CONFIG_PNFS */
 
 struct nfs_rpc_ops *nfsv4_minorversion_clientops[] = {
 	&nfs_v40_clientops,
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index b50f802..a75e815 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -162,6 +162,7 @@ static int nfs_stat_to_errno(int);
 #define encode_destroy_session_maxsz    (op_encode_hdr_maxsz + 4)
 #define decode_destroy_session_maxsz    (op_decode_hdr_maxsz)
 
+#ifdef CONFIG_PNFS
 #define encode_pnfs_layoutget_sz (13 + op_encode_hdr_maxsz)
 #define decode_pnfs_layoutget_maxsz (8 + op_decode_hdr_maxsz)
 #define encode_pnfs_layoutcommit_sz (18 + PNFS_LAYOUT_MAXSIZE + \
@@ -176,6 +177,7 @@ static int nfs_stat_to_errno(int);
 #define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 2)
 #define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + 3 + \
                                     NFS4_PNFS_DEV_MAXSIZE)
+#endif /* CONFIG_PNFS */
 
 
 #define NFS4_enc_compound_sz	(1024)  /* XXX: large enough? */
@@ -544,6 +546,7 @@ static int nfs_stat_to_errno(int);
 					encode_destroy_session_maxsz)
 #define NFS4_dec_destroy_session_sz    (compound_decode_hdr_maxsz + \
 					decode_destroy_session_maxsz)
+#ifdef CONFIG_PNFS
 #define NFS4_enc_pnfs_layoutget_sz (compound_encode_hdr_maxsz + \
 				    encode_sequence_maxsz +\
                                     encode_putfh_maxsz +        \
@@ -594,6 +597,7 @@ static int nfs_stat_to_errno(int);
 				decode_sequence_maxsz + \
                                 decode_putfh_maxsz + \
                                 op_decode_hdr_maxsz + 4)
+#endif /* CONFIG_PNFS */
 #define NFS4_enc_get_lease_time_sz (compound_encode_hdr_maxsz + \
 					encode_sequence_maxsz +\
 					encode_putrootfh_maxsz + \
@@ -1583,6 +1587,7 @@ static int encode_sequence(struct xdr_stream *xdr, struct nfs41_sequence_args *a
 	return 0;
 }
 
+#ifdef CONFIG_PNFS
 /* DH:  Encode request to get information for a list of devices.
 */
 static int encode_getdevicelist(struct xdr_stream *xdr, const struct nfs4_pnfs_getdevicelist_arg *args)
@@ -1700,7 +1705,7 @@ static int encode_pnfs_layoutreturn(struct xdr_stream *xdr, const struct nfs4_pn
         }
         return 0;
 }
-
+#endif /* CONFIG_PNFS */
 
 /*
  * END OF "GENERIC" ENCODE ROUTINES.
@@ -4891,6 +4896,7 @@ static int decode_delegreturn(struct xdr_stream *xdr)
 	return decode_op_hdr(xdr, OP_DELEGRETURN);
 }
 
+#ifdef CONFIG_PNFS
 /* Decode getdevicelist results for pNFS.
  * TODO: Need to match this xdr with the server.
  */
@@ -4973,6 +4979,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
 
         return 0;
 }
+#endif /* CONFIG_PNFS */
 
 static int decode_sequence(struct xdr_stream *xdr, struct nfs41_sequence_res *res)
 {
@@ -5157,6 +5164,7 @@ static int nfs41_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, uint32_t *p, str
 	return nfs4_xdr_dec_open_downgrade(res, &xdr);
 }
 
+#ifdef CONFIG_PNFS
 static int decode_pnfs_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_pnfs_layoutget_res *res)
 {
         uint32_t *p;
@@ -5214,6 +5222,7 @@ static int decode_pnfs_layoutreturn(struct xdr_stream *xdr)
 {
         return decode_op_hdr(xdr, OP_LAYOUTRETURN);
 }
+#endif /* CONFIG_PNFS */
 
 /*
  * END OF "GENERIC" DECODE ROUTINES.
@@ -6877,6 +6886,7 @@ static int nfs41_xdr_dec_fs_locations(struct rpc_rqst *req, uint32_t *p, struct
 	return nfs4_xdr_dec_fs_locations(res, &xdr);
 }
 
+#ifdef CONFIG_PNFS
 /*
  *  Encode LAYOUTGET request
  */
@@ -7162,6 +7172,7 @@ static int nfs41_xdr_dec_pnfs_write(struct rpc_rqst *rqstp, uint32_t *p, struct
 out:
 	return status;
 }
+#endif /* CONFIG_PNFS */
 
 
 uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus)
@@ -7386,12 +7397,14 @@ struct rpc_procinfo	nfs41_procedures[] = {
   PROC(CREATE_SESSION,  enc_create_session, dec_create_session, 1),
   PROC(SEQUENCE,        enc_sequence, dec_sequence, 1),
   PROC(DESTROY_SESSION,        enc_destroy_session, dec_destroy_session, 1),
+#ifdef CONFIG_PNFS
   PROC(PNFS_LAYOUTGET,  enc_pnfs_layoutget,     dec_pnfs_layoutget, 1),
   PROC(PNFS_LAYOUTCOMMIT,       enc_pnfs_layoutcommit,  dec_pnfs_layoutcommit, 1),
   PROC(PNFS_LAYOUTRETURN,       enc_pnfs_layoutreturn,  dec_pnfs_layoutreturn, 1),
   PROC(PNFS_GETDEVICELIST,      enc_pnfs_getdevicelist, dec_pnfs_getdevicelist, 1),
   PROC(PNFS_GETDEVICEINFO,      enc_pnfs_getdeviceinfo, dec_pnfs_getdeviceinfo, 1),
   PROC(PNFS_WRITE,              enc_pnfs_write, dec_pnfs_write, 1),
+#endif /* CONFIG_PNFS */
   PROC(GET_LEASE_TIME,          enc_get_lease_time, dec_get_lease_time, 1),
 };
 
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index b2d0d45..773ec96 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -48,6 +48,7 @@
 #include "nfs4_fs.h"
 #include "pnfs.h"
 
+#ifdef CONFIG_PNFS
 #define NFSDBG_FACILITY		NFSDBG_PNFS
 
 #define MIN_POOL_LC		(4)
@@ -1512,3 +1513,5 @@ pnfs_wpages(struct inode *inode)
 
 EXPORT_SYMBOL(pnfs_unregister_layoutdriver);
 EXPORT_SYMBOL(pnfs_register_layoutdriver);
+
+#endif /* CONFIG_PNFS */
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 6530048..37d2baf 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -12,6 +12,7 @@
 #ifndef FS_NFS_PNFS_H
 #define FS_NFS_PNFS_H
 
+#ifdef CONFIG_PNFS
 int virtual_update_layout(struct inode* ino, struct nfs_open_context* ctx,
 	size_t count, loff_t pos, enum pnfs_iomode access_type);
 
@@ -51,5 +52,6 @@ int pnfs_wpages(struct inode *);
 void pnfs_readpage_result_norpc(struct rpc_task *task, void *calldata);
 void pnfs_writeback_done_norpc(struct rpc_task *, void *);
 void pnfs_commit_done_norpc(struct rpc_task *, void *);
+#endif /* CONFIG_PNFS */
 
 #endif /* FS_NFS_PNFS_H */
-- 
1.5.1




More information about the pNFS mailing list