Don't split int64s when we don't need to
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Wed, 13 Jul 2011 13:23:22 +0000 (14:23 +0100)
committerDerrick Brashear <shadow@dementia.org>
Wed, 13 Jul 2011 21:37:36 +0000 (14:37 -0700)
Now that we're always using an int64, and never a hyper_t, to represent
64bit integers, we can just print them out and assign them using the
native tools, rather than having to call SplitInt64. Simplify our code
to do so, which also avoids some gcc-4.6.0 warnings.

Change-Id: I12cfb5401d0431be2a4fefdfc5e1f52df7d5764d
Reviewed-on: http://gerrit.openafs.org/4998
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/viced/afsfileprocs.c
src/vol/fssync-debug.c
src/vol/volume.c

index 2ce8a19..18fe4f2 100644 (file)
@@ -5202,7 +5202,6 @@ SRXAFS_XStatsVersion(struct rx_call * a_call, afs_int32 * a_versionP)
 static void
 FillPerfValues(struct afs_PerfStats *a_perfP)
 {                              /*FillPerfValues */
-    afs_uint32 hi, lo;
     int dir_Buffers;           /*# buffers in use by dir package */
     int dir_Calls;             /*# read calls in dir package */
     int dir_IOs;               /*# I/O ops in dir package */
@@ -5222,10 +5221,8 @@ FillPerfValues(struct afs_PerfStats *a_perfP)
     a_perfP->vcache_S_Reads = VnodeClassInfo[vSmall].reads;
     a_perfP->vcache_S_Writes = VnodeClassInfo[vSmall].writes;
     a_perfP->vcache_H_Entries = VStats.hdr_cache_size;
-    SplitInt64(VStats.hdr_gets, hi, lo);
-    a_perfP->vcache_H_Gets = lo;
-    SplitInt64(VStats.hdr_loads, hi, lo);
-    a_perfP->vcache_H_Replacements = lo;
+    a_perfP->vcache_H_Gets = (int)VStats.hdr_gets;
+    a_perfP->vcache_H_Replacements = (int)VStats.hdr_loads;
 
     /*
      * Directory section.
index 3623651..3634f2f 100644 (file)
@@ -678,9 +678,6 @@ VolQuery(struct cmd_syndesc * as, void * rock)
     SYNC_PROTO_BUF_DECL(res_buf);
     SYNC_response res;
     Volume v;
-#ifdef AFS_DEMAND_ATTACH_FS
-    int hi, lo;
-#endif
 
     dafs_prolog();
 
@@ -744,28 +741,14 @@ VolQuery(struct cmd_syndesc * as, void * rock)
            /* statistics structure */
            printf("\tstats = {\n");
 
-           printf("\t\thash_lookups = {\n");
-           SplitInt64(v.stats.hash_lookups,hi,lo);
-           printf("\t\t\thi = %u\n", hi);
-           printf("\t\t\tlo = %u\n", lo);
-           printf("\t\t}\n");
-
-           printf("\t\thash_short_circuits = {\n");
-           SplitInt64(v.stats.hash_short_circuits,hi,lo);
-           printf("\t\t\thi = %u\n", hi);
-           printf("\t\t\tlo = %u\n", lo);
-           printf("\t\t}\n");
-
-           printf("\t\thdr_loads = {\n");
-           SplitInt64(v.stats.hdr_loads,hi,lo);
-           printf("\t\t\thi = %u\n", hi);
-           printf("\t\t\tlo = %u\n", lo);
-           printf("\t\t}\n");
-
-           printf("\t\thdr_gets = {\n");
-           SplitInt64(v.stats.hdr_gets,hi,lo);
-           printf("\t\t\thi = %u\n", hi);
-           printf("\t\t\tlo = %u\n", lo);
+           printf("\t\thash_lookups = %"AFS_INT64_FMT"\n",
+                  v.stats.hash_lookups);
+           printf("\t\thash_short_circuits = %"AFS_INT64_FMT"\n",
+                  v.stats.hash_short_circuits);
+           printf("\t\thdr_loads = %"AFS_INT64_FMT"\n",
+                  v.stats.hdr_loads);
+           printf("\t\thdr_gets = %"AFS_INT64_FMT"\n",
+                  v.stats.hdr_gets);
            printf("\t\t}\n");
 
            printf("\t\tattaches         = %u\n", v.stats.attaches);
@@ -1237,7 +1220,6 @@ print_vol_stats_general(VolPkgStats * stats)
 #ifdef AFS_DEMAND_ATTACH_FS
     int i;
 #endif
-    afs_uint32 hi, lo;
 
     printf("VolPkgStats = {\n");
 #ifdef AFS_DEMAND_ATTACH_FS
@@ -1247,54 +1229,23 @@ print_vol_stats_general(VolPkgStats * stats)
               stats->state_levels[i]);
     }
 
-    SplitInt64(stats->hash_looks, hi, lo);
-    printf("\thash_looks = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->hash_reorders, hi, lo);
-    printf("\thash_reorders = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->salvages, hi, lo);
-    printf("\tsalvages = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->vol_ops, hi, lo);
-    printf("\tvol_ops = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
+    printf("\thash_looks = %"AFS_INT64_FMT"\n",
+          stats->hash_looks);
+    printf("\thash_reorders = %"AFS_INT64_FMT"\n",
+          stats->hash_reorders);
+    printf("\tsalvages = %"AFS_INT64_FMT"\n",
+          stats->salvages);
+    printf("\tvol_ops = %"AFS_INT64_FMT"\n",
+          stats->vol_ops);
 #endif
-    SplitInt64(stats->hdr_loads, hi, lo);
-    printf("\thdr_loads = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->hdr_gets, hi, lo);
-    printf("\thdr_gets = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->attaches, hi, lo);
-    printf("\tattaches = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->soft_detaches, hi, lo);
-    printf("\tsoft_detaches = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
+    printf("\thdr_loads = %"AFS_INT64_FMT"\n",
+          stats->hdr_loads);
+    printf("\thdr_gets = %"AFS_INT64_FMT"\n",
+          stats->hdr_gets);
+    printf("\tattaches = %"AFS_INT64_FMT"\n",
+          stats->attaches);
+    printf("\tsoft_detaches = %"AFS_INT64_FMT"\n",
+          stats->soft_detaches);
     printf("\thdr_cache_size = %d\n", stats->hdr_cache_size);
 
     printf("}\n");
@@ -1317,10 +1268,6 @@ print_vol_stats_viceP(struct DiskPartitionStats64 * stats)
 static void
 print_vol_stats_hash(struct VolumeHashChainStats * stats)
 {
-#ifdef AFS_DEMAND_ATTACH_FS
-    afs_uint32 hi, lo;
-#endif
-
     printf("DiskPartitionStats = {\n");
     printf("\ttable_size = %d\n", stats->table_size);
     printf("\tchain_len = %d\n", stats->chain_len);
@@ -1329,23 +1276,12 @@ print_vol_stats_hash(struct VolumeHashChainStats * stats)
     printf("\tchain_cacheCheck = %d\n", stats->chain_cacheCheck);
     printf("\tchain_busy = %d\n", stats->chain_busy);
 
-    SplitInt64(stats->chain_looks, hi, lo);
-    printf("\tchain_looks = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->chain_gets, hi, lo);
-    printf("\tchain_gets = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
-
-    SplitInt64(stats->chain_reorders, hi, lo);
-    printf("\tchain_reorders = {\n");
-    printf("\t\thi = %u\n", hi);
-    printf("\t\tlo = %u\n", lo);
-    printf("\t}\n");
+    printf("\tchain_looks = %"AFS_INT64_FMT"\n",
+          stats->chain_looks);
+    printf("\tchain_gets = %"AFS_INT64_FMT"\n",
+          stats->chain_gets);
+    printf("\tchain_reorders = %"AFS_INT64_FMT"\n",
+          stats->chain_reorders);
 #endif /* AFS_DEMAND_ATTACH_FS */
 
     printf("}\n");
index f15aaca..afd2bf4 100644 (file)
@@ -8749,16 +8749,14 @@ VVByPListWait_r(struct DiskPartition64 * dp)
 void
 VPrintCacheStats_r(void)
 {
-    afs_uint32 get_hi, get_lo, load_hi, load_lo;
     struct VnodeClassInfo *vcp;
     vcp = &VnodeClassInfo[vLarge];
     Log("Large vnode cache, %d entries, %d allocs, %d gets (%d reads), %d writes\n", vcp->cacheSize, vcp->allocs, vcp->gets, vcp->reads, vcp->writes);
     vcp = &VnodeClassInfo[vSmall];
     Log("Small vnode cache,%d entries, %d allocs, %d gets (%d reads), %d writes\n", vcp->cacheSize, vcp->allocs, vcp->gets, vcp->reads, vcp->writes);
-    SplitInt64(VStats.hdr_gets, get_hi, get_lo);
-    SplitInt64(VStats.hdr_loads, load_hi, load_lo);
-    Log("Volume header cache, %d entries, %d gets, %d replacements\n",
-       VStats.hdr_cache_size, get_lo, load_lo);
+    Log("Volume header cache, %d entries, %"AFS_INT64_FMT" gets, "
+        "%"AFS_INT64_FMT" replacements\n",
+       VStats.hdr_cache_size, VStats.hdr_gets, VStats.hdr_loads);
 }
 
 void