--------------------- PatchSet 352 Date: 2002/12/13 12:17:20 Author: rbcollins Branch: unify-io Tag: (none) Log: unlink is a method of the swapdir Members: src/SwapDir.cc:1.1.2.8->1.1.2.9 src/SwapDir.h:1.1.2.12->1.1.2.13 src/store_io.cc:1.3.10.6->1.3.10.7 src/ufscommon.h:1.1.20.36->1.1.20.37 src/fs/aufs/store_asyncufs.h:1.2.12.35->1.2.12.36 src/fs/aufs/store_dir_aufs.cc:1.2.12.14->1.2.12.15 src/fs/aufs/store_io_aufs.cc:1.3.12.35->1.3.12.36 src/fs/coss/store_coss.h:1.3.10.13->1.3.10.14 src/fs/coss/store_dir_coss.cc:1.4.10.11->1.4.10.12 src/fs/coss/store_io_coss.cc:1.3.10.9->1.3.10.10 src/fs/diskd/store_dir_diskd.cc:1.2.16.21->1.2.16.22 src/fs/diskd/store_diskd.h:1.1.20.35->1.1.20.36 src/fs/diskd/store_io_diskd.cc:1.1.20.40->1.1.20.41 src/fs/ufs/store_dir_ufs.cc:1.1.20.15->1.1.20.16 src/fs/ufs/store_io_ufs.cc:1.3.10.41->1.3.10.42 src/fs/ufs/store_ufs.h:1.1.20.26->1.1.20.27 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- squid3/src/SwapDir.cc 13 Dec 2002 11:35:58 -0000 1.1.2.8 +++ squid3/src/SwapDir.cc 13 Dec 2002 12:17:20 -0000 1.1.2.9 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.8 2002/12/13 11:35:58 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.9 2002/12/13 12:17:20 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -62,3 +62,6 @@ { return false; } + +void +SwapDir::unlink(StoreEntry &){} Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,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.h 13 Dec 2002 11:35:58 -0000 1.1.2.12 +++ squid3/src/SwapDir.h 13 Dec 2002 12:17:21 -0000 1.1.2.13 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.12 2002/12/13 11:35:58 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.13 2002/12/13 12:17:21 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -48,7 +48,6 @@ typedef StoreIOState::Pointer STOBJCREATE(SwapDir *, StoreEntry *, STFNCB *, STIOCB *, void *); typedef StoreIOState::Pointer STOBJOPEN(SwapDir *, StoreEntry *, STFNCB *, STIOCB *, void *); typedef void STOBJCLOSE(SwapDir *, storeIOState *); -typedef void STOBJUNLINK(SwapDir *, StoreEntry *); class IOStrategy; struct SwapDir { @@ -89,8 +88,8 @@ STOBJCREATE *create; STOBJOPEN *open; STOBJCLOSE *close; - STOBJUNLINK *unlink; } obj; + virtual void unlink (StoreEntry &); struct { STLOGOPEN *open; STLOGCLOSE *close; Index: squid3/src/store_io.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_io.cc,v retrieving revision 1.3.10.6 retrieving revision 1.3.10.7 diff -u -r1.3.10.6 -r1.3.10.7 --- squid3/src/store_io.cc 11 Dec 2002 21:45:22 -0000 1.3.10.6 +++ squid3/src/store_io.cc 13 Dec 2002 12:17:21 -0000 1.3.10.7 @@ -91,8 +91,8 @@ void storeUnlink(StoreEntry * e) { - SwapDir *SD = INDEXSD(e->swap_dirn); - SD->obj.unlink(SD, e); + assert (e); + INDEXSD(e->swap_dirn)->unlink(*e); } /* Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.36 retrieving revision 1.1.20.37 diff -u -r1.1.20.36 -r1.1.20.37 --- squid3/src/ufscommon.h 13 Dec 2002 11:52:01 -0000 1.1.20.36 +++ squid3/src/ufscommon.h 13 Dec 2002 12:17:21 -0000 1.1.20.37 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.36 2002/12/13 11:52:01 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.37 2002/12/13 12:17:21 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -84,6 +84,7 @@ virtual void dump(StoreEntry &) const; ~UFSSwapDir(); virtual bool doubleCheck(StoreEntry &); + virtual void unlink(StoreEntry &) = 0; void unlinkFile(sfileno f); 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.35 retrieving revision 1.2.12.36 diff -u -r1.2.12.35 -r1.2.12.36 --- squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 10:45:15 -0000 1.2.12.35 +++ squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 12:17:21 -0000 1.2.12.36 @@ -153,12 +153,12 @@ */ #include "SwapDir.h" extern STOBJCLOSE storeAufsClose; -extern STOBJUNLINK storeAufsUnlink; class AUFSSwapDir : public UFSSwapDir { public: virtual void dump(StoreEntry &)const; + virtual void unlink(StoreEntry &); }; #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.14 retrieving revision 1.2.12.15 diff -u -r1.2.12.14 -r1.2.12.15 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 11:35:58 -0000 1.2.12.14 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 12:17:21 -0000 1.2.12.15 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.14 2002/12/13 11:35:58 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.15 2002/12/13 12:17:21 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -199,7 +199,6 @@ sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; sd->obj.close = storeAufsClose; - sd->obj.unlink = storeAufsUnlink; sd->log.open = commonUfsDirOpenSwapLog; sd->log.close = commonUfsDirCloseSwapLog; sd->log.write = commonUfsDirSwapLog; Index: squid3/src/fs/aufs/store_io_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_io_aufs.cc,v retrieving revision 1.3.12.35 retrieving revision 1.3.12.36 diff -u -r1.3.12.35 -r1.3.12.36 --- squid3/src/fs/aufs/store_io_aufs.cc 13 Dec 2002 03:07:10 -0000 1.3.12.35 +++ squid3/src/fs/aufs/store_io_aufs.cc 13 Dec 2002 12:17:21 -0000 1.3.12.36 @@ -277,12 +277,12 @@ /* Unlink */ void -storeAufsUnlink(SwapDir * SD, StoreEntry * e) +AUFSSwapDir::unlink(StoreEntry & e) { - debug(79, 3) ("storeAufsUnlink: dirno %d, fileno %08X\n", SD->index, e->swap_filen); - commonUfsDirReplRemove(e); - commonUfsDirMapBitReset(SD, e->swap_filen); - commonUfsDirUnlinkFile(SD, e->swap_filen); + debug(79, 3) ("storeAufsUnlink: dirno %d, fileno %08X\n", index, e.swap_filen); + commonUfsDirReplRemove(&e); + commonUfsDirMapBitReset(this, e.swap_filen); + unlinkFile(e.swap_filen); } /* === STATIC =========================================================== */ 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.13 retrieving revision 1.3.10.14 diff -u -r1.3.10.13 -r1.3.10.14 --- squid3/src/fs/coss/store_coss.h 13 Dec 2002 11:17:46 -0000 1.3.10.13 +++ squid3/src/fs/coss/store_coss.h 13 Dec 2002 12:17:21 -0000 1.3.10.14 @@ -98,7 +98,6 @@ extern STOBJCREATE storeCossCreate; extern STOBJOPEN storeCossOpen; extern STOBJCLOSE storeCossClose; -extern STOBJUNLINK storeCossUnlink; extern STSYNC storeCossSync; class CossSwapDir : public SwapDir @@ -108,6 +107,7 @@ virtual void newFileSystem(); virtual void dump(StoreEntry &)const; ~CossSwapDir(); + virtual void unlink (StoreEntry &); }; 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.11 retrieving revision 1.4.10.12 diff -u -r1.4.10.11 -r1.4.10.12 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 11:35:59 -0000 1.4.10.11 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 12:17:21 -0000 1.4.10.12 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.11 2002/12/13 11:35:59 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.12 2002/12/13 12:17:21 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -770,7 +770,6 @@ sd->obj.create = storeCossCreate; sd->obj.open = storeCossOpen; sd->obj.close = storeCossClose; - sd->obj.unlink = storeCossUnlink; sd->log.open = storeCossDirOpenSwapLog; sd->log.close = storeCossDirCloseSwapLog; Index: squid3/src/fs/coss/store_io_coss.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_io_coss.cc,v retrieving revision 1.3.10.9 retrieving revision 1.3.10.10 diff -u -r1.3.10.9 -r1.3.10.10 --- squid3/src/fs/coss/store_io_coss.cc 11 Dec 2002 21:45:23 -0000 1.3.10.9 +++ squid3/src/fs/coss/store_io_coss.cc 13 Dec 2002 12:17:21 -0000 1.3.10.10 @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.cc,v 1.3.10.9 2002/12/11 21:45:23 rbcollins Exp $ + * $Id: store_io_coss.cc,v 1.3.10.10 2002/12/13 12:17:21 rbcollins Exp $ * * DEBUG: section 79 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -167,10 +167,10 @@ } void -storeCossUnlink(SwapDir * SD, StoreEntry * e) +CossSwapDir::unlink(StoreEntry & e) { - debug(79, 3) ("storeCossUnlink: offset %d\n", e->swap_filen); - storeCossRemove(SD, e); + debug(79, 3) ("storeCossUnlink: offset %d\n", e.swap_filen); + storeCossRemove(this, &e); } 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.21 retrieving revision 1.2.16.22 diff -u -r1.2.16.21 -r1.2.16.22 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 11:35:59 -0000 1.2.16.21 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 12:17:21 -0000 1.2.16.22 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.21 2002/12/13 11:35:59 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.22 2002/12/13 12:17:21 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -406,7 +406,6 @@ sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; sd->obj.close = storeDiskdClose; - sd->obj.unlink = storeDiskdUnlink; sd->log.open = commonUfsDirOpenSwapLog; sd->log.close = commonUfsDirCloseSwapLog; sd->log.write = commonUfsDirSwapLog; 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.35 retrieving revision 1.1.20.36 diff -u -r1.1.20.35 -r1.1.20.36 --- squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 10:45:15 -0000 1.1.20.35 +++ squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 12:17:21 -0000 1.1.20.36 @@ -135,12 +135,12 @@ extern STOBJCREATE storeDiskdCreate; extern STOBJOPEN storeDiskdOpen; extern STOBJCLOSE storeDiskdClose; -extern STOBJUNLINK storeDiskdUnlink; class DiskdSwapDir : public UFSSwapDir { virtual void init(); virtual void dump(StoreEntry &)const; + virtual void unlink(StoreEntry &); }; #define SHMBUF_BLKSZ SM_PAGE_SIZE Index: squid3/src/fs/diskd/store_io_diskd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_io_diskd.cc,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/fs/diskd/store_io_diskd.cc 13 Dec 2002 11:52:01 -0000 1.1.20.40 +++ squid3/src/fs/diskd/store_io_diskd.cc 13 Dec 2002 12:17:21 -0000 1.1.20.41 @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.cc,v 1.1.20.40 2002/12/13 11:52:01 rbcollins Exp $ + * $Id: store_io_diskd.cc,v 1.1.20.41 2002/12/13 12:17:21 rbcollins Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -511,36 +511,36 @@ } void -storeDiskdUnlink(SwapDir * SD, StoreEntry * e) +DiskdSwapDir::unlink(StoreEntry & e) { int x; off_t shm_offset; char *buf; - debug(79, 3) ("storeDiskdUnlink: dirno %d, fileno %08X\n", SD->index, - e->swap_filen); - commonUfsDirReplRemove(e); - commonUfsDirMapBitReset(SD, e->swap_filen); - if (SD->IO->shedLoad()) { + debug(79, 3) ("storeDiskdUnlink: dirno %d, fileno %08X\n", index, + e.swap_filen); + commonUfsDirReplRemove(&e); + commonUfsDirMapBitReset(this, e.swap_filen); + if (IO->shedLoad()) { /* Damn, we need to issue a sync unlink here :( */ debug(79, 2) ("storeDiskUnlink: Out of queue space, sync unlink\n"); - commonUfsDirUnlinkFile(SD, e->swap_filen); + unlinkFile(e.swap_filen); return; } /* We can attempt a diskd unlink */ - buf = (char *)((DiskdIO *)SD->IO)->shm.get(&shm_offset); - xstrncpy(buf, ((UFSSwapDir *)SD)->fullPath(e->swap_filen, NULL), SHMBUF_BLKSZ); + buf = (char *)((DiskdIO *)IO)->shm.get(&shm_offset); + xstrncpy(buf, fullPath(e.swap_filen, NULL), SHMBUF_BLKSZ); x = storeDiskdSend(_MQD_UNLINK, - (DiskdIO *)SD->IO, - e->swap_filen, + (DiskdIO *)IO, + e.swap_filen, (StoreIOState::Pointer )NULL, 0, 0, shm_offset); if (x < 0) { debug(79, 1) ("storeDiskdSend UNLINK: %s\n", xstrerror()); - unlink(buf); /* XXX EWW! */ - ((DiskdIO *)SD->IO)->shm.put (shm_offset); + ::unlink(buf); /* XXX EWW! */ + ((DiskdIO *)IO)->shm.put (shm_offset); } diskd_stats.unlink.ops++; } 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.15 retrieving revision 1.1.20.16 diff -u -r1.1.20.15 -r1.1.20.16 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 11:57:47 -0000 1.1.20.15 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 12:17:21 -0000 1.1.20.16 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.15 2002/12/13 11:57:47 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.16 2002/12/13 12:17:21 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -180,7 +180,6 @@ sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; sd->obj.close = storeUfsClose; - sd->obj.unlink = storeUfsUnlink; sd->log.open = commonUfsDirOpenSwapLog; sd->log.close = commonUfsDirCloseSwapLog; sd->log.write = commonUfsDirSwapLog; @@ -247,7 +246,7 @@ static SwapDir * storeUfsNew(void) { - SwapDir *result = new UFSSwapDir; + SwapDir *result = new UfsSwapDir; result->IO = &UfsIO::Instance; return result; } Index: squid3/src/fs/ufs/store_io_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_io_ufs.cc,v retrieving revision 1.3.10.41 retrieving revision 1.3.10.42 diff -u -r1.3.10.41 -r1.3.10.42 --- squid3/src/fs/ufs/store_io_ufs.cc 13 Dec 2002 11:52:01 -0000 1.3.10.41 +++ squid3/src/fs/ufs/store_io_ufs.cc 13 Dec 2002 12:17:22 -0000 1.3.10.42 @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.cc,v 1.3.10.41 2002/12/13 11:52:01 rbcollins Exp $ + * $Id: store_io_ufs.cc,v 1.3.10.42 2002/12/13 12:17:22 rbcollins Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -309,12 +309,12 @@ } void -storeUfsUnlink(SwapDir * SD, StoreEntry * e) +UfsSwapDir::unlink(StoreEntry & e) { - debug(79, 3) ("storeUfsUnlink: fileno %08X\n", e->swap_filen); - commonUfsDirReplRemove(e); - commonUfsDirMapBitReset(SD, e->swap_filen); - commonUfsDirUnlinkFile(SD, e->swap_filen); + debug(79, 3) ("storeUfsUnlink: fileno %08X\n", e.swap_filen); + commonUfsDirReplRemove(&e); + commonUfsDirMapBitReset(this, e.swap_filen); + unlinkFile(e.swap_filen); } /* === STATIC =========================================================== */ 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.26 retrieving revision 1.1.20.27 diff -u -r1.1.20.26 -r1.1.20.27 --- squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 10:45:15 -0000 1.1.20.26 +++ squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 12:17:22 -0000 1.1.20.27 @@ -56,11 +56,11 @@ * Store IO stuff */ extern STOBJCLOSE storeUfsClose; -extern STOBJUNLINK storeUfsUnlink; /* For things that aren't factored well yet */ class UfsSwapDir: public UFSSwapDir { virtual void dump(StoreEntry &)const; + virtual void unlink(StoreEntry &); }; #include "IOStrategy.h"