X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=nfs3%2Frpc.c;h=f753bd14a81f5e2800a06dfd173f2cccdf38460b;hb=7fea6eae8397d399c2557bdcbb969255dd440d72;hp=4dcd21e9306a1fbcf38238d2450f14e0d03537fb;hpb=d3c7929485ee2a0637e8fce739bad597ce11253d;p=bluesky.git diff --git a/nfs3/rpc.c b/nfs3/rpc.c index 4dcd21e..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); @@ -216,8 +219,10 @@ async_rpc_send_reply(RPCRequest *req, void *result) time_end = bluesky_now_hires(); +#if 0 printf("RPC[%"PRIx32"]: time = %"PRId64" ns\n", req->xid, time_end - req->time_start); +#endif /* Clean up. */ g_string_free(str, TRUE); @@ -246,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); } @@ -313,12 +319,14 @@ nfs_program_3(RPCRequest *req) xdrproc_t _xdr_argument, _xdr_result; char *(*local)(char *, RPCRequest *); +#if 0 if (req->req_proc < sizeof(nfs_proc_names) / sizeof(const char *)) { printf("Dispatched NFS RPC message type %s\n", nfs_proc_names[req->req_proc]); } else { printf("Dispatched unknown NFS RPC message type %d\n", req->req_proc); } +#endif switch (req->req_proc) { case NFSPROC3_NULL: @@ -495,13 +503,16 @@ static void sig_handler(int sig) static gboolean async_flushd(gpointer data) { +#if 0 int rpc_count = g_atomic_int_get(&outstanding_rpcs); if (rpc_count != 0) { g_print("Currently outstanding RPC requests: %d\n", rpc_count); } +#endif if (fs_dump_requested) { bluesky_debug_dump(fs); + bluesky_stats_dump_all(); fs_dump_requested = 0; } @@ -562,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; @@ -854,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 */