rx: Move bytesSent + bytesRcvd into app only data
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 23 Oct 2012 18:21:09 +0000 (19:21 +0100)
committerDerrick Brashear <shadow@your-file-system.com>
Mon, 29 Oct 2012 16:10:44 +0000 (09:10 -0700)
The call->bytesSent and call->bytesRcvd counters are only manipulated
by the application thread in running calls. Move them into the app-only
section of the call structure so this is clear.

Change-Id: Ib7929a8e34bcb70c8cb9c1f89544adce0d627299
Reviewed-on: http://gerrit.openafs.org/8288
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/rx/rx.c
src/rx/rx_call.c
src/rx/rx_call.h
src/rx/rx_rdwr.c

index adc19c8..e984eac 100644 (file)
@@ -1649,8 +1649,8 @@ rx_NewCall(struct rx_connection *conn)
     /* remember start time for call in case we have hard dead time limit */
     call->queueTime = queueTime;
     clock_GetTime(&call->startTime);
-    call->bytesSent = 0;
-    call->bytesRcvd = 0;
+    call->app.bytesSent = 0;
+    call->app.bytesRcvd = 0;
 
     /* Turn on busy protocol. */
     rxi_KeepAliveOn(call);
@@ -3429,8 +3429,8 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
 #endif
             call->state = RX_STATE_PRECALL;
             clock_GetTime(&call->queueTime);
-            call->bytesSent = 0;
-            call->bytesRcvd = 0;
+            call->app.bytesSent = 0;
+            call->app.bytesRcvd = 0;
             /*
              * If the number of queued calls exceeds the overload
              * threshold then abort this call.
@@ -3521,8 +3521,8 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
 #endif
            call->state = RX_STATE_PRECALL;
            clock_GetTime(&call->queueTime);
-           call->bytesSent = 0;
-           call->bytesRcvd = 0;
+           call->app.bytesSent = 0;
+           call->app.bytesRcvd = 0;
            /*
             * If the number of queued calls exceeds the overload
             * threshold then abort this call.
index 0804b81..43d6034 100644 (file)
@@ -69,6 +69,6 @@ rx_RecordCallStatistics(struct rx_call *call, unsigned int rxInterface,
     clock_Sub(&queue, &call->queueTime);
 
     rxi_IncrementTimeAndCount(call->conn->peer, rxInterface, currentFunc,
-                            totalFunc, &queue, &exec, call->bytesSent,
-                            call->bytesRcvd, 1);
+                            totalFunc, &queue, &exec, call->app.bytesSent,
+                            call->app.bytesRcvd, 1);
 }
index 7179c1e..66ed5d1 100644 (file)
@@ -30,6 +30,8 @@ struct rx_call_appl {
     char *curpos;              /* current position in curvec */
     int mode;                  /* Mode of call */
     int padding;               /* Pad to double word */
+    afs_uint64 bytesSent;      /* Number bytes sent */
+    afs_uint64 bytesRcvd;      /* Number bytes received */
 };
 
 /* Call structure:  only instantiated for active calls and dallying
@@ -37,7 +39,6 @@ struct rx_call_appl {
  * well as state shared with other calls associated with this
  * connection) is maintained in the connection structure. */
 
-
 #ifdef KDUMP_RX_LOCK
 struct rx_call_rx_lock {
 #else
@@ -142,8 +143,7 @@ struct rx_call {
 
     struct clock queueTime;    /* time call was queued */
     struct clock startTime;    /* time call was started */
-    afs_uint64 bytesSent;      /* Number bytes sent */
-    afs_uint64 bytesRcvd;      /* Number bytes received */
+
     u_short tqWaiters;
 
     struct rx_packet *xmitList[RX_MAXACKS]; /* Can't xmit more than we ack */
index 98c0c85..c0a5116 100644 (file)
@@ -147,7 +147,7 @@ rxi_GetNextPacket(struct rx_call *call) {
                   call->conn->securityHeaderSize;
 
     call->app.nLeft = call->app.currentPacket->length;
-    call->bytesRcvd += call->app.currentPacket->length;
+    call->app.bytesRcvd += call->app.currentPacket->length;
 
     call->nHardAcks++;
 
@@ -642,7 +642,7 @@ rxi_WriteProc(struct rx_call *call, char *buf,
                 * there will be others. PrepareSendPacket may
                 * alter the packet length by up to
                 * conn->securityMaxTrailerSize */
-               call->bytesSent += call->app.currentPacket->length;
+               call->app.bytesSent += call->app.currentPacket->length;
                rxi_PrepareSendPacket(call, call->app.currentPacket, 0);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
                 /* PrepareSendPacket drops the call lock */
@@ -1080,7 +1080,7 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
             * there will be others. PrepareSendPacket may
             * alter the packet length by up to
             * conn->securityMaxTrailerSize */
-           call->bytesSent += call->app.currentPacket->length;
+           call->app.bytesSent += call->app.currentPacket->length;
            rxi_PrepareSendPacket(call, call->app.currentPacket, 0);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
             /* PrepareSendPacket drops the call lock */
@@ -1297,7 +1297,7 @@ rxi_FlushWrite(struct rx_call *call)
        }
 
        /* The 1 specifies that this is the last packet */
-       call->bytesSent += cp->length;
+       call->app.bytesSent += cp->length;
        rxi_PrepareSendPacket(call, cp, 1);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
         /* PrepareSendPacket drops the call lock */