diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2010-02-18 11:27:24 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2010-04-02 16:28:11 -0400 |
commit | 227f98d98d2ed7929f41426adc21f57b927354a6 (patch) | |
tree | 8186b54a4f4e0cb5b3a7778f76854b00c7ce43db /fs/nfsd | |
parent | 788e69e548cc8d127b90f0de1f7b7e983d1d587a (diff) |
nfsd4: preallocate nfs4_rpc_args
Instead of allocating this small structure, just include it in the
delegation.
The nfsd4_callback structure isn't really necessary yet, but we plan to
add to it all the information necessary to perform a callback.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 18 | ||||
-rw-r--r-- | fs/nfsd/state.h | 10 |
2 files changed, 13 insertions, 15 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index ed12ad40828b..b99c3f0f1d35 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -78,11 +78,6 @@ enum nfs_cb_opnum4 { | |||
78 | cb_sequence_dec_sz + \ | 78 | cb_sequence_dec_sz + \ |
79 | op_dec_sz) | 79 | op_dec_sz) |
80 | 80 | ||
81 | struct nfs4_rpc_args { | ||
82 | void *args_op; | ||
83 | struct nfsd4_cb_sequence args_seq; | ||
84 | }; | ||
85 | |||
86 | /* | 81 | /* |
87 | * Generic encode routines from fs/nfs/nfs4xdr.c | 82 | * Generic encode routines from fs/nfs/nfs4xdr.c |
88 | */ | 83 | */ |
@@ -676,7 +671,7 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) | |||
676 | break; | 671 | break; |
677 | default: | 672 | default: |
678 | /* success, or error we can't handle */ | 673 | /* success, or error we can't handle */ |
679 | goto done; | 674 | return; |
680 | } | 675 | } |
681 | if (dp->dl_retries--) { | 676 | if (dp->dl_retries--) { |
682 | rpc_delay(task, 2*HZ); | 677 | rpc_delay(task, 2*HZ); |
@@ -687,8 +682,6 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) | |||
687 | atomic_set(&clp->cl_cb_conn.cb_set, 0); | 682 | atomic_set(&clp->cl_cb_conn.cb_set, 0); |
688 | warn_no_callback_path(clp, task->tk_status); | 683 | warn_no_callback_path(clp, task->tk_status); |
689 | } | 684 | } |
690 | done: | ||
691 | kfree(task->tk_msg.rpc_argp); | ||
692 | } | 685 | } |
693 | 686 | ||
694 | static void nfsd4_cb_recall_release(void *calldata) | 687 | static void nfsd4_cb_recall_release(void *calldata) |
@@ -714,24 +707,19 @@ nfsd4_cb_recall(struct nfs4_delegation *dp) | |||
714 | { | 707 | { |
715 | struct nfs4_client *clp = dp->dl_client; | 708 | struct nfs4_client *clp = dp->dl_client; |
716 | struct rpc_clnt *clnt = clp->cl_cb_conn.cb_client; | 709 | struct rpc_clnt *clnt = clp->cl_cb_conn.cb_client; |
717 | struct nfs4_rpc_args *args; | 710 | struct nfs4_rpc_args *args = &dp->dl_recall.cb_args; |
718 | struct rpc_message msg = { | 711 | struct rpc_message msg = { |
719 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], | 712 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], |
720 | .rpc_cred = callback_cred | 713 | .rpc_cred = callback_cred |
721 | }; | 714 | }; |
722 | int status = -ENOMEM; | 715 | int status; |
723 | 716 | ||
724 | args = kzalloc(sizeof(*args), GFP_KERNEL); | ||
725 | if (!args) | ||
726 | goto out; | ||
727 | args->args_op = dp; | 717 | args->args_op = dp; |
728 | msg.rpc_argp = args; | 718 | msg.rpc_argp = args; |
729 | dp->dl_retries = 1; | 719 | dp->dl_retries = 1; |
730 | status = rpc_call_async(clnt, &msg, RPC_TASK_SOFT, | 720 | status = rpc_call_async(clnt, &msg, RPC_TASK_SOFT, |
731 | &nfsd4_cb_recall_ops, dp); | 721 | &nfsd4_cb_recall_ops, dp); |
732 | out: | ||
733 | if (status) { | 722 | if (status) { |
734 | kfree(args); | ||
735 | put_nfs4_client(clp); | 723 | put_nfs4_client(clp); |
736 | nfs4_put_delegation(dp); | 724 | nfs4_put_delegation(dp); |
737 | } | 725 | } |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index fefeae27f25e..b85437982a8d 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -70,6 +70,15 @@ struct nfsd4_cb_sequence { | |||
70 | struct nfs4_client *cbs_clp; | 70 | struct nfs4_client *cbs_clp; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | struct nfs4_rpc_args { | ||
74 | void *args_op; | ||
75 | struct nfsd4_cb_sequence args_seq; | ||
76 | }; | ||
77 | |||
78 | struct nfsd4_callback { | ||
79 | struct nfs4_rpc_args cb_args; | ||
80 | }; | ||
81 | |||
73 | struct nfs4_delegation { | 82 | struct nfs4_delegation { |
74 | struct list_head dl_perfile; | 83 | struct list_head dl_perfile; |
75 | struct list_head dl_perclnt; | 84 | struct list_head dl_perclnt; |
@@ -86,6 +95,7 @@ struct nfs4_delegation { | |||
86 | stateid_t dl_stateid; | 95 | stateid_t dl_stateid; |
87 | struct knfsd_fh dl_fh; | 96 | struct knfsd_fh dl_fh; |
88 | int dl_retries; | 97 | int dl_retries; |
98 | struct nfsd4_callback dl_recall; | ||
89 | }; | 99 | }; |
90 | 100 | ||
91 | /* client delegation callback info */ | 101 | /* client delegation callback info */ |