rpc: track the number of pdus in the waitpdu queues
Signed-off-by: Peter Lieven <pl@kamp.de>libnfs-4.0.0-vitalif
parent
25dc54da93
commit
c711c568c1
|
@ -118,6 +118,7 @@ struct rpc_context {
|
|||
struct rpc_queue outqueue;
|
||||
struct sockaddr_storage udp_src;
|
||||
struct rpc_queue waitpdu[HASHES];
|
||||
uint32_t waitpdu_len;
|
||||
|
||||
uint32_t inpos;
|
||||
char rm_buf[4];
|
||||
|
|
|
@ -275,6 +275,7 @@ void rpc_error_all_pdus(struct rpc_context *rpc, const char *error)
|
|||
}
|
||||
q->tail = NULL;
|
||||
}
|
||||
rpc->waitpdu_len = 0;
|
||||
}
|
||||
|
||||
static void rpc_free_fragment(struct rpc_fragment *fragment)
|
||||
|
|
|
@ -239,6 +239,7 @@ int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu)
|
|||
|
||||
hash = rpc_hash_xid(pdu->xid);
|
||||
rpc_enqueue(&rpc->waitpdu[hash], pdu);
|
||||
rpc->waitpdu_len++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -547,6 +548,7 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size)
|
|||
q->tail = prev_pdu;
|
||||
if (prev_pdu != NULL)
|
||||
prev_pdu->next = pdu->next;
|
||||
rpc->waitpdu_len--;
|
||||
}
|
||||
if (rpc_process_reply(rpc, pdu, &zdr) != 0) {
|
||||
rpc_set_error(rpc, "rpc_procdess_reply failed");
|
||||
|
|
11
lib/socket.c
11
lib/socket.c
|
@ -216,6 +216,7 @@ static int rpc_write_to_socket(struct rpc_context *rpc)
|
|||
|
||||
hash = rpc_hash_xid(pdu->xid);
|
||||
rpc_enqueue(&rpc->waitpdu[hash], pdu);
|
||||
rpc->waitpdu_len++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -709,6 +710,7 @@ static int rpc_reconnect_requeue(struct rpc_context *rpc)
|
|||
}
|
||||
rpc_reset_queue(q);
|
||||
}
|
||||
rpc->waitpdu_len = 0;
|
||||
|
||||
if (rpc->auto_reconnect != 0) {
|
||||
rpc->connect_cb = reconnect_cb;
|
||||
|
@ -808,9 +810,8 @@ struct sockaddr *rpc_get_recv_sockaddr(struct rpc_context *rpc)
|
|||
|
||||
int rpc_queue_length(struct rpc_context *rpc)
|
||||
{
|
||||
int i=0;
|
||||
int i = 0;
|
||||
struct rpc_pdu *pdu;
|
||||
unsigned int n;
|
||||
|
||||
assert(rpc->magic == RPC_CONTEXT_MAGIC);
|
||||
|
||||
|
@ -818,12 +819,8 @@ int rpc_queue_length(struct rpc_context *rpc)
|
|||
i++;
|
||||
}
|
||||
|
||||
for (n = 0; n < HASHES; n++) {
|
||||
struct rpc_queue *q = &rpc->waitpdu[n];
|
||||
i += rpc->waitpdu_len;
|
||||
|
||||
for(pdu = q->head; pdu; pdu = pdu->next)
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue