--------------------- PatchSet 356 Date: 2002/12/13 21:23:11 Author: rbcollins Branch: unify-io Tag: (none) Log: make maintainfs a method Members: src/SwapDir.cc:1.1.2.10->1.1.2.11 src/SwapDir.h:1.1.2.15->1.1.2.16 src/store.cc:1.2.16.2->1.2.16.3 src/ufscommon.cc:1.4.10.16->1.4.10.17 src/ufscommon.h:1.1.20.39->1.1.20.40 src/fs/aufs/store_dir_aufs.cc:1.2.12.17->1.2.12.18 src/fs/coss/store_dir_coss.cc:1.4.10.14->1.4.10.15 src/fs/diskd/store_dir_diskd.cc:1.2.16.25->1.2.16.26 src/fs/ufs/store_dir_ufs.cc:1.1.20.18->1.1.20.19 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- squid3/src/SwapDir.cc 13 Dec 2002 21:09:17 -0000 1.1.2.10 +++ squid3/src/SwapDir.cc 13 Dec 2002 21:23:11 -0000 1.1.2.11 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.10 2002/12/13 21:09:17 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.11 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -68,3 +68,6 @@ void SwapDir::statfs(StoreEntry &)const {} + +void +SwapDir::maintainfs(){} Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -r1.1.2.15 -r1.1.2.16 --- squid3/src/SwapDir.h 13 Dec 2002 21:09:17 -0000 1.1.2.15 +++ squid3/src/SwapDir.h 13 Dec 2002 21:23:11 -0000 1.1.2.16 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.15 2002/12/13 21:09:17 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.16 2002/12/13 21:23:11 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,7 +34,6 @@ #ifndef SQUID_SWAPDIR_H #define SQUID_SWAPDIR_H -typedef void STMAINTAINFS(SwapDir *); typedef int STCHECKOBJ(SwapDir *, const StoreEntry *); typedef void STREFOBJ(SwapDir *, StoreEntry *); typedef void STUNREFOBJ(SwapDir *, StoreEntry *); @@ -76,7 +75,7 @@ virtual void dump(StoreEntry &)const; /* Dump fs config snippet */ virtual bool doubleCheck(StoreEntry &); /* Double check the obj integrity */ virtual void statfs(StoreEntry &) const; /* Dump fs statistics */ - STMAINTAINFS *maintainfs; /* Replacement maintainence */ + virtual void maintainfs(); /* Replacement maintainence */ STCHECKOBJ *checkobj; /* Check if the fs will store an object */ /* These two are notifications */ STREFOBJ *refobj; /* Reference this object */ Index: squid3/src/store.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store.cc,v retrieving revision 1.2.16.2 retrieving revision 1.2.16.3 diff -u -r1.2.16.2 -r1.2.16.3 --- squid3/src/store.cc 2 Dec 2002 15:25:38 -0000 1.2.16.2 +++ squid3/src/store.cc 13 Dec 2002 21:23:11 -0000 1.2.16.3 @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.2.16.2 2002/12/02 15:25:38 rbcollins Exp $ + * $Id: store.cc,v 1.2.16.3 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -889,7 +889,6 @@ /* * This routine is to be called by main loop in main.c. * It removes expired objects on only one bucket for each time called. - * returns the number of objects removed * * This should get called 1/s from main(). */ @@ -908,8 +907,7 @@ /* XXX FixMe: This should be done "in parallell" on the different * cache_dirs, not one at a time. */ - if (SD->maintainfs != NULL) - SD->maintainfs(SD); + SD->maintainfs(); } if (store_swap_size > Config.Swap.maxSize) { if (squid_curtime - last_warn_time > 10) { Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.16 retrieving revision 1.4.10.17 diff -u -r1.4.10.16 -r1.4.10.17 --- squid3/src/ufscommon.cc 13 Dec 2002 21:09:19 -0000 1.4.10.16 +++ squid3/src/ufscommon.cc 13 Dec 2002 21:23:11 -0000 1.4.10.17 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.16 2002/12/13 21:09:19 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.17 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1284,7 +1284,7 @@ } void -commonUfsDirMaintain(SwapDir * SD) +UFSSwapDir::maintainfs() { StoreEntry *e = NULL; int removed = 0; @@ -1296,7 +1296,7 @@ if (store_dirs_rebuilding) { return; } else { - f = (double) (SD->cur_size - SD->low_size) / (SD->max_size - SD->low_size); + f = (double) (cur_size - low_size) / (max_size - low_size); f = f < 0.0 ? 0.0 : f > 1.0 ? 1.0 : f; max_scan = (int) (f * 400.0 + 100.0); max_remove = (int) (f * 70.0 + 10.0); @@ -1306,9 +1306,9 @@ } debug(47, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n", f, max_scan, max_remove); - walker = SD->repl->PurgeInit(SD->repl, max_scan); + walker = repl->PurgeInit(repl, max_scan); while (1) { - if (SD->cur_size < SD->low_size) + if (cur_size < low_size) break; if (removed >= max_remove) break; @@ -1320,7 +1320,7 @@ } walker->Done(walker); debug(47, (removed ? 2 : 3)) ("commonUfsDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n", - SD->path, removed, max_remove, f, max_scan); + path, removed, max_remove, f, max_scan); } #if 0 Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.39 retrieving revision 1.1.20.40 diff -u -r1.1.20.39 -r1.1.20.40 --- squid3/src/ufscommon.h 13 Dec 2002 21:09:22 -0000 1.1.20.39 +++ squid3/src/ufscommon.h 13 Dec 2002 21:23:11 -0000 1.1.20.40 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.39 2002/12/13 21:09:22 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.40 2002/12/13 21:23:11 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -86,6 +86,7 @@ virtual bool doubleCheck(StoreEntry &); virtual void unlink(StoreEntry &) = 0; virtual void statfs(StoreEntry &)const; + virtual void maintainfs(); void unlinkFile(sfileno f); // move down when unlink is a virtual method Index: squid3/src/fs/aufs/store_dir_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_dir_aufs.cc,v retrieving revision 1.2.12.17 retrieving revision 1.2.12.18 diff -u -r1.2.12.17 -r1.2.12.18 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 21:09:23 -0000 1.2.12.17 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 21:23:11 -0000 1.2.12.18 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.17 2002/12/13 21:09:23 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.18 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -189,7 +189,6 @@ aioinfo->map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; - sd->maintainfs = commonUfsDirMaintain; sd->checkobj = storeAufsDirCheckObj; sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; Index: squid3/src/fs/coss/store_dir_coss.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_dir_coss.cc,v retrieving revision 1.4.10.14 retrieving revision 1.4.10.15 diff -u -r1.4.10.14 -r1.4.10.15 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 21:09:26 -0000 1.4.10.14 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 21:23:11 -0000 1.4.10.15 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.14 2002/12/13 21:09:26 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.15 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -759,7 +759,6 @@ cs->fd = -1; cs->swaplog_fd = -1; - sd->maintainfs = NULL; sd->checkobj = storeCossDirCheckObj; sd->refobj = NULL; /* LRU is done in storeCossRead */ sd->unrefobj = NULL; Index: squid3/src/fs/diskd/store_dir_diskd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_dir_diskd.cc,v retrieving revision 1.2.16.25 retrieving revision 1.2.16.26 diff -u -r1.2.16.25 -r1.2.16.26 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 21:11:11 -0000 1.2.16.25 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 21:23:11 -0000 1.2.16.26 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.25 2002/12/13 21:11:11 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.26 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -395,7 +395,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - sd->maintainfs = commonUfsDirMaintain; sd->checkobj = storeDiskdDirCheckObj; sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; Index: squid3/src/fs/ufs/store_dir_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_dir_ufs.cc,v retrieving revision 1.1.20.18 retrieving revision 1.1.20.19 diff -u -r1.1.20.18 -r1.1.20.19 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 21:09:28 -0000 1.1.20.18 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 21:23:11 -0000 1.1.20.19 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.18 2002/12/13 21:09:28 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.19 2002/12/13 21:23:11 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -170,7 +170,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; - sd->maintainfs = commonUfsDirMaintain; sd->checkobj = storeUfsDirCheckObj; sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj;