aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-09-24 06:19:16 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-09-26 16:29:26 -0400
commit2faf3b43507556bd80e5274270db1fce1408f4ff (patch)
tree87f1916a7363c2462caf8a7f7449eb2cd1d9eaef
parent341b51df1fef0a39d792fb1c7d7856cf142627ab (diff)
nfsd: remove nfsd4_callback.cb_op
We can always get at the private data by using container_of, no need for a void pointer. Also introduce a little to_delegation helper to avoid opencoding the container_of everywhere. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4callback.c17
-rw-r--r--fs/nfsd/state.h1
2 files changed, 9 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index fc07084e8226..06e07e18ea78 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -55,6 +55,9 @@ enum {
55 NFSPROC4_CLNT_CB_SEQUENCE, 55 NFSPROC4_CLNT_CB_SEQUENCE,
56}; 56};
57 57
58#define to_delegation(cb) \
59 container_of(cb, struct nfs4_delegation, dl_recall)
60
58struct nfs4_cb_compound_hdr { 61struct nfs4_cb_compound_hdr {
59 /* args */ 62 /* args */
60 u32 ident; /* minorversion 0 only */ 63 u32 ident; /* minorversion 0 only */
@@ -494,7 +497,7 @@ static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
494static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr, 497static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
495 const struct nfsd4_callback *cb) 498 const struct nfsd4_callback *cb)
496{ 499{
497 const struct nfs4_delegation *args = cb->cb_op; 500 const struct nfs4_delegation *dp = to_delegation(cb);
498 struct nfs4_cb_compound_hdr hdr = { 501 struct nfs4_cb_compound_hdr hdr = {
499 .ident = cb->cb_clp->cl_cb_ident, 502 .ident = cb->cb_clp->cl_cb_ident,
500 .minorversion = cb->cb_minorversion, 503 .minorversion = cb->cb_minorversion,
@@ -502,7 +505,7 @@ static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
502 505
503 encode_cb_compound4args(xdr, &hdr); 506 encode_cb_compound4args(xdr, &hdr);
504 encode_cb_sequence4args(xdr, cb, &hdr); 507 encode_cb_sequence4args(xdr, cb, &hdr);
505 encode_cb_recall4args(xdr, args, &hdr); 508 encode_cb_recall4args(xdr, dp, &hdr);
506 encode_cb_nops(&hdr); 509 encode_cb_nops(&hdr);
507} 510}
508 511
@@ -755,7 +758,6 @@ static void do_probe_callback(struct nfs4_client *clp)
755{ 758{
756 struct nfsd4_callback *cb = &clp->cl_cb_null; 759 struct nfsd4_callback *cb = &clp->cl_cb_null;
757 760
758 cb->cb_op = NULL;
759 cb->cb_clp = clp; 761 cb->cb_clp = clp;
760 762
761 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL]; 763 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL];
@@ -850,11 +852,10 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
850 } 852 }
851} 853}
852 854
853
854static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) 855static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)
855{ 856{
856 struct nfsd4_callback *cb = calldata; 857 struct nfsd4_callback *cb = calldata;
857 struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall); 858 struct nfs4_delegation *dp = to_delegation(cb);
858 struct nfs4_client *clp = cb->cb_clp; 859 struct nfs4_client *clp = cb->cb_clp;
859 struct rpc_clnt *current_rpc_client = clp->cl_cb_client; 860 struct rpc_clnt *current_rpc_client = clp->cl_cb_client;
860 861
@@ -893,9 +894,10 @@ static void nfsd4_cb_recall_release(void *calldata)
893{ 894{
894 struct nfsd4_callback *cb = calldata; 895 struct nfsd4_callback *cb = calldata;
895 struct nfs4_client *clp = cb->cb_clp; 896 struct nfs4_client *clp = cb->cb_clp;
896 struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
897 897
898 if (cb->cb_done) { 898 if (cb->cb_done) {
899 struct nfs4_delegation *dp = to_delegation(cb);
900
899 spin_lock(&clp->cl_lock); 901 spin_lock(&clp->cl_lock);
900 list_del(&cb->cb_per_client); 902 list_del(&cb->cb_per_client);
901 spin_unlock(&clp->cl_lock); 903 spin_unlock(&clp->cl_lock);
@@ -1040,7 +1042,7 @@ nfsd4_run_cb_recall(struct work_struct *w)
1040 struct nfsd4_callback *cb = container_of(w, struct nfsd4_callback, 1042 struct nfsd4_callback *cb = container_of(w, struct nfsd4_callback,
1041 cb_work); 1043 cb_work);
1042 1044
1043 nfsd4_prepare_cb_recall(cb->cb_op); 1045 nfsd4_prepare_cb_recall(to_delegation(cb));
1044 nfsd4_run_callback_rpc(cb); 1046 nfsd4_run_callback_rpc(cb);
1045} 1047}
1046 1048
@@ -1050,7 +1052,6 @@ void nfsd4_cb_recall(struct nfs4_delegation *dp)
1050 struct nfs4_client *clp = dp->dl_stid.sc_client; 1052 struct nfs4_client *clp = dp->dl_stid.sc_client;
1051 1053
1052 dp->dl_retries = 1; 1054 dp->dl_retries = 1;
1053 cb->cb_op = dp;
1054 cb->cb_clp = clp; 1055 cb->cb_clp = clp;
1055 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL]; 1056 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL];
1056 cb->cb_msg.rpc_argp = cb; 1057 cb->cb_msg.rpc_argp = cb;
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 62a82ab06cf1..57d2db63a1ed 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -62,7 +62,6 @@ typedef struct {
62 (s)->si_generation 62 (s)->si_generation
63 63
64struct nfsd4_callback { 64struct nfsd4_callback {
65 void *cb_op;
66 struct nfs4_client *cb_clp; 65 struct nfs4_client *cb_clp;
67 struct list_head cb_per_client; 66 struct list_head cb_per_client;
68 u32 cb_minorversion; 67 u32 cb_minorversion;