[EMAIL PROTECTED] writes: > WARNING: storage file size reduced to 1073741824 due to system limitations > WARNING: storage file size reduced to 11756049694 (80% of available disk > space) > NB: Limiting size to 2GB on 32 bit architecture to prevent running out of > address space. Specifiy explicit size to override. > > What does it mean ?
The maximum cache size on a 32-bit machine is 2 GB (2^31 bytes); in addition, the size of the cache in bytes has to fit in off_t. If off_t is 32 bits, the maximum size is 2^31-1; Varnish will shift the requested cache size right (i.e. divide it by two) until it fits, so if you requested 2 GB (2^31, one byte too many) you get 1 GB (2^30). The second message is the result of a bug which causes Varnish to think that 1 GB is more than ~14 GB (the amount of free space in the file system on which you placed the cache file) and set the cache size to 80% of that, or ~11 GB. The third message is a consequence of the aforementioned bug; Varnish notices that ~11 GB is more than 2^31-1 and sets the cache size to 2^31-1 rounded down to the nearest page. Could you please test the attached patch? DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no
Index: bin/varnishd/storage_file.c =================================================================== --- bin/varnishd/storage_file.c (revision 1791) +++ bin/varnishd/storage_file.c (working copy) @@ -118,7 +118,7 @@ static void smf_calcsize(struct smf_sc *sc, const char *size, int newfile) { - uintmax_t l; + uintmax_t l, fssize; unsigned bs; char suff[2]; int i, explicit; @@ -127,6 +127,7 @@ AN(sc); AZ(fstat(sc->fd, &st)); + xxxassert(S_ISREG(st.st_mode)); #if defined(HAVE_SYS_MOUNT_H) || defined(HAVE_SYS_VFS_H) struct statfs fsst; @@ -137,9 +138,10 @@ bs = sc->pagesize; if (bs < fsst.f_bsize) bs = fsst.f_bsize; + xxxassert(bs % sc->pagesize == 0); + xxxassert(bs % fsst.f_bsize == 0); + fssize = fsst.f_bsize * fsst.f_bavail; - xxxassert(S_ISREG(st.st_mode)); - i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */ explicit = i; @@ -179,7 +181,7 @@ l *= (uintmax_t)(1024UL * 1024UL) * (uintmax_t)(1024UL * 1024UL); else if (suff[0] == '%') { - l *= fsst.f_bsize * fsst.f_bavail; + l *= fssize; l /= 100; } } @@ -200,14 +202,14 @@ if (l < st.st_size) { AZ(ftruncate(sc->fd, l)); - } else if (l - st.st_size > fsst.f_bsize * fsst.f_bavail) { - l = ((uintmax_t)fsst.f_bsize * fsst.f_bavail * 80) / 100; + } else if (l - st.st_size > fssize) { + l = fssize * 80 / 100; fprintf(stderr, "WARNING: storage file size reduced" " to %ju (80%% of available disk space)\n", l); } } - /* round down to of filesystem blocksize or pagesize */ + /* round down to multiple of filesystem blocksize or pagesize */ l -= (l % bs); if (l < MINPAGES * (uintmax_t)sc->pagesize) {
_______________________________________________ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc