]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vlserver: Tidy up request counting
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 19 May 2011 14:06:15 +0000 (15:06 +0100)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 31 Mar 2016 10:03:05 +0000 (06:03 -0400)
Tidy up the counting of requests and aborts in the vlserver. Don't
hide a variable allocation within a macro, convert macros to inline
functions, and make it possible to not count particular operations
by passing in an opcode of 0.

Reviewed-on: http://gerrit.openafs.org/4769
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a14e791541bf19c6c377e68bc2f978fba34f94b1)

Change-Id: I1dcea218fbd3097511a93c9a825d6e76e9c8cf59
Reviewed-on: https://gerrit.openafs.org/12085
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/vlserver/vlprocs.c
src/vlserver/vlserver.p.h

index dd68b3bf29b1911eea655b88cc53f5f09ef3c01f..c6c35a2d6d22b6610130191e2966c59e0779c3fb 100644 (file)
@@ -97,6 +97,22 @@ static int IpAddrToRelAddr(struct vl_ctx *ctx, afs_uint32 ipaddr, int create);
 static int ChangeIPAddr(struct vl_ctx *ctx, afs_uint32 ipaddr1,
                         afs_uint32 ipaddr2);
 
+static_inline void
+countRequest(int opcode)
+{
+    if (opcode != 0) {
+        dynamic_statistics.requests[opcode - VL_LOWEST_OPCODE]++;
+    }
+}
+
+static_inline void
+countAbort(int opcode)
+{
+    if (opcode != 0) {
+       dynamic_statistics.aborts[opcode - VL_LOWEST_OPCODE]++;
+    }
+}
+
 #define AFS_RXINFO_LEN 128
 static char *
 rxinfo(char * str, struct rx_call *rxcall)
@@ -129,7 +145,7 @@ rxinfo(char * str, struct rx_call *rxcall)
 int
 Init_VLdbase(struct vl_ctx *ctx,
             int locktype,      /* indicate read or write transaction */
-            int this_op)
+            int opcode)
 {
     int errorcode = 0, pass, wl;
 
@@ -150,7 +166,7 @@ Init_VLdbase(struct vl_ctx *ctx,
 
        errorcode = ubik_SetLock(ctx->trans, 1, 1, locktype);
        if (errorcode) {
-           COUNT_ABO;
+           countAbort(opcode);
            ubik_AbortTrans(ctx->trans);
            return errorcode;
        }
@@ -161,7 +177,7 @@ Init_VLdbase(struct vl_ctx *ctx,
        if (!errorcode && wl && extent_mod)
            errorcode = readExtents(ctx->trans);        /* Fix the mh extent blocks */
        if (errorcode) {
-           COUNT_ABO;
+           countAbort(opcode);
            ubik_AbortTrans(ctx->trans);
            /* Only rebuld if the database is empty */
            /* Exit if can't rebuild */
@@ -191,12 +207,13 @@ Init_VLdbase(struct vl_ctx *ctx,
 afs_int32
 SVL_CreateEntry(struct rx_call *rxcall, struct vldbentry *newentry)
 {
+    int this_op = VLCREATEENTRY;
     struct vl_ctx ctx;
     afs_int32 errorcode, blockindex;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLCREATEENTRY);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL)) {
        errorcode = VL_PERM;
        goto end;
@@ -251,7 +268,7 @@ SVL_CreateEntry(struct rx_call *rxcall, struct vldbentry *newentry)
     }
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -264,12 +281,13 @@ SVL_CreateEntry(struct rx_call *rxcall, struct vldbentry *newentry)
 afs_int32
 SVL_CreateEntryN(struct rx_call *rxcall, struct nvldbentry *newentry)
 {
+    int this_op = VLCREATEENTRYN;
     struct vl_ctx ctx;
     afs_int32 errorcode, blockindex;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLCREATEENTRYN);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL)) {
        errorcode = VL_PERM;
        goto end;
@@ -324,7 +342,7 @@ SVL_CreateEntryN(struct rx_call *rxcall, struct nvldbentry *newentry)
     }
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -337,11 +355,12 @@ SVL_CreateEntryN(struct rx_call *rxcall, struct nvldbentry *newentry)
 afs_int32
 SVL_ChangeAddr(struct rx_call *rxcall, afs_uint32 ip1, afs_uint32 ip2)
 {
+    int this_op = VLCHANGEADDR;
     struct vl_ctx ctx;
     afs_int32 errorcode;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLCHANGEADDR);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL)) {
        errorcode = VL_PERM;
        goto end;
@@ -359,7 +378,7 @@ SVL_ChangeAddr(struct rx_call *rxcall, afs_uint32 ip1, afs_uint32 ip2)
     }
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -372,12 +391,13 @@ SVL_ChangeAddr(struct rx_call *rxcall, afs_uint32 ip1, afs_uint32 ip2)
 afs_int32
 SVL_DeleteEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype)
 {
+    int this_op = VLDELETEENTRY;
     struct vl_ctx ctx;
     afs_int32 blockindex, errorcode;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLDELETEENTRY);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
 
@@ -405,7 +425,7 @@ SVL_DeleteEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype)
     goto end;
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -429,6 +449,8 @@ GetEntryByID(struct rx_call *rxcall,
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
+    countRequest(this_op);
+
     if ((voltype != -1) && (InvalidVoltype(voltype)))
        return VL_BADVOLTYPE;
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
@@ -440,12 +462,12 @@ GetEntryByID(struct rx_call *rxcall,
     if (blockindex == 0) {     /* entry not found */
        if (!errorcode)
            errorcode = VL_NOENT;
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        return errorcode;
     }
     if (tentry.flags & VLDELETED) {    /* Entry is deleted! */
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        return VL_ENTDELETED;
     }
@@ -465,8 +487,8 @@ SVL_GetEntryByID(struct rx_call *rxcall,
                 afs_int32 voltype,
                 vldbentry *aentry)             /* entry data copied here */
 {
-    COUNT_REQ(VLGETENTRYBYID);
-    return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 0, this_op));
+    return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 0,
+                        VLGETENTRYBYID));
 }
 
 afs_int32
@@ -475,8 +497,8 @@ SVL_GetEntryByIDN(struct rx_call *rxcall,
                  afs_int32 voltype,
                  nvldbentry *aentry)   /* entry data copied here */
 {
-    COUNT_REQ(VLGETENTRYBYIDN);
-    return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 1, this_op));
+    return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 1,
+                        VLGETENTRYBYIDN));
 }
 
 afs_int32
@@ -485,12 +507,10 @@ SVL_GetEntryByIDU(struct rx_call *rxcall,
                  afs_int32 voltype,
                  uvldbentry *aentry)   /* entry data copied here */
 {
-    COUNT_REQ(VLGETENTRYBYIDU);
-    return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 2, this_op));
+    return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 2,
+                        VLGETENTRYBYIDU));
 }
 
-
-
 /* returns true if the id is a decimal integer, in which case we interpret
  * it as an id.  make the cache manager much simpler */
 static int
@@ -530,12 +550,12 @@ GetEntryByName(struct rx_call *rxcall,
     if (blockindex == 0) {     /* entry not found */
        if (!errorcode)
            errorcode = VL_NOENT;
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        return errorcode;
     }
     if (tentry.flags & VLDELETED) {    /* Entry is deleted */
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        return VL_ENTDELETED;
     }
@@ -554,8 +574,8 @@ SVL_GetEntryByNameO(struct rx_call *rxcall,
                    char *volname,
                    struct vldbentry *aentry)   /* entry data copied here */
 {
-    COUNT_REQ(VLGETENTRYBYNAME);
-    return (GetEntryByName(rxcall, volname, (char *)aentry, 0, this_op));
+    return (GetEntryByName(rxcall, volname, (char *)aentry, 0,
+                          VLGETENTRYBYNAME));
 }
 
 
@@ -564,8 +584,8 @@ SVL_GetEntryByNameN(struct rx_call *rxcall,
                    char *volname,
                    struct nvldbentry *aentry)  /* entry data copied here */
 {
-    COUNT_REQ(VLGETENTRYBYNAMEN);
-    return (GetEntryByName(rxcall, volname, (char *)aentry, 1, this_op));
+    return (GetEntryByName(rxcall, volname, (char *)aentry, 1,
+                          VLGETENTRYBYNAMEN));
 }
 
 afs_int32
@@ -573,8 +593,8 @@ SVL_GetEntryByNameU(struct rx_call *rxcall,
                    char *volname,
                    struct uvldbentry *aentry)  /* entry data copied here */
 {
-    COUNT_REQ(VLGETENTRYBYNAMEU);
-    return (GetEntryByName(rxcall, volname, (char *)aentry, 2, this_op));
+    return (GetEntryByName(rxcall, volname, (char *)aentry, 2,
+                          VLGETENTRYBYNAMEU));
 }
 
 
@@ -584,12 +604,13 @@ afs_int32
 SVL_GetNewVolumeId(struct rx_call *rxcall, afs_uint32 Maxvolidbump,
                   afs_uint32 *newvolumeid)
 {
+    int this_op = VLGETNEWVOLUMEID;
     afs_int32 errorcode;
     afs_uint32 maxvolumeid;
     struct vl_ctx ctx;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLGETNEWVOLUMEID);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
 
@@ -615,7 +636,7 @@ SVL_GetNewVolumeId(struct rx_call *rxcall, afs_uint32 Maxvolidbump,
     goto end;
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -632,6 +653,7 @@ afs_int32
 SVL_ReplaceEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
                 struct vldbentry *newentry, afs_int32 releasetype)
 {
+    int this_op = VLREPLACEENTRY;
     struct vl_ctx ctx;
     afs_int32 blockindex, errorcode, typeindex;
     int hashnewname;
@@ -640,7 +662,7 @@ SVL_ReplaceEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
     afs_uint32 checkids[MAXTYPES];
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLREPLACEENTRY);
+    countRequest(this_op);
     for (typeindex = 0; typeindex < MAXTYPES; typeindex++)
        hashVol[typeindex] = 0;
     hashnewname = 0;
@@ -744,7 +766,7 @@ SVL_ReplaceEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
     END(ubik_EndTrans(ctx.trans));
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -757,6 +779,7 @@ afs_int32
 SVL_ReplaceEntryN(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
                  struct nvldbentry *newentry, afs_int32 releasetype)
 {
+    int this_op = VLREPLACEENTRYN;
     struct vl_ctx ctx;
     afs_int32 blockindex, errorcode, typeindex;
     int hashnewname;
@@ -764,7 +787,7 @@ SVL_ReplaceEntryN(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLREPLACEENTRYN);
+    countRequest(this_op);
     for (typeindex = 0; typeindex < MAXTYPES; typeindex++)
        hashVol[typeindex] = 0;
     hashnewname = 0;
@@ -845,7 +868,7 @@ SVL_ReplaceEntryN(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
     END(ubik_EndTrans(ctx.trans));
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -867,12 +890,13 @@ SVL_UpdateEntry(struct rx_call *rxcall,
                struct VldbUpdateEntry *updateentry,    /* Update entry copied here */
                afs_int32 releasetype)
 {
+    int this_op = VLUPDATEENTRY;
     struct vl_ctx ctx;
     afs_int32 blockindex, errorcode;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLUPDATEENTRY);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
     if ((voltype != -1) && (InvalidVoltype(voltype)))
@@ -903,7 +927,7 @@ SVL_UpdateEntry(struct rx_call *rxcall,
     END(ubik_EndTrans(ctx.trans));
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -919,11 +943,12 @@ SVL_UpdateEntryByName(struct rx_call *rxcall,
                      struct VldbUpdateEntry *updateentry, /* Update entry copied here */
                      afs_int32 releasetype)
 {
+    int this_op = VLUPDATEENTRYBYNAME;
     struct vl_ctx ctx;
     afs_int32 blockindex, errorcode;
     struct nvlentry tentry;
 
-    COUNT_REQ(VLUPDATEENTRYBYNAME);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
     if (releasetype && InvalidReleasetype(releasetype))
@@ -951,7 +976,7 @@ SVL_UpdateEntryByName(struct rx_call *rxcall,
     END(ubik_EndTrans(ctx.trans));
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -965,12 +990,13 @@ afs_int32
 SVL_SetLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
            afs_int32 voloper)
 {
+    int this_op = VLSETLOCK;
     afs_int32 timestamp, blockindex, errorcode;
     struct vl_ctx ctx;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLSETLOCK);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
     if ((voltype != -1) && (InvalidVoltype(voltype)))
@@ -1015,7 +1041,7 @@ SVL_SetLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
     END(ubik_EndTrans(ctx.trans));
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -1032,12 +1058,13 @@ afs_int32
 SVL_ReleaseLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
                afs_int32 releasetype)
 {
+    int this_op = VLRELEASELOCK;
     afs_int32 blockindex, errorcode;
     struct vl_ctx ctx;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLRELEASELOCK);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
     if ((voltype != -1) && (InvalidVoltype(voltype)))
@@ -1065,7 +1092,7 @@ SVL_ReleaseLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
     END(ubik_EndTrans(ctx.trans));
 
   abort:
-    COUNT_ABO;
+    countAbort(this_op);
     ubik_AbortTrans(ctx.trans);
 
   end:
@@ -1084,12 +1111,13 @@ SVL_ListEntry(struct rx_call *rxcall, afs_int32 previous_index,
              afs_int32 *count, afs_int32 *next_index,
              struct vldbentry *aentry)
 {
+    int this_op = VLLISTENTRY;
     int errorcode;
     struct vl_ctx ctx;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLLISTENTRY);
+    countRequest(this_op);
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
        goto end;
     VLog(25, ("OListEntry index=%d %s\n", previous_index,
@@ -1112,12 +1140,13 @@ SVL_ListEntryN(struct rx_call *rxcall, afs_int32 previous_index,
               afs_int32 *count, afs_int32 *next_index,
               struct nvldbentry *aentry)
 {
+    int this_op = VLLISTENTRYN;
     int errorcode;
     struct vl_ctx ctx;
     struct nvlentry tentry;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLLISTENTRYN);
+    countRequest(this_op);
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
        goto end;
     VLog(25, ("ListEntry index=%d %s\n", previous_index, rxinfo(rxstr, rxcall)));
@@ -1143,6 +1172,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
                   afs_int32 *nentries,
                   bulkentries *vldbentries)
 {
+    int this_op = VLLISTATTRIBUTES;
     int errorcode, allocCount = 0;
     struct vl_ctx ctx;
     struct nvlentry tentry;
@@ -1150,7 +1180,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
     int pollcount = 0;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLLISTATTRIBUTES);
+    countRequest(this_op);
     vldbentries->bulkentries_val = 0;
     vldbentries->bulkentries_len = *nentries = 0;
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
@@ -1159,7 +1189,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
     Vldbentry = VldbentryFirst = vldbentries->bulkentries_val =
        (vldbentry *) malloc(allocCount * sizeof(vldbentry));
     if (Vldbentry == NULL) {
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        errorcode = VL_NOMEM;
        goto end;
@@ -1175,7 +1205,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
        if (blockindex == 0) {
            if (!errorcode)
                errorcode = VL_NOENT;
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            if (vldbentries->bulkentries_val)
                free((char *)vldbentries->bulkentries_val);
@@ -1186,7 +1216,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
        if ((errorcode =
            put_attributeentry(&ctx, &Vldbentry, &VldbentryFirst, &VldbentryLast,
                               vldbentries, &tentry, nentries, &allocCount))) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            if (vldbentries->bulkentries_val)
                free((char *)vldbentries->bulkentries_val);
@@ -1249,7 +1279,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
                put_attributeentry(&ctx, &Vldbentry, &VldbentryFirst,
                                   &VldbentryLast, vldbentries, &tentry,
                                   nentries, &allocCount))) {
-               COUNT_ABO;
+               countAbort(this_op);
                ubik_AbortTrans(ctx.trans);
                if (vldbentries->bulkentries_val)
                    free((char *)vldbentries->bulkentries_val);
@@ -1267,7 +1297,7 @@ SVL_ListAttributes(struct rx_call *rxcall,
                                  vldbentries->bulkentries_len *
                                  sizeof(vldbentry));
        if (vldbentries->bulkentries_val == NULL) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            errorcode = VL_NOMEM;
            goto end;
@@ -1288,6 +1318,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
                    afs_int32 *nentries,
                    nbulkentries *vldbentries)
 {
+    int this_op = VLLISTATTRIBUTESN;
     int errorcode, allocCount = 0;
     struct vl_ctx ctx;
     struct nvlentry tentry;
@@ -1295,7 +1326,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
     int pollcount = 0;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLLISTATTRIBUTESN);
+    countRequest(this_op);
     vldbentries->nbulkentries_val = 0;
     vldbentries->nbulkentries_len = *nentries = 0;
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
@@ -1304,7 +1335,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
     Vldbentry = VldbentryFirst = vldbentries->nbulkentries_val =
        (nvldbentry *) malloc(allocCount * sizeof(nvldbentry));
     if (Vldbentry == NULL) {
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        errorcode = VL_NOMEM;
        goto end;
@@ -1320,7 +1351,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
        if (blockindex == 0) {
            if (!errorcode)
                errorcode = VL_NOENT;
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            if (vldbentries->nbulkentries_val)
                free((char *)vldbentries->nbulkentries_val);
@@ -1332,7 +1363,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
            put_nattributeentry(&ctx, &Vldbentry, &VldbentryFirst, &VldbentryLast,
                                vldbentries, &tentry, 0, 0, nentries,
                                &allocCount))) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            if (vldbentries->nbulkentries_val)
                free((char *)vldbentries->nbulkentries_val);
@@ -1396,7 +1427,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
                put_nattributeentry(&ctx, &Vldbentry, &VldbentryFirst,
                                    &VldbentryLast, vldbentries, &tentry, 0,
                                    0, nentries, &allocCount))) {
-               COUNT_ABO;
+               countAbort(this_op);
                ubik_AbortTrans(ctx.trans);
                if (vldbentries->nbulkentries_val)
                    free((char *)vldbentries->nbulkentries_val);
@@ -1414,7 +1445,7 @@ SVL_ListAttributesN(struct rx_call *rxcall,
                                   vldbentries->nbulkentries_len *
                                   sizeof(nvldbentry));
        if (vldbentries->nbulkentries_val == NULL) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            errorcode = VL_NOMEM;
            goto end;
@@ -1439,6 +1470,7 @@ SVL_ListAttributesN2(struct rx_call *rxcall,
                     nbulkentries *vldbentries,
                     afs_int32 *nextstartindex)
 {
+    int this_op = VLLISTATTRIBUTESN2;
     int errorcode = 0, maxCount = VLDBALLOCCOUNT;
     struct vl_ctx ctx;
     struct nvlentry tentry;
@@ -1460,7 +1492,7 @@ SVL_ListAttributesN2(struct rx_call *rxcall,
     char *t;
 #endif
 
-    COUNT_REQ(VLLISTATTRIBUTESN2);
+    countRequest(this_op);
     vldbentries->nbulkentries_val = 0;
     vldbentries->nbulkentries_len = 0;
     *nentries = 0;
@@ -1473,7 +1505,7 @@ SVL_ListAttributesN2(struct rx_call *rxcall,
     Vldbentry = VldbentryFirst = vldbentries->nbulkentries_val =
        (nvldbentry *) malloc(maxCount * sizeof(nvldbentry));
     if (Vldbentry == NULL) {
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        errorcode = VL_NOMEM;
        goto end;
@@ -1708,7 +1740,7 @@ SVL_ListAttributesN2(struct rx_call *rxcall,
 #endif
 
     if (errorcode) {
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        if (vldbentries->nbulkentries_val)
            free((char *)vldbentries->nbulkentries_val);
@@ -1740,6 +1772,7 @@ SVL_LinkedList(struct rx_call *rxcall,
               afs_int32 *nentries,
               vldb_list *vldbentries)
 {
+    int this_op = VLLINKEDLIST;
     int errorcode;
     struct vl_ctx ctx;
     struct nvlentry tentry;
@@ -1749,7 +1782,7 @@ SVL_LinkedList(struct rx_call *rxcall,
     int serverindex;
     int pollcount = 0;
 
-    COUNT_REQ(VLLINKEDLIST);
+    countRequest(this_op);
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
        goto end;
 
@@ -1762,7 +1795,7 @@ SVL_LinkedList(struct rx_call *rxcall,
        blockindex =
            FindByID(&ctx, attributes->volumeid, -1, &tentry, &errorcode);
        if (!blockindex) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            errorcode = (errorcode ? errorcode : VL_NOENT);
            goto end;
@@ -1770,7 +1803,7 @@ SVL_LinkedList(struct rx_call *rxcall,
 
        vllist = (single_vldbentry *) malloc(sizeof(single_vldbentry));
        if (vllist == NULL) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            errorcode = VL_NOMEM;
            goto end;
@@ -1842,7 +1875,7 @@ SVL_LinkedList(struct rx_call *rxcall,
 
            vllist = (single_vldbentry *) malloc(sizeof(single_vldbentry));
            if (vllist == NULL) {
-               COUNT_ABO;
+               countAbort(this_op);
                ubik_AbortTrans(ctx.trans);
                errorcode = VL_NOMEM;
                goto end;
@@ -1854,7 +1887,7 @@ SVL_LinkedList(struct rx_call *rxcall,
            vllistptr = &vllist->next_vldb;
            (*nentries)++;
            if (smallMem && (*nentries >= VLDBALLOCCOUNT)) {
-               COUNT_ABO;
+               countAbort(this_op);
                ubik_AbortTrans(ctx.trans);
                errorcode = VL_SIZEEXCEEDED;
                goto end;
@@ -1874,6 +1907,7 @@ SVL_LinkedListN(struct rx_call *rxcall,
                afs_int32 *nentries,
                nvldb_list *vldbentries)
 {
+    int this_op = VLLINKEDLISTN;
     int errorcode;
     struct vl_ctx ctx;
     struct nvlentry tentry;
@@ -1883,7 +1917,7 @@ SVL_LinkedListN(struct rx_call *rxcall,
     int serverindex;
     int pollcount = 0;
 
-    COUNT_REQ(VLLINKEDLISTN);
+    countRequest(this_op);
     if ((errorcode = Init_VLdbase(&ctx, LOCKREAD, this_op)))
        goto end;
 
@@ -1896,7 +1930,7 @@ SVL_LinkedListN(struct rx_call *rxcall,
        blockindex =
            FindByID(&ctx, attributes->volumeid, -1, &tentry, &errorcode);
        if (!blockindex) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            errorcode = (errorcode ? errorcode : VL_NOENT);
            goto end;
@@ -1904,7 +1938,7 @@ SVL_LinkedListN(struct rx_call *rxcall,
 
        vllist = (single_nvldbentry *) malloc(sizeof(single_nvldbentry));
        if (vllist == NULL) {
-           COUNT_ABO;
+           countAbort(this_op);
            ubik_AbortTrans(ctx.trans);
            errorcode = VL_NOMEM;
            goto end;
@@ -1976,7 +2010,7 @@ SVL_LinkedListN(struct rx_call *rxcall,
 
            vllist = (single_nvldbentry *) malloc(sizeof(single_nvldbentry));
            if (vllist == NULL) {
-               COUNT_ABO;
+               countAbort(this_op);
                ubik_AbortTrans(ctx.trans);
                errorcode = VL_NOMEM;
                goto end;
@@ -1988,7 +2022,7 @@ SVL_LinkedListN(struct rx_call *rxcall,
            vllistptr = &vllist->next_vldb;
            (*nentries)++;
            if (smallMem && (*nentries >= VLDBALLOCCOUNT)) {
-               COUNT_ABO;
+               countAbort(this_op);
                ubik_AbortTrans(ctx.trans);
                errorcode = VL_SIZEEXCEEDED;
                goto end;
@@ -2011,11 +2045,12 @@ SVL_GetStats(struct rx_call *rxcall,
             vldstats *stats,
             vital_vlheader *vital_header)
 {
+    int this_op = VLGETSTATS;
     afs_int32 errorcode;
     struct vl_ctx ctx;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLGETSTATS);
+    countRequest(this_op);
 #ifdef notdef
     /* Allow users to get statistics freely */
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL)) {      /* Must be in 'UserList' to use */
@@ -2047,12 +2082,13 @@ SVL_GetAddrs(struct rx_call *rxcall,
             afs_int32 *nentries,
             bulkaddrs *addrsp)
 {
+    int this_op = VLGETADDRS;
     afs_int32 errorcode;
     struct vl_ctx ctx;
     int nservers, i;
     afs_uint32 *taddrp;
 
-    COUNT_REQ(VLGETADDRS);
+    countRequest(this_op);
     addrsp->bulkaddrs_len = *nentries = 0;
     addrsp->bulkaddrs_val = 0;
     memset(spare3, 0, sizeof(struct VLCallBack));
@@ -2066,7 +2102,7 @@ SVL_GetAddrs(struct rx_call *rxcall,
     nservers = *nentries = addrsp->bulkaddrs_len = 0;
 
     if (!taddrp) {
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        return VL_NOMEM;
     }
@@ -2097,6 +2133,7 @@ afs_int32
 SVL_RegisterAddrs(struct rx_call *rxcall, afsUUID *uuidp, afs_int32 spare1,
                  bulkaddrs *addrsp)
 {
+    int this_op = VLREGADDR;
     afs_int32 code;
     struct vl_ctx ctx;
     int cnt, h, i, j, k, m, base, index;
@@ -2111,7 +2148,7 @@ SVL_RegisterAddrs(struct rx_call *rxcall, afsUUID *uuidp, afs_int32 spare1,
     int ReplaceEntry = 0;
     int srvidx, mhidx;
 
-    COUNT_REQ(VLREGADDR);
+    countRequest(this_op);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        return (VL_PERM);
     if ((code = Init_VLdbase(&ctx, LOCKWRITE, this_op)))
@@ -2471,6 +2508,7 @@ SVL_GetAddrsU(struct rx_call *rxcall,
              afs_int32 *nentries,
              bulkaddrs *addrsp)
 {
+    int this_op = VLGETADDRSU;
     afs_int32 errorcode, index = -1, offset;
     struct vl_ctx ctx;
     int nservers, i, j, base = 0;
@@ -2479,7 +2517,7 @@ SVL_GetAddrsU(struct rx_call *rxcall,
     afs_uint32 *taddrp, taddr;
     char rxstr[AFS_RXINFO_LEN];
 
-    COUNT_REQ(VLGETADDRSU);
+    countRequest(this_op);
     addrsp->bulkaddrs_len = *nentries = 0;
     addrsp->bulkaddrs_val = 0;
     VLog(5, ("GetAddrsU %s\n", rxinfo(rxstr, rxcall)));
@@ -2564,7 +2602,7 @@ SVL_GetAddrsU(struct rx_call *rxcall,
        (afs_uint32 *) malloc(sizeof(afs_int32) * (MAXSERVERID + 1));
     nservers = *nentries = addrsp->bulkaddrs_len = 0;
     if (!taddrp) {
-       COUNT_ABO;
+       countAbort(this_op);
        ubik_AbortTrans(ctx.trans);
        return VL_NOMEM;
     }
index b16d11ae5a71c7ecfe4afb91c327e71427174fb8..f84624c892e3a5a5779caca838da61b674f4b8c6 100644 (file)
@@ -95,8 +95,6 @@ typedef struct vlheader vlheader;
 typedef struct vlentry vlentry;
 typedef struct nvlentry nvlentry;
 
-#define COUNT_REQ(op) static int this_op = op-VL_LOWEST_OPCODE; dynamic_statistics.requests[this_op]++
-#define COUNT_ABO dynamic_statistics.aborts[this_op]++
 #define        DOFFSET(abase,astr,aitem) ((abase)+(((char *)(aitem)) - ((char *)(astr))))
 
 #define        VL_MHSRV_PERBLK         64