Windows: fs getcacheparms
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 25 Apr 2012 22:05:01 +0000 (18:05 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 29 Apr 2012 19:31:25 +0000 (12:31 -0700)
The get cache params output is supposed to include two values:

 . the size of the cache

 . the size of the cache in use

Windows no longer has a concept of an unused cache buffer.  All
buffers are inserted onto the freelist and are available for
recycling when the AFSCache file is created.  Instead of reporting
the used cache space as 0K, report it as the full cache in use.
It is likely to disturb users less.

Change-Id: I6c1475f26e561d245bfa2b658c77ba683f735bb5
Reviewed-on: http://gerrit.openafs.org/7284
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsd/cm_ioctl.c

index ead5cc1..495e973 100644 (file)
@@ -1426,13 +1426,16 @@ cm_IoctlGetCacheParms(struct cm_ioctl *ioctlp, struct cm_user *userp)
 
     memset(&parms, 0, sizeof(parms));
 
-    /* first we get, in 1K units, the cache size */
+    /* the cache size */
     parms.parms[0] = cm_data.buf_nbuffers * (cm_data.buf_blockSize / 1024);
 
-    /* and then the actual # of buffers in use (not in the free list, I guess,
-     * will be what we do).
+    /*
+     * the used cache space.  this number is not available on windows.
+     * the cm_data.buf_freeCount represents all buffers eligible for recycling.
+     * so we report the entire cache in use since reporting 0 in use disturbs
+     * many users.
      */
-    parms.parms[1] = (cm_data.buf_nbuffers - cm_data.buf_freeCount) * (cm_data.buf_blockSize / 1024);
+    parms.parms[1] = cm_data.buf_nbuffers * (cm_data.buf_blockSize / 1024);
 
     memcpy(ioctlp->outDatap, &parms, sizeof(parms));
     ioctlp->outDatap += sizeof(parms);