]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Fix cache tracking for small fragsizes
authorAndrew Deason <adeason@sinenomine.net>
Thu, 27 Aug 2009 17:43:03 +0000 (12:43 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Tue, 1 Sep 2009 11:38:43 +0000 (04:38 -0700)
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 <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/afs/afs.h
src/afs/afs_dcache.c
src/afs/afs_init.c

index 20bde01e0baaf2a4b524b87a0adbeeef5a04a188..55a7c2e1848cdbe67a941ba9a0e07ef7d3345615 100644 (file)
 #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
index b73abf084c17bc90e98f7dd529321123e9404a03..ff900f1e61a07e2c9dce16136ac561492411d2cd 100644 (file)
@@ -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; /*!<Blocks freed but not truncated */
-afs_int32 afs_fsfragsize = 1023;       /*!< Underlying Filesystem minimum unit 
+afs_int32 afs_fsfragsize = AFS_MIN_FRAGSIZE;   /*!< Underlying Filesystem minimum unit 
                                         *of disk allocation usually 1K
                                         *this value is (truefrag -1 ) to
                                         *save a bunch of subtracts... */
index f823f16ba4f95e478f2da0ce66f2fee7fb3a7c29..46df030c3a26a71840a6d4968a988d20b79edeb8 100644 (file)
@@ -457,6 +457,9 @@ afs_InitCacheInfo(register char *afile)
 #endif /* AFS_LINUX20_ENV */
     AFS_RELE(filevp);
 #endif /* AFS_LINUX22_ENV */
+    if (afs_fsfragsize < AFS_MIN_FRAGSIZE) {
+       afs_fsfragsize = AFS_MIN_FRAGSIZE;
+    }
     tfile = osi_UFSOpen(&cacheInode);
     afs_osi_Stat(tfile, &tstat);
     cacheInfoModTime = tstat.mtime;