From 78bb852509767ff32547c8dc90c385a4c503e0f9 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 7 Apr 2006 06:34:26 +0000 Subject: [PATCH] xstat_fs-fix-20060407 as pointed out by cg2v@andrew.cmu.edu the addition of performance collection data for the GetCapabilities RPC broke backward compatibility with previous builds because it altered the size of the data structure sent on the wire. Instead we count the number of GetCapabilties calls but do not gather performance timing data as this can be done using spare fields. --- src/viced/afsfileprocs.c | 38 ++++---------------------------------- src/viced/fs_stats.h | 9 ++++++--- src/xstat/xstat_fs_test.c | 6 +++--- 3 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 429a7de3a2..de38173a2c 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -6025,28 +6025,16 @@ SRXAFS_GetCapabilities(struct rx_call * acall, Capabilities * capabilities) struct host *thost; afs_int32 *dataBuffP; afs_int32 dataBytes; -#if FS_STATS_DETAILED - struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */ - struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */ - struct timeval elapsedTime; /* Transfer time */ - /* - * Set our stats pointer, remember when the RPC operation started, and - * tally the operation. - */ - opP = &(afs_FullPerfStats.det.rpcOpTimes[FS_STATS_RPCIDX_GETCAPABILITIES]); FS_LOCK; - (opP->numOps)++; + AFSCallStats.GetCapabilities++, AFSCallStats.TotalCalls++; + afs_FullPerfStats.overall.fs_nGetCaps++; FS_UNLOCK; - TM_GetTimeOfDay(&opStartTime, 0); -#endif /* FS_STATS_DETAILED */ + ViceLog(2, ("SAFS_GetCapabilties\n")); if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost))) goto Bad_GetCaps; - FS_LOCK; - AFSCallStats.GetCapabilities++, AFSCallStats.TotalCalls++; - FS_UNLOCK; dataBytes = 1 * sizeof(afs_int32); dataBuffP = (afs_int32 *) malloc(dataBytes); dataBuffP[0] = VICED_CAPABILITY_ERRORTRANS; @@ -6057,28 +6045,10 @@ SRXAFS_GetCapabilities(struct rx_call * acall, Capabilities * capabilities) capabilities->Capabilities_len = dataBytes / sizeof(afs_int32); capabilities->Capabilities_val = dataBuffP; - ViceLog(2, ("SAFS_GetCapabilties\n")); - Bad_GetCaps: code = CallPostamble(tcon, code, thost); -#if FS_STATS_DETAILED - TM_GetTimeOfDay(&opStopTime, 0); - fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime); - if (code == 0) { - FS_LOCK; - (opP->numSuccesses)++; - fs_stats_AddTo((opP->sumTime), elapsedTime); - fs_stats_SquareAddTo((opP->sqrTime), elapsedTime); - if (fs_stats_TimeLessThan(elapsedTime, (opP->minTime))) { - fs_stats_TimeAssign((opP->minTime), elapsedTime); - } - if (fs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) { - fs_stats_TimeAssign((opP->maxTime), elapsedTime); - } - FS_UNLOCK; - } -#endif /* FS_STATS_DETAILED */ + return 0; } diff --git a/src/viced/fs_stats.h b/src/viced/fs_stats.h index e69dd55a66..7f915a4cf5 100644 --- a/src/viced/fs_stats.h +++ b/src/viced/fs_stats.h @@ -126,10 +126,14 @@ struct afs_PerfStats { afs_int32 rx_nBusies; /*Ttl VBUSYs sent to shed load */ afs_int32 fs_nBusies; /*Ttl VBUSYs sent during restart/vol clone */ + /* + * Can't count this as an RPC because it breaks the data structure + */ + afs_int32 fs_nGetCaps; /* Number of GetCapabilities calls */ /* * Spares */ - afs_int32 spare[29]; + afs_int32 spare[28]; }; #if FS_STATS_DETAILED @@ -164,9 +168,8 @@ struct afs_PerfStats { #define FS_STATS_RPCIDX_BULKSTATUS 25 #define FS_STATS_RPCIDX_XSTATSVERSION 26 #define FS_STATS_RPCIDX_GETXSTATS 27 -#define FS_STATS_RPCIDX_GETCAPABILITIES 28 -#define FS_STATS_NUM_RPC_OPS 29 +#define FS_STATS_NUM_RPC_OPS 28 /* * Assign an index to each of the File Server's RPC interface routines diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index e5ac15a869..90c6cec3ee 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -83,8 +83,7 @@ static char *opNames[] = { "NGetVolumeInfo", "BulkStatus", "XStatsVersion", - "GetXStats", - "GetCapabilities" + "GetXStats" }; static char *xferOpNames[] = { @@ -251,7 +250,8 @@ PrintOverallPerfInfo(struct afs_PerfStats *a_ovP) printf("\t%10d rx_nFreeCallStructs\n", a_ovP->rx_nFreeCallStructs); printf("\t%10d rx_nBusies\n\n", a_ovP->rx_nBusies); - printf("\t%10d fs_nBusies\n\n", a_ovP->fs_nBusies); + printf("\t%10d fs_nBusies\n", a_ovP->fs_nBusies); + printf("\t%10d fs_GetCapabilities\n\n", a_ovP->fs_nGetCaps); /* * Host module fields. */