diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-24 06:19:17 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-09-26 16:29:27 -0400 |
commit | 326129d02aea8efa1dfd1a210653a744e7c85239 (patch) | |
tree | 7913c0841ec25ae310f48eb1e41311a208f53373 /fs/nfsd/nfs4callback.c | |
parent | 2faf3b43507556bd80e5274270db1fce1408f4ff (diff) |
nfsd: introduce a generic nfsd4_cb
Add a helper to queue up a callback. CB_NULL has a bit of special casing
because it is special in the specification, but all other new callback
operations will be able to share code with this and a few more changes
to refactor the callback code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 06e07e18ea78..03d9f4f298ec 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -49,12 +49,6 @@ static void nfsd4_mark_cb_fault(struct nfs4_client *, int reason); | |||
49 | 49 | ||
50 | /* Index of predefined Linux callback client operations */ | 50 | /* Index of predefined Linux callback client operations */ |
51 | 51 | ||
52 | enum { | ||
53 | NFSPROC4_CLNT_CB_NULL = 0, | ||
54 | NFSPROC4_CLNT_CB_RECALL, | ||
55 | NFSPROC4_CLNT_CB_SEQUENCE, | ||
56 | }; | ||
57 | |||
58 | #define to_delegation(cb) \ | 52 | #define to_delegation(cb) \ |
59 | container_of(cb, struct nfs4_delegation, dl_recall) | 53 | container_of(cb, struct nfs4_delegation, dl_recall) |
60 | 54 | ||
@@ -749,24 +743,9 @@ static const struct rpc_call_ops nfsd4_cb_probe_ops = { | |||
749 | 743 | ||
750 | static struct workqueue_struct *callback_wq; | 744 | static struct workqueue_struct *callback_wq; |
751 | 745 | ||
752 | static void run_nfsd4_cb(struct nfsd4_callback *cb) | ||
753 | { | ||
754 | queue_work(callback_wq, &cb->cb_work); | ||
755 | } | ||
756 | |||
757 | static void do_probe_callback(struct nfs4_client *clp) | 746 | static void do_probe_callback(struct nfs4_client *clp) |
758 | { | 747 | { |
759 | struct nfsd4_callback *cb = &clp->cl_cb_null; | 748 | return nfsd4_cb(&clp->cl_cb_null, clp, NFSPROC4_CLNT_CB_NULL); |
760 | |||
761 | cb->cb_clp = clp; | ||
762 | |||
763 | cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL]; | ||
764 | cb->cb_msg.rpc_argp = NULL; | ||
765 | cb->cb_msg.rpc_resp = NULL; | ||
766 | |||
767 | cb->cb_ops = &nfsd4_cb_probe_ops; | ||
768 | |||
769 | run_nfsd4_cb(cb); | ||
770 | } | 749 | } |
771 | 750 | ||
772 | /* | 751 | /* |
@@ -1005,7 +984,7 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) | |||
1005 | } | 984 | } |
1006 | /* Yay, the callback channel's back! Restart any callbacks: */ | 985 | /* Yay, the callback channel's back! Restart any callbacks: */ |
1007 | list_for_each_entry(cb, &clp->cl_callbacks, cb_per_client) | 986 | list_for_each_entry(cb, &clp->cl_callbacks, cb_per_client) |
1008 | run_nfsd4_cb(cb); | 987 | queue_work(callback_wq, &cb->cb_work); |
1009 | } | 988 | } |
1010 | 989 | ||
1011 | static void | 990 | static void |
@@ -1046,21 +1025,19 @@ nfsd4_run_cb_recall(struct work_struct *w) | |||
1046 | nfsd4_run_callback_rpc(cb); | 1025 | nfsd4_run_callback_rpc(cb); |
1047 | } | 1026 | } |
1048 | 1027 | ||
1049 | void nfsd4_cb_recall(struct nfs4_delegation *dp) | 1028 | void nfsd4_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, |
1029 | enum nfsd4_cb_op op) | ||
1050 | { | 1030 | { |
1051 | struct nfsd4_callback *cb = &dp->dl_recall; | ||
1052 | struct nfs4_client *clp = dp->dl_stid.sc_client; | ||
1053 | |||
1054 | dp->dl_retries = 1; | ||
1055 | cb->cb_clp = clp; | 1031 | cb->cb_clp = clp; |
1056 | cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL]; | 1032 | cb->cb_msg.rpc_proc = &nfs4_cb_procedures[op]; |
1057 | cb->cb_msg.rpc_argp = cb; | 1033 | cb->cb_msg.rpc_argp = cb; |
1058 | cb->cb_msg.rpc_resp = cb; | 1034 | cb->cb_msg.rpc_resp = cb; |
1059 | 1035 | if (op == NFSPROC4_CLNT_CB_NULL) | |
1060 | cb->cb_ops = &nfsd4_cb_recall_ops; | 1036 | cb->cb_ops = &nfsd4_cb_probe_ops; |
1061 | 1037 | else | |
1038 | cb->cb_ops = &nfsd4_cb_recall_ops; | ||
1062 | INIT_LIST_HEAD(&cb->cb_per_client); | 1039 | INIT_LIST_HEAD(&cb->cb_per_client); |
1063 | cb->cb_done = true; | 1040 | cb->cb_done = true; |
1064 | 1041 | ||
1065 | run_nfsd4_cb(&dp->dl_recall); | 1042 | queue_work(callback_wq, &cb->cb_work); |
1066 | } | 1043 | } |