From 04aecc99e073b07fe781d65c5c274acee14d8d26 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 27 Aug 2009 12:43:03 -0500 Subject: [PATCH] Fix cache tracking for small fragsizes The tracked amount of disk cache used by a client can be incorrect when afs_fsfragsize is tuned to below 1023. Since we round up to the next nearest afs_fsfragsize+1 then round down to the kb, if afs_fsfragsize+1 < 1kb, we can undershoot the cache usage. This enforces afs_fsfragsize to always be at least 1023. Reviewed-on: http://gerrit.openafs.org/338 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/afs/afs.h | 8 ++++++++ src/afs/afs_dcache.c | 2 +- src/afs/afs_init.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/afs/afs.h b/src/afs/afs.h index 20bde01e0..55a7c2e18 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -18,6 +18,14 @@ #include "afs/afs_args.h" #endif +/* + * afs_fsfragsize cannot be less than 1023, or some cache-tracking + * calculations will be incorrect (since we track cache usage in kb). + * Some filesystems have fundamental blocksizes less than 1k, and + * normally we would tune afs_fsfragsize to be fragsize-1, but we must + * make sure to check that afs_fsfragsize does not go below this value. + */ +#define AFS_MIN_FRAGSIZE 1023 /* Upper bound on number of iovecs out uio routines will deal with. */ #define AFS_MAXIOVCNT 16 diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index b73abf084..ff900f1e6 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -71,7 +71,7 @@ afs_int32 afs_cacheBlocks; /*!< 1K blocks in cache */ afs_int32 afs_cacheStats; /*!< Stat entries in cache */ afs_int32 afs_blocksUsed; /*!< Number of blocks in use */ afs_int32 afs_blocksDiscarded; /*!