--------------------- PatchSet 360 Date: 2002/12/13 22:16:44 Author: rbcollins Branch: unify-io Tag: (none) Log: make refobj a method (reference) Members: src/SwapDir.cc:1.1.2.12->1.1.2.13 src/SwapDir.h:1.1.2.17->1.1.2.18 src/store.cc:1.2.16.3->1.2.16.4 src/ufscommon.cc:1.4.10.19->1.4.10.20 src/ufscommon.h:1.1.20.41->1.1.20.42 src/fs/aufs/store_dir_aufs.cc:1.2.12.19->1.2.12.20 src/fs/coss/store_dir_coss.cc:1.4.10.16->1.4.10.17 src/fs/diskd/store_dir_diskd.cc:1.2.16.27->1.2.16.28 src/fs/ufs/store_dir_ufs.cc:1.1.20.22->1.1.20.23 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -r1.1.2.12 -r1.1.2.13 --- squid3/src/SwapDir.cc 13 Dec 2002 22:03:37 -0000 1.1.2.12 +++ squid3/src/SwapDir.cc 13 Dec 2002 22:16:44 -0000 1.1.2.13 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.12 2002/12/13 22:03:37 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.13 2002/12/13 22:16:44 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -72,3 +72,5 @@ void SwapDir::maintainfs(){} +void +SwapDir::reference(StoreEntry &){} Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.17 retrieving revision 1.1.2.18 diff -u -r1.1.2.17 -r1.1.2.18 --- squid3/src/SwapDir.h 13 Dec 2002 22:03:37 -0000 1.1.2.17 +++ squid3/src/SwapDir.h 13 Dec 2002 22:16:45 -0000 1.1.2.18 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.17 2002/12/13 22:03:37 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.18 2002/12/13 22:16:45 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -78,7 +78,7 @@ /* <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 */ + virtual void reference(StoreEntry &); /* Reference this object */ STUNREFOBJ *unrefobj; /* Unreference this object */ STCALLBACK *callback; /* Handle pending callbacks */ STSYNC *sync; /* Sync the directory */ Index: squid3/src/store.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store.cc,v retrieving revision 1.2.16.3 retrieving revision 1.2.16.4 diff -u -r1.2.16.3 -r1.2.16.4 --- squid3/src/store.cc 13 Dec 2002 21:23:11 -0000 1.2.16.3 +++ squid3/src/store.cc 13 Dec 2002 22:16:45 -0000 1.2.16.4 @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.2.16.3 2002/12/13 21:23:11 rbcollins Exp $ + * $Id: store.cc,v 1.2.16.4 2002/12/13 22:16:45 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -269,14 +269,9 @@ static void storeEntryReferenced(StoreEntry * e) { - SwapDir *SD; - /* Notify the fs that we're referencing this object again */ - if (e->swap_dirn > -1) { - SD = INDEXSD(e->swap_dirn); - if (SD->refobj) - SD->refobj(SD, e); - } + if (e->swap_dirn > -1) + INDEXSD(e->swap_dirn)->reference(*e); /* Notify the memory cache that we're referencing this object again */ if (e->mem_obj) { if (mem_policy->Referenced) Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.19 retrieving revision 1.4.10.20 diff -u -r1.4.10.19 -r1.4.10.20 --- squid3/src/ufscommon.cc 13 Dec 2002 21:27:01 -0000 1.4.10.19 +++ squid3/src/ufscommon.cc 13 Dec 2002 22:16:45 -0000 1.4.10.20 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.19 2002/12/13 21:27:01 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.20 2002/12/13 22:16:45 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1313,20 +1313,6 @@ return loadav; } #endif -/* - * commonUfsDirRefObj - * - * This routine is called whenever an object is referenced, so we can - * maintain replacement information within the storage fs. - */ -void -commonUfsDirRefObj(SwapDir * SD, StoreEntry * e) -{ - debug(47, 3) ("commonUfsDirRefObj: referencing %p %d/%d\n", e, e->swap_dirn, - e->swap_filen); - if (SD->repl->Referenced) - SD->repl->Referenced(SD->repl, e, &e->repl); -} /* * commonUfsDirUnrefObj Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.41 retrieving revision 1.1.20.42 diff -u -r1.1.20.41 -r1.1.20.42 --- squid3/src/ufscommon.h 13 Dec 2002 22:03:37 -0000 1.1.20.41 +++ squid3/src/ufscommon.h 13 Dec 2002 22:16:45 -0000 1.1.20.42 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.41 2002/12/13 22:03:37 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.42 2002/12/13 22:16:45 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -88,6 +88,7 @@ virtual void statfs(StoreEntry &)const; virtual void maintainfs(); virtual int canStore(StoreEntry const &)const = 0; + virtual void reference(StoreEntry &); 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.19 retrieving revision 1.2.12.20 diff -u -r1.2.12.19 -r1.2.12.20 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 22:03:37 -0000 1.2.12.19 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 22:16:45 -0000 1.2.12.20 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.19 2002/12/13 22:03:37 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.20 2002/12/13 22:16:45 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -188,7 +188,6 @@ aioinfo->map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; - sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; sd->callback = aioCheckCallbacks; sd->sync = aioSync; 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.16 retrieving revision 1.4.10.17 diff -u -r1.4.10.16 -r1.4.10.17 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 22:03:38 -0000 1.4.10.16 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 22:16:45 -0000 1.4.10.17 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.16 2002/12/13 22:03:38 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.17 2002/12/13 22:16:45 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -757,7 +757,6 @@ cs->fd = -1; cs->swaplog_fd = -1; - sd->refobj = NULL; /* LRU is done in storeCossRead */ sd->unrefobj = NULL; sd->callback = storeCossDirCallback; sd->sync = storeCossSync; 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.27 retrieving revision 1.2.16.28 diff -u -r1.2.16.27 -r1.2.16.28 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 22:03:38 -0000 1.2.16.27 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 22:16:46 -0000 1.2.16.28 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.27 2002/12/13 22:03:38 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.28 2002/12/13 22:16:46 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -394,7 +394,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; sd->callback = storeDiskdDirCallback; sd->sync = storeDiskdDirSync; 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.22 retrieving revision 1.1.20.23 diff -u -r1.1.20.22 -r1.1.20.23 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 22:03:38 -0000 1.1.20.22 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 22:16:46 -0000 1.1.20.23 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.22 2002/12/13 22:03:38 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.23 2002/12/13 22:16:46 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -169,7 +169,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; - sd->refobj = commonUfsDirRefObj; sd->unrefobj = commonUfsDirUnrefObj; sd->callback = NULL; sd->sync = NULL; @@ -366,3 +365,18 @@ debug(47, (removed ? 2 : 3)) ("commonUfsDirMaintain: %s removed %d/%d f=%.03f max_scan=%d\n", path, removed, max_remove, f, max_scan); } + +/* + * commonUfsDirRefObj + * + * This routine is called whenever an object is referenced, so we can + * maintain replacement information within the storage fs. + */ +void +UFSSwapDir::reference(StoreEntry &e) +{ + debug(47, 3) ("commonUfsDirRefObj: referencing %p %d/%d\n", &e, e.swap_dirn, + e.swap_filen); + if (repl->Referenced) + repl->Referenced(repl, &e, &e.repl); +}