-
-/* ptl_handled_rpc() should be called by the sleeping process once
- * it finishes processing an event. This ensures the ref count is
- * decremented and that the rpc ring buffer cycles properly.
- */
-int ptl_handled_rpc(struct ptlrpc_service *service, void *start)
-{
- int index;
-
- spin_lock(&service->srv_lock);
- for (index = 0; index < service->srv_ring_length; index++)
- if (service->srv_buf[index] == start)
- break;
-
- if (index == service->srv_ring_length)
- LBUG();
-
- CDEBUG(D_INFO, "MD index=%d Ref Count=%d\n", index,
- service->srv_ref_count[index]);
- service->srv_ref_count[index]--;
-
- if (service->srv_ref_count[index] < 0)
- LBUG();
-
- if (service->srv_ref_count[index] == 0 &&
- !ptl_is_valid_handle(&(service->srv_me_h[index]))) {
- CDEBUG(D_NET, "relinking %d\n", index);
- ptlrpc_link_svc_me(service, index);
- }
-
- spin_unlock(&service->srv_lock);
- return 0;
-}