Write PDUs straight to the wire when the queue is empty

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
master
Ronnie Sahlberg 2022-01-05 07:44:18 +10:00
parent 630a80c056
commit 1716b14104
3 changed files with 11 additions and 4 deletions

View File

@ -581,6 +581,8 @@ int nfs4_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh,
uint64_t count, const void *buf, nfs_cb cb,
void *private_data);
int rpc_write_to_socket(struct rpc_context *rpc);
#ifdef __cplusplus
}
#endif

View File

@ -296,11 +296,16 @@ int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu)
#ifdef HAVE_MULTITHREADING
nfs_mt_mutex_lock(&rpc->rpc_mutex);
#endif /* HAVE_MULTITHREADING */
rpc_enqueue(&rpc->outqueue, pdu);
rpc_enqueue(&rpc->outqueue, pdu);
#ifdef HAVE_MULTITHREADING
nfs_mt_mutex_unlock(&rpc->rpc_mutex);
if (rpc->outqueue.head == pdu) {
nfs_mt_mutex_unlock(&rpc->rpc_mutex);
rpc_write_to_socket(rpc);
} else {
nfs_mt_mutex_unlock(&rpc->rpc_mutex);
}
#endif /* HAVE_MULTITHREADING */
return 0;
}

View File

@ -226,7 +226,7 @@ rpc_which_events(struct rpc_context *rpc)
return events;
}
static int
int
rpc_write_to_socket(struct rpc_context *rpc)
{
int32_t count;