--------------------- PatchSet 5098 Date: 2007/07/24 07:34:00 Author: chtsanti Branch: squid3-largeobj Tag: (none) Log: The way standard metadata it was implemented in this branch (squid3-largeobj) was wrong, flags and refcount was not stored. The problem solved adding new StoreMeta type STORE_META_STD_LFS like this one squid26 has. This type used by squid3 to store new standard metadata, which have a size of (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(uint64_t)) 4 bytes larger than old standard metadata Members: src/Makefile.am:1.116.4.4->1.116.4.5 src/StoreMeta.cc:1.4.24.1->1.4.24.2 src/StoreMetaSTD.cc:1.5->1.5.22.1 src/StoreMetaSTDLFS.cc:1.1->1.1.2.1 src/StoreMetaSTDLFS.h:1.1->1.1.2.1 src/defines.h:1.15->1.15.10.1 src/enums.h:1.35.4.2->1.35.4.3 src/store_swapmeta.cc:1.6.10.2->1.6.10.3 src/ufsdump.cc:1.10->1.10.6.1 src/fs/ufs/ufscommon.cc:1.8.6.3->1.8.6.4 Index: squid3/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Makefile.am,v retrieving revision 1.116.4.4 retrieving revision 1.116.4.5 diff -u -r1.116.4.4 -r1.116.4.5 --- squid3/src/Makefile.am 22 Jul 2007 08:50:26 -0000 1.116.4.4 +++ squid3/src/Makefile.am 24 Jul 2007 07:34:00 -0000 1.116.4.5 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.116.4.4 2007/07/22 08:50:26 chtsanti Exp $ +# $Id: Makefile.am,v 1.116.4.5 2007/07/24 07:34:00 chtsanti Exp $ # # Uncomment and customize the following to suit your needs: # @@ -584,6 +584,8 @@ StoreMetaMD5.h \ StoreMetaSTD.cc \ StoreMetaSTD.h \ + StoreMetaSTDLFS.cc \ + StoreMetaSTDLFS.h \ StoreMetaUnpacker.cc \ StoreMetaUnpacker.h \ StoreMetaURL.cc \ @@ -732,6 +734,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -1358,6 +1361,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -1522,6 +1526,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -1673,6 +1678,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -1852,6 +1858,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -2006,6 +2013,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -2155,6 +2163,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ @@ -2341,6 +2350,7 @@ StoreMeta.cc \ StoreMetaMD5.cc \ StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ Index: squid3/src/StoreMeta.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/StoreMeta.cc,v retrieving revision 1.4.24.1 retrieving revision 1.4.24.2 diff -u -r1.4.24.1 -r1.4.24.2 --- squid3/src/StoreMeta.cc 30 Apr 2007 17:08:10 -0000 1.4.24.1 +++ squid3/src/StoreMeta.cc 24 Jul 2007 07:34:00 -0000 1.4.24.2 @@ -1,6 +1,6 @@ /* - * $Id: StoreMeta.cc,v 1.4.24.1 2007/04/30 17:08:10 dwsquid Exp $ + * $Id: StoreMeta.cc,v 1.4.24.2 2007/07/24 07:34:00 chtsanti Exp $ * * DEBUG: section 20 Storage Manager Swapfile Metadata * AUTHOR: Kostas Anagnostakis @@ -40,6 +40,7 @@ #include "StoreMetaMD5.h" #include "StoreMetaURL.h" #include "StoreMetaSTD.h" +#include "StoreMetaSTDLFS.h" #include "StoreMetaVary.h" bool @@ -127,6 +128,10 @@ result = new StoreMetaSTD; break; + case STORE_META_STD_LFS: + result = new StoreMetaSTDLFS; + break; + case STORE_META_VARY_HEADERS: result = new StoreMetaVary; break; @@ -183,6 +188,9 @@ case STORE_META_STD: break; + case STORE_META_STD_LFS: + break; + default: debugs(20, 1, "WARNING: got unused STORE_META type " << getType()); break; Index: squid3/src/StoreMetaSTD.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/StoreMetaSTD.cc,v retrieving revision 1.5 retrieving revision 1.5.22.1 diff -u -r1.5 -r1.5.22.1 --- squid3/src/StoreMetaSTD.cc 31 Aug 2004 02:14:26 -0000 1.5 +++ squid3/src/StoreMetaSTD.cc 24 Jul 2007 07:34:00 -0000 1.5.22.1 @@ -1,6 +1,6 @@ /* - * $Id: StoreMetaSTD.cc,v 1.5 2004/08/31 02:14:26 squidadm Exp $ + * $Id: StoreMetaSTD.cc,v 1.5.22.1 2007/07/24 07:34:00 chtsanti Exp $ * * DEBUG: section 20 Storage Manager Swapfile Metadata * AUTHOR: Kostas Anagnostakis @@ -41,5 +41,5 @@ bool StoreMetaSTD::validLength(int len) const { - return len == STORE_HDR_METASIZE; + return len == STORE_HDR_METASIZE_OLD; } --- /dev/null Wed Jul 25 00:19:06 2007 +++ squid3/src/StoreMetaSTDLFS.cc Wed Jul 25 00:19:06 2007 @@ -0,0 +1,44 @@ + +/* + * $Id: StoreMetaSTDLFS.cc,v 1.1.2.1 2007/07/24 07:34:00 chtsanti Exp $ + * + * DEBUG: section 20 Storage Manager Swapfile Metadata + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" +#include "StoreMetaSTDLFS.h" +#include "Store.h" +#include "MemObject.h" + +bool +StoreMetaSTDLFS::validLength(int len) const +{ + return len == STORE_HDR_METASIZE; +} --- /dev/null Wed Jul 25 00:19:06 2007 +++ squid3/src/StoreMetaSTDLFS.h Wed Jul 25 00:19:06 2007 @@ -0,0 +1,53 @@ + +/* + * $Id: StoreMetaSTDLFS.h,v 1.1.2.1 2007/07/24 07:34:00 chtsanti Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#ifndef SQUID_STOREMETASTDLFS_H +#define SQUID_STOREMETASTDLFS_H + +#include "StoreMeta.h" + +class StoreMetaSTDLFS : public StoreMeta +{ + +public: + MEMPROXY_CLASS(StoreMetaSTDLFS); + + char getType() const {return STORE_META_STD_LFS;} + + bool validLength(int) const; + // bool checkConsistency(StoreEntry *) const; +}; + +MEMPROXY_CLASS_INLINE(StoreMetaSTDLFS) + +#endif /* SQUID_STOREMETASTDLFS_H */ Index: squid3/src/defines.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/defines.h,v retrieving revision 1.15 retrieving revision 1.15.10.1 diff -u -r1.15 -r1.15.10.1 --- squid3/src/defines.h 21 Aug 2006 01:51:49 -0000 1.15 +++ squid3/src/defines.h 24 Jul 2007 07:34:00 -0000 1.15.10.1 @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.15 2006/08/21 01:51:49 squidadm Exp $ + * $Id: defines.h,v 1.15.10.1 2007/07/24 07:34:00 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -202,7 +202,8 @@ #define SwapMetaType(x) (char)x[0] #define SwapMetaSize(x) &x[sizeof(char)] #define SwapMetaData(x) &x[STORE_META_TLD_START] -#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(size_t)) +#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(uint64_t)) +#define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(size_t)) #define PINGER_PAYLOAD_SZ 8192 Index: squid3/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/enums.h,v retrieving revision 1.35.4.2 retrieving revision 1.35.4.3 diff -u -r1.35.4.2 -r1.35.4.3 --- squid3/src/enums.h 7 May 2007 17:06:14 -0000 1.35.4.2 +++ squid3/src/enums.h 24 Jul 2007 07:34:00 -0000 1.35.4.3 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.35.4.2 2007/05/07 17:06:14 dwsquid Exp $ + * $Id: enums.h,v 1.35.4.3 2007/07/24 07:34:00 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -440,6 +440,7 @@ STORE_META_HITMETERING, /* reserved for hit metering */ STORE_META_VALID, STORE_META_VARY_HEADERS, /* Stores Vary request headers */ + STORE_META_STD_LFS, /* standard metadata in lfs format */ STORE_META_END }; Index: squid3/src/store_swapmeta.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_swapmeta.cc,v retrieving revision 1.6.10.2 retrieving revision 1.6.10.3 diff -u -r1.6.10.2 -r1.6.10.3 --- squid3/src/store_swapmeta.cc 30 Apr 2007 17:08:17 -0000 1.6.10.2 +++ squid3/src/store_swapmeta.cc 24 Jul 2007 07:34:00 -0000 1.6.10.3 @@ -1,6 +1,6 @@ /* - * $Id: store_swapmeta.cc,v 1.6.10.2 2007/04/30 17:08:17 dwsquid Exp $ + * $Id: store_swapmeta.cc,v 1.6.10.3 2007/07/24 07:34:00 chtsanti Exp $ * * DEBUG: section 20 Storage Manager Swapfile Metadata * AUTHOR: Kostas Anagnostakis @@ -73,7 +73,7 @@ } T = StoreMeta::Add(T, t); - t = StoreMeta::Factory(STORE_META_STD,STORE_HDR_METASIZE,&e->timestamp); + t = StoreMeta::Factory(STORE_META_STD_LFS,STORE_HDR_METASIZE,&e->timestamp); if (!t) { storeSwapTLVFree(TLV); Index: squid3/src/ufsdump.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ufsdump.cc,v retrieving revision 1.10 retrieving revision 1.10.6.1 diff -u -r1.10 -r1.10.6.1 --- squid3/src/ufsdump.cc 13 Sep 2006 19:50:43 -0000 1.10 +++ squid3/src/ufsdump.cc 24 Jul 2007 07:34:00 -0000 1.10.6.1 @@ -1,6 +1,6 @@ /* - * $Id: ufsdump.cc,v 1.10 2006/09/13 19:50:43 squidadm Exp $ + * $Id: ufsdump.cc,v 1.10.6.1 2007/07/24 07:34:00 chtsanti Exp $ * * DEBUG: section 0 UFS Store Dump * AUTHOR: Robert Collins @@ -56,6 +56,26 @@ #endif /* end stub functions */ +struct MetaStd{ + time_t timestamp; + time_t lastref; + time_t expires; + time_t lastmod; + size_t swap_file_sz; + u_short refcount; + u_short flags; +}; + +struct MetaStdLfs{ + time_t timestamp; + time_t lastref; + time_t expires; + time_t lastmod; + uint64_t swap_file_sz; + u_short refcount; + u_short flags; +}; + struct DumpStoreMeta : public unary_function { DumpStoreMeta(){} @@ -69,6 +89,17 @@ break; case STORE_META_STD: + std::cout << "STD, Size:" << ((struct MetaStd*)x.value)->swap_file_sz << + " Flags: 0x" << std::hex << ((struct MetaStd*)x.value)->flags << std::dec << + " Refcount: " << ((struct MetaStd*)x.value)->refcount << + std::endl; + break; + + case STORE_META_STD_LFS: + std::cout << "STD_LFS, Size: " << ((struct MetaStdLfs*)x.value)->swap_file_sz << + " Flags: 0x" << std::hex << ((struct MetaStdLfs*)x.value)->flags << std::dec << + " Refcount: " << ((struct MetaStdLfs*)x.value)->refcount << + std::endl; break; case STORE_META_URL: @@ -76,6 +107,8 @@ std::cout << "URL: " << (char *)x.value << std::endl; default: + std::cout << "Unknown store meta type: " << (int)x.getType() << + " of length " << x.length << std::endl; break; } } Index: squid3/src/fs/ufs/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/ufscommon.cc,v retrieving revision 1.8.6.3 retrieving revision 1.8.6.4 diff -u -r1.8.6.3 -r1.8.6.4 --- squid3/src/fs/ufs/ufscommon.cc 18 Jun 2007 20:59:37 -0000 1.8.6.3 +++ squid3/src/fs/ufs/ufscommon.cc 24 Jul 2007 07:34:00 -0000 1.8.6.4 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.8.6.3 2007/06/18 20:59:37 chtsanti Exp $ + * $Id: ufscommon.cc,v 1.8.6.4 2007/07/24 07:34:00 chtsanti Exp $ * vim: set et : * * DEBUG: section 47 Store Directory Routines @@ -119,7 +119,28 @@ break; case STORE_META_STD: - assert(x.length == STORE_HDR_METASIZE); + struct old_metahdr{ + time_t timestamp; + time_t lastref; + time_t expires; + time_t lastmod; + size_t swap_file_sz; + u_short refcount; + u_short flags; + } *tmp; + tmp = (struct old_metahdr *)x.value; + assert(x.length == STORE_HDR_METASIZE_OLD); + what->timestamp = tmp->timestamp; + what->lastref = tmp->lastref; + what->expires = tmp->expires; + what->lastmod = tmp->lastmod; + what->swap_file_sz = tmp->swap_file_sz; + what->refcount = tmp->refcount; + what->flags = tmp->flags; + break; + + case STORE_META_STD_LFS: + assert(x.length == STORE_HDR_METASIZE); xmemcpy(&what->timestamp, x.value, STORE_HDR_METASIZE); break;