X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=nfs3%2Frpc.c;h=f753bd14a81f5e2800a06dfd173f2cccdf38460b;hb=1fc8461814b84ef7eaa3436c1fd826e8c63c1537;hp=dbe0a64b67b20f992b14bdb5a8666b9857a1d186;hpb=348aaaad42163d6829112c9b18026c16b09e1914;p=bluesky.git diff --git a/nfs3/rpc.c b/nfs3/rpc.c index dbe0a64..f753bd1 100644 --- a/nfs3/rpc.c +++ b/nfs3/rpc.c @@ -28,6 +28,7 @@ extern BlueSkyFS *fs; static int outstanding_rpcs = 0; +static struct bluesky_stats *rpc_recv_stats, *rpc_send_stats; /* TCP port number to use for NFS protocol. (Should be 2049.) */ #define NFS_SERVICE_PORT 2051 @@ -172,6 +173,7 @@ async_rpc_send_failure(RPCRequest *req, enum accept_stat stat) /* For UDP, a connection only exists for the duration of a single * message. */ g_mutex_free(req->connection->send_lock); + g_string_free(req->connection->msgbuf, TRUE); g_string_free(req->connection->sendbuf, TRUE); g_free(req->connection); } @@ -194,6 +196,7 @@ async_rpc_send_reply(RPCRequest *req, void *result) } g_atomic_int_add(&outstanding_rpcs, -1); + bluesky_stats_add(rpc_send_stats, str->len); struct rpc_reply header; header.xid = htonl(req->xid); @@ -248,6 +251,7 @@ async_rpc_send_reply(RPCRequest *req, void *result) /* For UDP, a connection only exists for the duration of a single * message. */ g_mutex_free(req->connection->send_lock); + g_string_free(req->connection->msgbuf, TRUE); g_string_free(req->connection->sendbuf, TRUE); g_free(req->connection); } @@ -569,6 +573,8 @@ static gboolean async_rpc_dispatch(RPCConnection *rpc) GString *msg = rpc->msgbuf; const char *buf = msg->str; + bluesky_stats_add(rpc_recv_stats, msg->len); + if (msg->len < sizeof(struct rpc_call_header)) { fprintf(stderr, "Short RPC message: only %zd bytes!\n", msg->len); return FALSE; @@ -861,6 +867,9 @@ void register_rpc() { SVCXPRT *transp; + rpc_recv_stats = bluesky_stats_new("NFS RPC Messages In"); + rpc_send_stats = bluesky_stats_new("NFS RPC Messages Out"); + async_rpc_init(); /* MOUNT protocol */