diff options
author | David Howells <dhowells@redhat.com> | 2007-04-26 18:58:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-04-26 18:58:49 -0400 |
commit | c35eccb1f614954b10cba3f74b7c301993b2f42e (patch) | |
tree | 4812a026024ab683944901d9d41d70aac4e45ba8 /fs/afs/cmservice.c | |
parent | b908fe6b2d1294d93b0d0badf6bf4f9a2cd7d729 (diff) |
[AFS]: Implement the CB.InitCallBackState3 operation.
Implement the CB.InitCallBackState3 operation for the fileserver to
call. This reduces the amount of network traffic because if this op
is aborted, the fileserver will then attempt an CB.InitCallBackState
operation.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/afs/cmservice.c')
-rw-r--r-- | fs/afs/cmservice.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index a6af3acf016e..6685f4cbccb3 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c | |||
@@ -20,6 +20,8 @@ struct workqueue_struct *afs_cm_workqueue; | |||
20 | 20 | ||
21 | static int afs_deliver_cb_init_call_back_state(struct afs_call *, | 21 | static int afs_deliver_cb_init_call_back_state(struct afs_call *, |
22 | struct sk_buff *, bool); | 22 | struct sk_buff *, bool); |
23 | static int afs_deliver_cb_init_call_back_state3(struct afs_call *, | ||
24 | struct sk_buff *, bool); | ||
23 | static int afs_deliver_cb_probe(struct afs_call *, struct sk_buff *, bool); | 25 | static int afs_deliver_cb_probe(struct afs_call *, struct sk_buff *, bool); |
24 | static int afs_deliver_cb_callback(struct afs_call *, struct sk_buff *, bool); | 26 | static int afs_deliver_cb_callback(struct afs_call *, struct sk_buff *, bool); |
25 | static int afs_deliver_cb_get_capabilities(struct afs_call *, struct sk_buff *, | 27 | static int afs_deliver_cb_get_capabilities(struct afs_call *, struct sk_buff *, |
@@ -47,6 +49,16 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = { | |||
47 | }; | 49 | }; |
48 | 50 | ||
49 | /* | 51 | /* |
52 | * CB.InitCallBackState3 operation type | ||
53 | */ | ||
54 | static const struct afs_call_type afs_SRXCBInitCallBackState3 = { | ||
55 | .name = "CB.InitCallBackState3", | ||
56 | .deliver = afs_deliver_cb_init_call_back_state3, | ||
57 | .abort_to_error = afs_abort_to_error, | ||
58 | .destructor = afs_cm_destructor, | ||
59 | }; | ||
60 | |||
61 | /* | ||
50 | * CB.Probe operation type | 62 | * CB.Probe operation type |
51 | */ | 63 | */ |
52 | static const struct afs_call_type afs_SRXCBProbe = { | 64 | static const struct afs_call_type afs_SRXCBProbe = { |
@@ -83,6 +95,9 @@ bool afs_cm_incoming_call(struct afs_call *call) | |||
83 | case CBInitCallBackState: | 95 | case CBInitCallBackState: |
84 | call->type = &afs_SRXCBInitCallBackState; | 96 | call->type = &afs_SRXCBInitCallBackState; |
85 | return true; | 97 | return true; |
98 | case CBInitCallBackState3: | ||
99 | call->type = &afs_SRXCBInitCallBackState3; | ||
100 | return true; | ||
86 | case CBProbe: | 101 | case CBProbe: |
87 | call->type = &afs_SRXCBProbe; | 102 | call->type = &afs_SRXCBProbe; |
88 | return true; | 103 | return true; |
@@ -312,6 +327,37 @@ static int afs_deliver_cb_init_call_back_state(struct afs_call *call, | |||
312 | } | 327 | } |
313 | 328 | ||
314 | /* | 329 | /* |
330 | * deliver request data to a CB.InitCallBackState3 call | ||
331 | */ | ||
332 | static int afs_deliver_cb_init_call_back_state3(struct afs_call *call, | ||
333 | struct sk_buff *skb, | ||
334 | bool last) | ||
335 | { | ||
336 | struct afs_server *server; | ||
337 | struct in_addr addr; | ||
338 | |||
339 | _enter(",{%u},%d", skb->len, last); | ||
340 | |||
341 | if (!last) | ||
342 | return 0; | ||
343 | |||
344 | /* no unmarshalling required */ | ||
345 | call->state = AFS_CALL_REPLYING; | ||
346 | |||
347 | /* we'll need the file server record as that tells us which set of | ||
348 | * vnodes to operate upon */ | ||
349 | memcpy(&addr, &ip_hdr(skb)->saddr, 4); | ||
350 | server = afs_find_server(&addr); | ||
351 | if (!server) | ||
352 | return -ENOTCONN; | ||
353 | call->server = server; | ||
354 | |||
355 | INIT_WORK(&call->work, SRXAFSCB_InitCallBackState); | ||
356 | schedule_work(&call->work); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | /* | ||
315 | * allow the fileserver to see if the cache manager is still alive | 361 | * allow the fileserver to see if the cache manager is still alive |
316 | */ | 362 | */ |
317 | static void SRXAFSCB_Probe(struct work_struct *work) | 363 | static void SRXAFSCB_Probe(struct work_struct *work) |