--------------------- PatchSet 359 Date: 2002/12/13 22:03:37 Author: rbcollins Branch: unify-io Tag: (none) Log: make checkobj a method (canStore) Members: src/SwapDir.cc:1.1.2.11->1.1.2.12 src/SwapDir.h:1.1.2.16->1.1.2.17 src/store_dir.cc:1.4.10.5->1.4.10.6 src/ufscommon.h:1.1.20.40->1.1.20.41 src/fs/aufs/store_asyncufs.h:1.2.12.37->1.2.12.38 src/fs/aufs/store_dir_aufs.cc:1.2.12.18->1.2.12.19 src/fs/coss/store_coss.h:1.3.10.16->1.3.10.17 src/fs/coss/store_dir_coss.cc:1.4.10.15->1.4.10.16 src/fs/diskd/store_dir_diskd.cc:1.2.16.26->1.2.16.27 src/fs/diskd/store_diskd.h:1.1.20.38->1.1.20.39 src/fs/null/store_null.cc:1.1.20.8->1.1.20.9 src/fs/ufs/store_dir_ufs.cc:1.1.20.21->1.1.20.22 src/fs/ufs/store_ufs.h:1.1.20.28->1.1.20.29 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -r1.1.2.11 -r1.1.2.12 --- squid3/src/SwapDir.cc 13 Dec 2002 21:23:11 -0000 1.1.2.11 +++ squid3/src/SwapDir.cc 13 Dec 2002 22:03:37 -0000 1.1.2.12 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.11 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.12 2002/12/13 22:03:37 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -71,3 +71,4 @@ void SwapDir::maintainfs(){} + Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -u -r1.1.2.16 -r1.1.2.17 --- squid3/src/SwapDir.h 13 Dec 2002 21:23:11 -0000 1.1.2.16 +++ squid3/src/SwapDir.h 13 Dec 2002 22:03:37 -0000 1.1.2.17 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.16 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.17 2002/12/13 22:03:37 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,7 +34,6 @@ #ifndef SQUID_SWAPDIR_H #define SQUID_SWAPDIR_H -typedef int STCHECKOBJ(SwapDir *, const StoreEntry *); typedef void STREFOBJ(SwapDir *, StoreEntry *); typedef void STUNREFOBJ(SwapDir *, StoreEntry *); typedef void STDONE(void); @@ -76,7 +75,8 @@ virtual bool doubleCheck(StoreEntry &); /* Double check the obj integrity */ virtual void statfs(StoreEntry &) const; /* Dump fs statistics */ virtual void maintainfs(); /* Replacement maintainence */ - STCHECKOBJ *checkobj; /* Check if the fs will store an object */ + /* <0 == error. > 1000 == error */ + virtual int canStore(StoreEntry const &)const = 0; /* Check if the fs will store an object */ /* These two are notifications */ STREFOBJ *refobj; /* Reference this object */ STUNREFOBJ *unrefobj; /* Unreference this object */ Index: squid3/src/store_dir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_dir.cc,v retrieving revision 1.4.10.5 retrieving revision 1.4.10.6 diff -u -r1.4.10.5 -r1.4.10.6 --- squid3/src/store_dir.cc 13 Dec 2002 21:09:18 -0000 1.4.10.5 +++ squid3/src/store_dir.cc 13 Dec 2002 22:03:37 -0000 1.4.10.6 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.4.10.5 2002/12/13 21:09:18 rbcollins Exp $ + * $Id: store_dir.cc,v 1.4.10.6 2002/12/13 22:03:37 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -152,7 +152,7 @@ if (!storeDirValidSwapDirSize(i, objsize)) continue; /* check for error or overload condition */ - load = sd->checkobj(sd, e); + load = sd->canStore(*e); if (load < 0 || load > 1000) { continue; } @@ -193,7 +193,7 @@ for (i = 0; i < Config.cacheSwap.n_configured; i++) { SD = INDEXSD(i); SD->flags.selected = 0; - load = SD->checkobj(SD, e); + load = SD->canStore(*e); if (load < 0 || load > 1000) { continue; } Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.40 retrieving revision 1.1.20.41 diff -u -r1.1.20.40 -r1.1.20.41 --- squid3/src/ufscommon.h 13 Dec 2002 21:23:11 -0000 1.1.20.40 +++ squid3/src/ufscommon.h 13 Dec 2002 22:03:37 -0000 1.1.20.41 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.40 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.41 2002/12/13 22:03:37 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -87,6 +87,7 @@ virtual void unlink(StoreEntry &) = 0; virtual void statfs(StoreEntry &)const; virtual void maintainfs(); + virtual int canStore(StoreEntry const &)const = 0; void unlinkFile(sfileno f); // move down when unlink is a virtual method Index: squid3/src/fs/aufs/store_asyncufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_asyncufs.h,v retrieving revision 1.2.12.37 retrieving revision 1.2.12.38 diff -u -r1.2.12.37 -r1.2.12.38 --- squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 20:43:45 -0000 1.2.12.37 +++ squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 22:03:37 -0000 1.2.12.38 @@ -158,6 +158,7 @@ public: virtual void dump(StoreEntry &)const; virtual void unlink(StoreEntry &); + virtual int canStore(StoreEntry const &)const; }; #include "IOStrategy.h" 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.18 retrieving revision 1.2.12.19 diff -u -r1.2.12.18 -r1.2.12.19 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 21:23:11 -0000 1.2.12.18 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 22:03:37 -0000 1.2.12.19 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.18 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.19 2002/12/13 22:03:37 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -45,7 +45,6 @@ MemPool *aufs_qwrite_pool = NULL; static int asyncufs_initialised = 0; -static STCHECKOBJ storeAufsDirCheckObj; static void storeAufsDirIOUnlinkFile(char *path); @@ -60,15 +59,15 @@ * happily store anything as long as the LRU time isn't too small. */ int -storeAufsDirCheckObj(SwapDir * SD, const StoreEntry * e) +AUFSSwapDir::canStore(StoreEntry const &e) const { int loadav; int ql; #if OLD_UNUSED_CODE - if (storeAufsDirExpiredReferenceAge(SD) < 300) { + if (storeAufsDirExpiredReferenceAge(this) < 300) { debug(47, 3) ("storeAufsDirCheckObj: NO: LRU Age = %d\n", - storeAufsDirExpiredReferenceAge(SD)); + storeAufsDirExpiredReferenceAge(this)); /* store_check_cachable_hist.no.lru_age_too_low++; */ return -1; } @@ -189,7 +188,6 @@ aioinfo->map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; - sd->checkobj = storeAufsDirCheckObj; sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; sd->callback = aioCheckCallbacks; Index: squid3/src/fs/coss/store_coss.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_coss.h,v retrieving revision 1.3.10.16 retrieving revision 1.3.10.17 diff -u -r1.3.10.16 -r1.3.10.17 --- squid3/src/fs/coss/store_coss.h 13 Dec 2002 21:09:25 -0000 1.3.10.16 +++ squid3/src/fs/coss/store_coss.h 13 Dec 2002 22:03:37 -0000 1.3.10.17 @@ -112,6 +112,7 @@ ~CossSwapDir(); virtual void unlink (StoreEntry &); virtual void statfs (StoreEntry &)const; + virtual int canStore(StoreEntry const &)const; }; extern off_t storeCossAllocate(SwapDir * SD, const StoreEntry * e, int which); 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.15 retrieving revision 1.4.10.16 diff -u -r1.4.10.15 -r1.4.10.16 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 21:23:11 -0000 1.4.10.15 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 22:03:38 -0000 1.4.10.16 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.15 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.16 2002/12/13 22:03:38 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -82,7 +82,6 @@ static STLOGCLEANDONE storeCossDirWriteCleanDone; static STLOGCLOSE storeCossDirCloseSwapLog; static STLOGWRITE storeCossDirSwapLog; -static STCHECKOBJ storeCossDirCheckObj; static STFSPARSE storeCossDirParse; static STFSRECONFIGURE storeCossDirReconfigure; static STCALLBACK storeCossDirCallback; @@ -680,13 +679,13 @@ * done by the upper layers. */ int -storeCossDirCheckObj(SwapDir * SD, const StoreEntry * e) +CossSwapDir::canStore(StoreEntry const &e)const { - CossInfo *cs = (CossInfo *) SD->fsdata; + CossInfo *cs = (CossInfo *) fsdata; int loadav; /* Check if the object is a special object, we can't cache these */ - if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) + if (EBIT_TEST(e.flags, ENTRY_SPECIAL)) return -1; /* Otherwise, we're ok */ @@ -695,7 +694,6 @@ return loadav; } - /* * storeCossDirCallback - do the IO completions */ @@ -759,7 +757,6 @@ cs->fd = -1; cs->swaplog_fd = -1; - sd->checkobj = storeCossDirCheckObj; sd->refobj = NULL; /* LRU is done in storeCossRead */ sd->unrefobj = NULL; sd->callback = storeCossDirCallback; 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.26 retrieving revision 1.2.16.27 diff -u -r1.2.16.26 -r1.2.16.27 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 21:23:11 -0000 1.2.16.26 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 22:03:38 -0000 1.2.16.27 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.26 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.27 2002/12/13 22:03:38 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -50,7 +50,6 @@ static int diskd_initialised = 0; -static STCHECKOBJ storeDiskdDirCheckObj; static void storeDiskdStats(StoreEntry * sentry); static void storeDiskdDirSync(SwapDir *); static void storeDiskdDirIOUnlinkFile(char *path); @@ -214,11 +213,11 @@ * happily store anything as long as the LRU time isn't too small. */ int -storeDiskdDirCheckObj(SwapDir * SD, const StoreEntry * e) +DiskdSwapDir::canStore(StoreEntry const &e)const { - if (SD->IO->shedLoad()) + if (IO->shedLoad()) return -1; - return SD->IO->load(); + return IO->load(); } void @@ -395,7 +394,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - sd->checkobj = storeDiskdDirCheckObj; sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; sd->callback = storeDiskdDirCallback; Index: squid3/src/fs/diskd/store_diskd.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_diskd.h,v retrieving revision 1.1.20.38 retrieving revision 1.1.20.39 diff -u -r1.1.20.38 -r1.1.20.39 --- squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 21:09:27 -0000 1.1.20.38 +++ squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 22:03:38 -0000 1.1.20.39 @@ -144,6 +144,7 @@ virtual void dump(StoreEntry &)const; virtual void unlink(StoreEntry &); virtual void statfs (StoreEntry &) const; + virtual int canStore(StoreEntry const &) const; }; #define SHMBUF_BLKSZ SM_PAGE_SIZE Index: squid3/src/fs/null/store_null.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/null/store_null.cc,v retrieving revision 1.1.20.8 retrieving revision 1.1.20.9 diff -u -r1.1.20.8 -r1.1.20.9 --- squid3/src/fs/null/store_null.cc 13 Dec 2002 21:09:27 -0000 1.1.20.8 +++ squid3/src/fs/null/store_null.cc 13 Dec 2002 22:03:38 -0000 1.1.20.9 @@ -1,6 +1,6 @@ /* - * $Id: store_null.cc,v 1.1.20.8 2002/12/13 21:09:27 rbcollins Exp $ + * $Id: store_null.cc,v 1.1.20.9 2002/12/13 22:03:38 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -55,10 +55,10 @@ { public: virtual void init(); + virtual int canStore(StoreEntry const &)const; }; static int null_initialised = 0; -static STCHECKOBJ storeNullDirCheckObj; static STFSRECONFIGURE storeNullDirReconfigure; static STLOGCLEANSTART storeNullDirWriteCleanStart; static STLOGCLEANDONE storeNullDirWriteCleanDone; @@ -123,8 +123,8 @@ storeRebuildComplete(&counts); } -static int -storeNullDirCheckObj(SwapDir * SD, const StoreEntry * e) +int +NullSwapDir::canStore(StoreEntry const &)const { return -1; } @@ -146,7 +146,6 @@ { sd->index = index; sd->path = xstrdup(path); - sd->checkobj = storeNullDirCheckObj; sd->log.clean.start = storeNullDirWriteCleanStart; sd->log.clean.done = storeNullDirWriteCleanDone; parse_cachedir_options(sd, NULL, 0); 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.21 retrieving revision 1.1.20.22 diff -u -r1.1.20.21 -r1.1.20.22 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 21:27:02 -0000 1.1.20.21 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 22:03:38 -0000 1.1.20.22 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.21 2002/12/13 21:27:02 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.22 2002/12/13 22:03:38 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -42,7 +42,6 @@ #include "SwapDir.h" static int ufs_initialised = 0; -static STCHECKOBJ storeUfsDirCheckObj; static void storeUfsDirIOUnlinkFile(char *path); STSETUP storeFsSetup_ufs; @@ -55,7 +54,7 @@ * happily store anything as long as the LRU time isn't too small. */ int -storeUfsDirCheckObj(SwapDir * SD, const StoreEntry * e) +UfsSwapDir::canStore(StoreEntry const &e)const { /* Return 999 (99.9%) constant load */ return 999; @@ -170,7 +169,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; - sd->checkobj = storeUfsDirCheckObj; sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; sd->callback = NULL; Index: squid3/src/fs/ufs/store_ufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/Attic/store_ufs.h,v retrieving revision 1.1.20.28 retrieving revision 1.1.20.29 diff -u -r1.1.20.28 -r1.1.20.29 --- squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 20:44:05 -0000 1.1.20.28 +++ squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 22:03:38 -0000 1.1.20.29 @@ -60,6 +60,7 @@ class UfsSwapDir: public UFSSwapDir { virtual void dump(StoreEntry &)const; virtual void unlink(StoreEntry &); + virtual int canStore(StoreEntry const&)const; }; #include "IOStrategy.h"