aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2010-05-31 18:21:37 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-10-01 19:29:43 -0400
commitfb003923263c3f0cb02adbd56a22fe16ef5c0e77 (patch)
tree99eefb1d045250e1b871b92660d0e0f084aa67d3
parentcee277d92495a9ea49a6137fe7005d7c76b31b5b (diff)
nfsd4: remove separate cb_args struct
I don't see the point of the separate struct. It seems to just be getting in the way. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/nfs4callback.c45
-rw-r--r--fs/nfsd/state.h10
2 files changed, 25 insertions, 30 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 26fa878005cc..07c3be6eea64 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -247,7 +247,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp,
247} 247}
248 248
249static void 249static void
250encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *args, 250encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_callback *cb,
251 struct nfs4_cb_compound_hdr *hdr) 251 struct nfs4_cb_compound_hdr *hdr)
252{ 252{
253 __be32 *p; 253 __be32 *p;
@@ -258,8 +258,8 @@ encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *args,
258 RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20); 258 RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20);
259 259
260 WRITE32(OP_CB_SEQUENCE); 260 WRITE32(OP_CB_SEQUENCE);
261 WRITEMEM(args->args_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN); 261 WRITEMEM(cb->cb_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN);
262 WRITE32(args->args_clp->cl_cb_seq_nr); 262 WRITE32(cb->cb_clp->cl_cb_seq_nr);
263 WRITE32(0); /* slotid, always 0 */ 263 WRITE32(0); /* slotid, always 0 */
264 WRITE32(0); /* highest slotid always 0 */ 264 WRITE32(0); /* highest slotid always 0 */
265 WRITE32(0); /* cachethis always 0 */ 265 WRITE32(0); /* cachethis always 0 */
@@ -279,18 +279,18 @@ nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p)
279 279
280static int 280static int
281nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, 281nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p,
282 struct nfsd4_cb_args *rpc_args) 282 struct nfsd4_callback *cb)
283{ 283{
284 struct xdr_stream xdr; 284 struct xdr_stream xdr;
285 struct nfs4_delegation *args = rpc_args->args_op; 285 struct nfs4_delegation *args = cb->cb_op;
286 struct nfs4_cb_compound_hdr hdr = { 286 struct nfs4_cb_compound_hdr hdr = {
287 .ident = args->dl_ident, 287 .ident = args->dl_ident,
288 .minorversion = rpc_args->args_minorversion, 288 .minorversion = cb->cb_minorversion,
289 }; 289 };
290 290
291 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 291 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
292 encode_cb_compound_hdr(&xdr, &hdr); 292 encode_cb_compound_hdr(&xdr, &hdr);
293 encode_cb_sequence(&xdr, rpc_args, &hdr); 293 encode_cb_sequence(&xdr, cb, &hdr);
294 encode_cb_recall(&xdr, args, &hdr); 294 encode_cb_recall(&xdr, args, &hdr);
295 encode_cb_nops(&hdr); 295 encode_cb_nops(&hdr);
296 return 0; 296 return 0;
@@ -338,7 +338,7 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
338 * with a single slot. 338 * with a single slot.
339 */ 339 */
340static int 340static int
341decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *res, 341decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_callback *cb,
342 struct rpc_rqst *rqstp) 342 struct rpc_rqst *rqstp)
343{ 343{
344 struct nfs4_sessionid id; 344 struct nfs4_sessionid id;
@@ -346,7 +346,7 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *res,
346 u32 dummy; 346 u32 dummy;
347 __be32 *p; 347 __be32 *p;
348 348
349 if (res->args_minorversion == 0) 349 if (cb->cb_minorversion == 0)
350 return 0; 350 return 0;
351 351
352 status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE); 352 status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE);
@@ -362,13 +362,13 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *res,
362 READ_BUF(NFS4_MAX_SESSIONID_LEN + 16); 362 READ_BUF(NFS4_MAX_SESSIONID_LEN + 16);
363 memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN); 363 memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
364 p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN); 364 p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN);
365 if (memcmp(id.data, res->args_clp->cl_sessionid.data, 365 if (memcmp(id.data, cb->cb_clp->cl_sessionid.data,
366 NFS4_MAX_SESSIONID_LEN)) { 366 NFS4_MAX_SESSIONID_LEN)) {
367 dprintk("%s Invalid session id\n", __func__); 367 dprintk("%s Invalid session id\n", __func__);
368 goto out; 368 goto out;
369 } 369 }
370 READ32(dummy); 370 READ32(dummy);
371 if (dummy != res->args_clp->cl_cb_seq_nr) { 371 if (dummy != cb->cb_clp->cl_cb_seq_nr) {
372 dprintk("%s Invalid sequence number\n", __func__); 372 dprintk("%s Invalid sequence number\n", __func__);
373 goto out; 373 goto out;
374 } 374 }
@@ -392,7 +392,7 @@ nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
392 392
393static int 393static int
394nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p, 394nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
395 struct nfsd4_cb_args *args) 395 struct nfsd4_callback *cb)
396{ 396{
397 struct xdr_stream xdr; 397 struct xdr_stream xdr;
398 struct nfs4_cb_compound_hdr hdr; 398 struct nfs4_cb_compound_hdr hdr;
@@ -402,8 +402,8 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
402 status = decode_cb_compound_hdr(&xdr, &hdr); 402 status = decode_cb_compound_hdr(&xdr, &hdr);
403 if (status) 403 if (status)
404 goto out; 404 goto out;
405 if (args) { 405 if (cb) {
406 status = decode_cb_sequence(&xdr, args, rqstp); 406 status = decode_cb_sequence(&xdr, cb, rqstp);
407 if (status) 407 if (status)
408 goto out; 408 goto out;
409 } 409 }
@@ -551,8 +551,8 @@ void do_probe_callback(struct nfs4_client *clp)
551{ 551{
552 struct nfsd4_callback *cb = &clp->cl_cb_null; 552 struct nfsd4_callback *cb = &clp->cl_cb_null;
553 553
554 cb->cb_args.args_op = NULL; 554 cb->cb_op = NULL;
555 cb->cb_args.args_clp = clp; 555 cb->cb_clp = clp;
556 556
557 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL]; 557 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL];
558 cb->cb_msg.rpc_argp = NULL; 558 cb->cb_msg.rpc_argp = NULL;
@@ -615,11 +615,10 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
615 struct nfsd4_callback *cb = calldata; 615 struct nfsd4_callback *cb = calldata;
616 struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall); 616 struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
617 struct nfs4_client *clp = dp->dl_client; 617 struct nfs4_client *clp = dp->dl_client;
618 struct nfsd4_cb_args *args = task->tk_msg.rpc_argp;
619 u32 minorversion = clp->cl_cb_conn.cb_minorversion; 618 u32 minorversion = clp->cl_cb_conn.cb_minorversion;
620 int status = 0; 619 int status = 0;
621 620
622 args->args_minorversion = minorversion; 621 cb->cb_minorversion = minorversion;
623 if (minorversion) { 622 if (minorversion) {
624 status = nfsd41_cb_setup_sequence(clp, task); 623 status = nfsd41_cb_setup_sequence(clp, task);
625 if (status) { 624 if (status) {
@@ -755,7 +754,7 @@ void nfsd4_release_cb(struct nfsd4_callback *cb)
755void nfsd4_do_callback_rpc(struct work_struct *w) 754void nfsd4_do_callback_rpc(struct work_struct *w)
756{ 755{
757 struct nfsd4_callback *cb = container_of(w, struct nfsd4_callback, cb_work); 756 struct nfsd4_callback *cb = container_of(w, struct nfsd4_callback, cb_work);
758 struct nfs4_client *clp = cb->cb_args.args_clp; 757 struct nfs4_client *clp = cb->cb_clp;
759 struct rpc_clnt *clnt = clp->cl_cb_client; 758 struct rpc_clnt *clnt = clp->cl_cb_client;
760 759
761 if (clnt == NULL) { 760 if (clnt == NULL) {
@@ -771,11 +770,11 @@ void nfsd4_cb_recall(struct nfs4_delegation *dp)
771 struct nfsd4_callback *cb = &dp->dl_recall; 770 struct nfsd4_callback *cb = &dp->dl_recall;
772 771
773 dp->dl_retries = 1; 772 dp->dl_retries = 1;
774 cb->cb_args.args_op = dp; 773 cb->cb_op = dp;
775 cb->cb_args.args_clp = dp->dl_client; 774 cb->cb_clp = dp->dl_client;
776 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL]; 775 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL];
777 cb->cb_msg.rpc_argp = &cb->cb_args; 776 cb->cb_msg.rpc_argp = cb;
778 cb->cb_msg.rpc_resp = &cb->cb_args; 777 cb->cb_msg.rpc_resp = cb;
779 cb->cb_msg.rpc_cred = callback_cred; 778 cb->cb_msg.rpc_cred = callback_cred;
780 779
781 cb->cb_ops = &nfsd4_cb_recall_ops; 780 cb->cb_ops = &nfsd4_cb_recall_ops;
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 19732d531cda..2ece6bee65f7 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -64,14 +64,10 @@ typedef struct {
64 (s)->si_fileid, \ 64 (s)->si_fileid, \
65 (s)->si_generation 65 (s)->si_generation
66 66
67struct nfsd4_cb_args {
68 void *args_op;
69 struct nfs4_client *args_clp;
70 u32 args_minorversion;
71};
72
73struct nfsd4_callback { 67struct nfsd4_callback {
74 struct nfsd4_cb_args cb_args; 68 void *cb_op;
69 struct nfs4_client *cb_clp;
70 u32 cb_minorversion;
75 struct rpc_message cb_msg; 71 struct rpc_message cb_msg;
76 const struct rpc_call_ops *cb_ops; 72 const struct rpc_call_ops *cb_ops;
77 struct work_struct cb_work; 73 struct work_struct cb_work;