Windows: fs getcacheparms

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>
This commit is contained in:
Jeffrey Altman 2012-04-25 18:05:01 -04:00 committed by Jeffrey Altman
parent 8095503bc1
commit 7d0a0b66cc

View 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);