[PATCH 3/3] CONFIG_PNFS cleanup: nfs server side
Benny Halevy
bhalevy at ns1.bhalevy.com
Wed May 23 14:21:55 EDT 2007
note that if CONFIG_NFSD_V4_1 is defined and CONFIG_PNFS isn't
then all pNFS operations will fail with nfserr_notsupp.
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
fs/nfsd/nfs4callback.c | 10 ++++++++++
fs/nfsd/nfs4proc.c | 6 +++++-
fs/nfsd/nfs4state.c | 8 +++++++-
fs/nfsd/nfs4xdr.c | 19 +++++++++++++++++--
include/linux/nfsd/state.h | 7 +++++++
5 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 5b9f13b..0e7a6be 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -248,6 +248,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec)
return 0;
}
+#ifdef CONFIG_PNFS
static int
encode_cb_layout(struct xdr_stream *xdr, struct nfs4_cb_layout *lr)
{
@@ -281,6 +282,7 @@ encode_cb_layout(struct xdr_stream *xdr, struct nfs4_cb_layout *lr)
}
return 0;
}
+#endif /* CONFIG_PNFS */
static int
nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p)
@@ -306,6 +308,7 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args
return (encode_cb_recall(&xdr, args));
}
+#ifdef CONFIG_PNFS
static int
nfs4_xdr_enc_cb_layout(struct rpc_rqst *req, u32 *p, struct nfs4_cb_layout *args)
{
@@ -321,6 +324,7 @@ nfs4_xdr_enc_cb_layout(struct rpc_rqst *req, u32 *p, struct nfs4_cb_layout *args
return (encode_cb_layout(&xdr, args));
}
+#endif /* CONFIG_PNFS */
static int
decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){
@@ -379,6 +383,7 @@ out:
return status;
}
+#ifdef CONFIG_PNFS
static int
nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp, u32 *p)
{
@@ -394,6 +399,7 @@ nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp, u32 *p)
out:
return status;
}
+#endif /* CONFIG_PNFS */
/*
* RPC procedure tables
@@ -415,7 +421,9 @@ out:
static struct rpc_procinfo nfs4_cb_procedures[] = {
PROC(CB_NULL, NULL, enc_cb_null, dec_cb_null),
PROC(CB_RECALL, COMPOUND, enc_cb_recall, dec_cb_recall),
+#ifdef CONFIG_PNFS
PROC(CB_LAYOUT, COMPOUND, enc_cb_layout, dec_cb_layout),
+#endif
};
static struct rpc_version nfs_cb_version4 = {
@@ -727,6 +735,7 @@ out:
return;
}
+#ifdef CONFIG_PNFS
/*
* called with dp->dl_count inc'ed.
* nfs4_lock_state() may or may not have been called.
@@ -779,3 +788,4 @@ out:
return;
}
+#endif /* CONFIG_PNFS */
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index f28d667..1299676 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -737,6 +737,7 @@ out_kfree:
return status;
}
+#if defined(CONFIG_PNFS)
static int
nfsd4_getdevlist( struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_pnfs_getdevlist *gdlp)
{
@@ -969,6 +970,7 @@ nfsd4_getdevinfo( struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd
out:
return status;
}
+#endif /* defined(CONFIG_PNFS) */
/*
* NULL call.
@@ -1186,6 +1188,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
case OP_RELEASE_LOCKOWNER:
op->status = nfsd4_release_lockowner(rqstp, &op->u.release_lockowner);
break;
+#if defined(CONFIG_NFSD_V4_1)
+#if defined(CONFIG_PNFS)
case OP_GETDEVICELIST:
op->status = nfsd4_getdevlist(rqstp, current_fh, &op->u.pnfs_getdevlist);
break;
@@ -1201,7 +1205,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
case OP_LAYOUTRETURN:
op->status = nfsd4_layoutreturn(rqstp, current_ses, current_fh, &op->u.pnfs_layoutreturn);
break;
-#if defined(CONFIG_NFSD_V4_1)
+#endif
case OP_EXCHANGE_ID:
op->status = nfsd4_exchange_id(rqstp, &op->u.exchange_id);
break;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 90d3171..77dd9c6 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -576,8 +576,10 @@ expire_client(struct nfs4_client *clp)
struct nfs4_stateowner *sop;
struct nfs4_delegation *dp;
struct list_head reaplist;
-#if defined(CONFIG_NFSD_V4_1)
+#if defined(CONFIG_PNFS)
struct nfs4_layout *lp;
+#endif
+#if defined(CONFIG_NFSD_V4_1)
struct nfs41_session *ses;
#endif
@@ -648,7 +650,9 @@ create_client(struct xdr_netobj name, char *recdir) {
INIT_LIST_HEAD(&clp->cl_strhash);
INIT_LIST_HEAD(&clp->cl_openowners);
INIT_LIST_HEAD(&clp->cl_delegations);
+#ifdef CONFIG_PNFS
INIT_LIST_HEAD(&clp->cl_layouts);
+#endif
INIT_LIST_HEAD(&clp->cl_sessions);
INIT_LIST_HEAD(&clp->cl_lru);
out:
@@ -3687,7 +3691,9 @@ nfs4_state_init(void)
for (i = 0; i < CLIENT_HASH_SIZE; i++)
INIT_LIST_HEAD(&reclaim_str_hashtbl[i]);
reclaim_str_hashtbl_size = 0;
+#ifdef CONFIG_PNFS
nfs4_pnfs_state_init();
+#endif
}
static void
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 4386239..25e7a97 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1149,6 +1149,7 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
DECODE_TAIL;
}
+#ifdef CONFIG_PNFS
/* GETDEVICELIST: minorversion1-01.txt
u32 pnfs_layouttype4 layout_type;
u32 count4 maxcount;
@@ -1296,7 +1297,7 @@ nfsd4_decode_layoutreturn(struct nfsd4_compoundargs *argp, struct nfsd4_pnfs_lay
DECODE_TAIL;
}
-
+#endif /* CONFIG_PNFS */
static int
nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
@@ -1476,6 +1477,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
case OP_RELEASE_LOCKOWNER:
op->status = nfsd4_decode_release_lockowner(argp, &op->u.release_lockowner);
break;
+#if defined(CONFIG_NFSD_V4_1)
+#if defined(CONFIG_PNFS)
case OP_GETDEVICELIST:
op->status = nfsd4_decode_getdevlist(argp, &op->u.pnfs_getdevlist);
break;
@@ -1491,7 +1494,15 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
case OP_LAYOUTRETURN:
op->status = nfsd4_decode_layoutreturn(argp, &op->u.pnfs_layoutreturn);
break;
-#if defined(CONFIG_NFSD_V4_1)
+#else
+ case OP_GETDEVICELIST:
+ case OP_GETDEVICEINFO:
+ case OP_LAYOUTGET:
+ case OP_LAYOUTCOMMIT:
+ case OP_LAYOUTRETURN:
+ op->status = nfserr_notsupp;
+ break;
+#endif
case OP_EXCHANGE_ID:
op->status = nfsd4_decode_exchange_id(argp, &op->u.exchange_id);
break;
@@ -2820,6 +2831,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ
}
}
+#ifdef CONFIG_PNFS
static int
nfsd4_encode_devlist_item(struct nfsd4_compoundres *resp, struct nfsd4_pnfs_devlist *dlist, struct export_operations *ex_ops, int lotype)
{
@@ -2993,6 +3005,7 @@ nfsd4_encode_layoutcommit(struct nfsd4_compoundres *resp, int nfserr, struct nfs
}
}
}
+#endif /* CONFIG_PNFS */
void
nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
@@ -3093,6 +3106,7 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
break;
case OP_RELEASE_LOCKOWNER:
break;
+#ifdef CONFIG_PNFS
case OP_GETDEVICELIST:
nfsd4_encode_getdevlist(resp, op->status, &op->u.pnfs_getdevlist);
break;
@@ -3107,6 +3121,7 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
break;
case OP_LAYOUTRETURN:
break;
+#endif /* CONFIG_PNFS */
#if defined(CONFIG_NFSD_V4_1)
case OP_EXCHANGE_ID:
nfsd4_encode_exchange_id(resp, op->status, &op->u.exchange_id);
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 090ebac..2e18620 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -200,7 +200,9 @@ struct nfs4_client {
struct list_head cl_strhash; /* hash by cl_name */
struct list_head cl_openowners;
struct list_head cl_delegations;
+#ifdef CONFIG_PNFS
struct list_head cl_layouts;
+#endif /* CONFIG_PNFS */
struct list_head cl_sessions;
struct list_head cl_lru; /* tail queue */
struct xdr_netobj cl_name; /* id generated by client */
@@ -226,6 +228,7 @@ struct nfs4_client {
#endif
};
+#ifdef CONFIG_PNFS
enum layout_recall_type {
RECALL_FILE = 1,
RECALL_FSID = 2,
@@ -273,6 +276,8 @@ struct nfs4_layout {
#define lo_offset lo_cb_layout.cbl_offset
#define lo_length lo_cb_layout.cbl_length
+#endif /* CONFIG_PNFS */
+
/* struct nfs4_client_reset
* one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl
* upon lease reset, or from upcall to state_daemon (to read in state
@@ -444,7 +449,9 @@ extern void nfs4_free_stateowner(struct kref *kref);
extern void nfsd4_probe_callback(struct nfs4_client *clp);
extern void nfsd41_probe_callback(struct nfs4_client *clp);
extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
+#ifdef CONFIG_PNFS
extern void nfsd4_cb_layout(struct nfs4_cb_layout *lp);
+#endif /* CONFIG_PNFS */
extern void nfs4_put_delegation(struct nfs4_delegation *dp);
extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
extern void nfsd4_init_recdir(char *recdir_name);
--
1.5.1
More information about the pNFS
mailing list