--------------------- PatchSet 5964 Date: 2007/10/15 09:16:42 Author: amosjeffries Branch: docs Tag: (none) Log: FS/disk parameter type fixes. - virtual class methods should use same types as parent - method definitions should use same type as defined with. plus other fixes and some doc linking. Members: src/ACLIntRange.cc:1.9.2.1->1.9.2.2 src/Store.cci:1.3.24.1->1.3.24.2 src/client_side.cc:1.126.2.9->1.126.2.10 src/DiskIO/DiskFile.h:1.1->1.1.28.1 src/DiskIO/DiskIOStrategy.h:1.1->1.1.28.1 src/DiskIO/AIO/AIODiskFile.cc:1.4.2.1->1.4.2.2 src/DiskIO/AIO/AIODiskFile.h:1.2.14.1->1.2.14.2 src/DiskIO/Blocking/BlockingFile.h:1.2.14.1->1.2.14.2 src/DiskIO/DiskDaemon/DiskdFile.cc:1.3.2.1->1.3.2.2 src/DiskIO/DiskDaemon/DiskdFile.h:1.2->1.2.14.1 src/DiskIO/DiskDaemon/DiskdIOStrategy.cc:1.9.2.1->1.9.2.2 src/DiskIO/DiskDaemon/DiskdIOStrategy.h:1.3.10.1->1.3.10.2 src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc:1.10->1.10.2.1 src/DiskIO/DiskThreads/DiskThreadsDiskFile.h:1.2->1.2.14.1 Index: squid3/src/ACLIntRange.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLIntRange.cc,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- squid3/src/ACLIntRange.cc 6 Aug 2007 05:18:23 -0000 1.9.2.1 +++ squid3/src/ACLIntRange.cc 15 Oct 2007 09:16:42 -0000 1.9.2.2 @@ -1,5 +1,5 @@ /* - * $Id: ACLIntRange.cc,v 1.9.2.1 2007/08/06 05:18:23 amosjeffries Exp $ + * $Id: ACLIntRange.cc,v 1.9.2.2 2007/10/15 09:16:42 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Robert Collins @@ -40,8 +40,7 @@ #include "Parsing.h" /* explicit instantiation required for some systems */ - -template cbdata_type List>::CBDATA_List; +template cbdata_type List< Range >::CBDATA_List; void ACLIntRange::parse() Index: squid3/src/Store.cci =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Store.cci,v retrieving revision 1.3.24.1 retrieving revision 1.3.24.2 diff -u -r1.3.24.1 -r1.3.24.2 --- squid3/src/Store.cci 5 Oct 2007 05:27:47 -0000 1.3.24.1 +++ squid3/src/Store.cci 15 Oct 2007 09:16:42 -0000 1.3.24.2 @@ -1,5 +1,5 @@ /* - * $Id: Store.cci,v 1.3.24.1 2007/10/05 05:27:47 amosjeffries Exp $ + * $Id: Store.cci,v 1.3.24.2 2007/10/15 09:16:42 amosjeffries Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -38,6 +38,7 @@ \retval true Store contains 0 bytes of data. \retval false Store contains 1 or more bytes of data. \retval false Store contains negative content !!!!!! + */ bool StoreEntry::isEmpty () const { Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.126.2.9 retrieving revision 1.126.2.10 diff -u -r1.126.2.9 -r1.126.2.10 --- squid3/src/client_side.cc 5 Oct 2007 05:27:48 -0000 1.126.2.9 +++ squid3/src/client_side.cc 15 Oct 2007 09:16:42 -0000 1.126.2.10 @@ -1,6 +1,5 @@ - /* - * $Id: client_side.cc,v 1.126.2.9 2007/10/05 05:27:48 amosjeffries Exp $ + * $Id: client_side.cc,v 1.126.2.10 2007/10/15 09:16:42 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -33,28 +32,56 @@ * */ -/* Errors and client side +/** + \defgroup ClientSide Client-Side Logics + * + \subsection cserrors Errors and client side * - * Problem the first: the store entry is no longer authoritative on the + \par Problem the first: + * the store entry is no longer authoritative on the * reply status. EBITTEST (E_ABORT) is no longer a valid test outside * of client_side_reply.c. * Problem the second: resources are wasted if we delay in cleaning up. * Problem the third we can't depend on a connection close to clean up. * - * Nice thing the first: Any step in the stream can callback with data + \par Nice thing the first: + * Any step in the stream can callback with data * representing an error. * Nice thing the second: once you stop requesting reads from upstream, * upstream can be stopped too. * - * Solution #1: Error has a callback mechanism to hand over a membuf + \par Solution #1: + * Error has a callback mechanism to hand over a membuf * with the error content. The failing node pushes that back as the * reply. Can this be generalised to reduce duplicate efforts? * A: Possibly. For now, only one location uses this. * How to deal with pre-stream errors? * Tell client_side_reply that we *want* an error page before any * stream calls occur. Then we simply read as normal. + * + * + \section pconn_logic Persistent connection logic: + * + \par + * requests (httpClientRequest structs) get added to the connection + * list, with the current one being chr + * + \par + * The request is *immediately* kicked off, and data flows through + * to clientSocketRecipient. + * + \par + * If the data that arrives at clientSocketRecipient is not for the current + * request, clientSocketRecipient simply returns, without requesting more + * data, or sending it. + * + \par + * ClientKeepAliveNextRequest will then detect the presence of data in + * the next ClientHttpRequest, and will send it, restablishing the + * data flow. */ + #include "squid.h" #include "client_side.h" #include "clientStream.h" @@ -79,23 +106,6 @@ #define comm_close comm_lingering_close #endif -/* Persistent connection logic: - * - * requests (httpClientRequest structs) get added to the connection - * list, with the current one being chr - * - * The request is *immediately* kicked off, and data flows through - * to clientSocketRecipient. - * - * If the data that arrives at clientSocketRecipient is not for the current - * request, clientSocketRecipient simply returns, without requesting more - * data, or sending it. - * - * ClientKeepAliveNextRequest will then detect the presence of data in - * the next ClientHttpRequest, and will send it, restablishing the - * data flow. - */ - /* our socket-related context */ @@ -151,7 +161,7 @@ static int connIsUsable(ConnStateData::Pointer conn); #endif static int responseFinishedOrFailed(HttpReply * rep, StoreIOBuffer const &receivedData); -static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer & conn); +static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer &conn); static void clientUpdateSocketStats(log_type logType, size_t size); char *skipLeadingSpace(char *aString); @@ -1308,6 +1318,7 @@ /* Please don't do anything with the FD past here! */ } + static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer &conn) { Index: squid3/src/DiskIO/DiskFile.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskFile.h,v retrieving revision 1.1 retrieving revision 1.1.28.1 diff -u -r1.1 -r1.1.28.1 --- squid3/src/DiskIO/DiskFile.h 21 Dec 2004 03:14:32 -0000 1.1 +++ squid3/src/DiskIO/DiskFile.h 15 Oct 2007 09:16:43 -0000 1.1.28.1 @@ -1,6 +1,5 @@ - /* - * $Id: DiskFile.h,v 1.1 2004/12/21 03:14:32 squidadm Exp $ + * $Id: DiskFile.h,v 1.1.28.1 2007/10/15 09:16:43 amosjeffries Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -49,20 +48,21 @@ public: typedef RefCount Pointer; - virtual void open (int, mode_t, RefCount) = 0; - virtual void create (int, mode_t, RefCount) = 0; + + virtual void open(int flags, mode_t mode, RefCount callback) = 0; + virtual void create(int flags, mode_t mode, RefCount callback) = 0; virtual void read(ReadRequest *) = 0; virtual void write(WriteRequest *) = 0; - virtual void close () = 0; + virtual void close() = 0; virtual bool canRead() const = 0; virtual bool canWrite() const {return true;} - /* During miogration only */ + /** During migration only */ virtual int getFD() const {return -1;} virtual bool error() const = 0; - /* Inform callers if there is IO in progress */ + /** Inform callers if there is IO in progress */ virtual bool ioInProgress() const = 0; }; Index: squid3/src/DiskIO/DiskIOStrategy.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskIOStrategy.h,v retrieving revision 1.1 retrieving revision 1.1.28.1 diff -u -r1.1 -r1.1.28.1 --- squid3/src/DiskIO/DiskIOStrategy.h 21 Dec 2004 03:14:32 -0000 1.1 +++ squid3/src/DiskIO/DiskIOStrategy.h 15 Oct 2007 09:16:43 -0000 1.1.28.1 @@ -1,6 +1,5 @@ - /* - * $Id: DiskIOStrategy.h,v 1.1 2004/12/21 03:14:32 squidadm Exp $ + * $Id: DiskIOStrategy.h,v 1.1.28.1 2007/10/15 09:16:43 amosjeffries Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -48,28 +47,31 @@ public: virtual ~DiskIOStrategy(){} - /* Can the IO Strategy handle more requests ? */ + /** Can the IO Strategy handle more requests ? */ virtual bool shedLoad() = 0; - /* What is the current load? 999 = 99.9% */ + + /** What is the current load? 999 = 99.9% */ virtual int load() = 0; - /* Return a handle for performing IO operations */ - virtual RefCount newFile (char const *path) = 0; - /* flush all IO operations */ + + /** Return a handle for performing IO operations */ + virtual RefCount newFile(char const *path) = 0; + + /** flush all IO operations */ virtual void sync() {} - /* unlink a file by path */ - virtual void unlinkFile (char const *) = 0; + /** unlink a file by path */ + virtual void unlinkFile(char const *) = 0; - /* perform any pending callbacks */ + /** perform any pending callbacks */ virtual int callback() { return 0; } - /* Init per-instance logic */ + /** Init per-instance logic */ virtual void init() {} - /* cachemgr output on the IO instance stats */ + /** cachemgr output on the IO instance stats */ virtual void statfs(StoreEntry & sentry)const {} - /* module specific options */ + /** module specific options */ virtual ConfigOption *getOptionTree() const { return NULL;} }; Index: squid3/src/DiskIO/AIO/AIODiskFile.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/AIO/AIODiskFile.cc,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- squid3/src/DiskIO/AIO/AIODiskFile.cc 25 Aug 2007 03:23:22 -0000 1.4.2.1 +++ squid3/src/DiskIO/AIO/AIODiskFile.cc 15 Oct 2007 09:16:43 -0000 1.4.2.2 @@ -1,6 +1,5 @@ - /* - * $Id: AIODiskFile.cc,v 1.4.2.1 2007/08/25 03:23:22 amosjeffries Exp $ + * $Id: AIODiskFile.cc,v 1.4.2.2 2007/10/15 09:16:43 amosjeffries Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -30,13 +29,16 @@ * * Copyright (c) 2003, Robert Collins */ -/* + +/** * Author: Adrian Chadd * + \par * These routines are simple plugin replacements for the file_* routines * in disk.c . They back-end into the POSIX AIO routines to provide * a nice and simple async IO framework for COSS. * + \par * AIO is suitable for COSS - the only sync operations that the standard * supports are read/write, and since COSS works on a single file * per storedir it should work just fine. @@ -51,19 +53,19 @@ CBDATA_CLASS_INIT(AIODiskFile); void * -AIODiskFile::operator new (size_t) +AIODiskFile::operator new(size_t unused) { CBDATA_INIT_TYPE(AIODiskFile); return cbdataAlloc(AIODiskFile); } void -AIODiskFile::operator delete (void *address) +AIODiskFile::operator delete(void *address) { cbdataFree(address); } -AIODiskFile::AIODiskFile (char const *aPath, AIODiskIOStrategy *aStrategy) : fd(-1), closed(true), error_(false) +AIODiskFile::AIODiskFile(char const *aPath, AIODiskIOStrategy *aStrategy) : fd(-1), closed(true), error_(false) { assert (aPath); path = aPath; @@ -80,9 +82,8 @@ error_ = aBool; } -/// \bug Is this not meant to be "RefCount< DiskFile > callback" ?? void -AIODiskFile::open(int flags, mode_t mode, IORequestor::Pointer callback) +AIODiskFile::open(int flags, mode_t mode, RefCount callback) { /* Simulate async calls */ #ifdef _SQUID_WIN32_ @@ -95,19 +96,19 @@ ioRequestor = callback; if (fd < 0) { - debugs(79, 3, "BlockingFile::open: got failure (" << errno << ")"); + debugs(79, 3, HERE << ": got failure (" << errno << ")"); error(true); } else { closed = false; store_open_disk_fd++; - debugs(79, 3, "BlockingFile::open: opened FD " << fd); + debugs(79, 3, HERE << ": opened FD " << fd); } callback->ioCompletedNotification(); } void -AIODiskFile::create (int flags, mode_t mode, RefCount callback) +AIODiskFile::create(int flags, mode_t mode, RefCount callback) { /* We use the same logic path for open */ open(flags, mode, callback); Index: squid3/src/DiskIO/AIO/AIODiskFile.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/AIO/AIODiskFile.h,v retrieving revision 1.2.14.1 retrieving revision 1.2.14.2 diff -u -r1.2.14.1 -r1.2.14.2 --- squid3/src/DiskIO/AIO/AIODiskFile.h 25 Aug 2007 03:23:22 -0000 1.2.14.1 +++ squid3/src/DiskIO/AIO/AIODiskFile.h 15 Oct 2007 09:16:43 -0000 1.2.14.2 @@ -1,6 +1,5 @@ - /* - * $Id: AIODiskFile.h,v 1.2.14.1 2007/08/25 03:23:22 amosjeffries Exp $ + * $Id: AIODiskFile.h,v 1.2.14.2 2007/10/15 09:16:43 amosjeffries Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- Index: squid3/src/DiskIO/Blocking/BlockingFile.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/Blocking/BlockingFile.h,v retrieving revision 1.2.14.1 retrieving revision 1.2.14.2 diff -u -r1.2.14.1 -r1.2.14.2 --- squid3/src/DiskIO/Blocking/BlockingFile.h 5 Oct 2007 06:32:54 -0000 1.2.14.1 +++ squid3/src/DiskIO/Blocking/BlockingFile.h 15 Oct 2007 09:16:43 -0000 1.2.14.2 @@ -1,5 +1,5 @@ /* - * $Id: BlockingFile.h,v 1.2.14.1 2007/10/05 06:32:54 amosjeffries Exp $ + * $Id: BlockingFile.h,v 1.2.14.2 2007/10/15 09:16:43 amosjeffries Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Robert Collins @@ -38,6 +38,7 @@ #include "cbdata.h" #include "DiskIO/DiskFile.h" +#include "DiskIO/IORequestor.h" class BlockingFile : public DiskFile { @@ -47,8 +48,8 @@ void operator delete(void *); BlockingFile(char const *path); ~BlockingFile(); - virtual void open(int flags, mode_t mode, RefCount callback); - virtual void create(int fags, mode_t mode, RefCount callback); + virtual void open(int flags, mode_t mode, IORequestor::Pointer callback); + virtual void create(int flags, mode_t mode, IORequestor::Pointer callback); virtual void read(ReadRequest *); virtual void write(WriteRequest *); virtual void close(); Index: squid3/src/DiskIO/DiskDaemon/DiskdFile.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskDaemon/DiskdFile.cc,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -r1.3.2.1 -r1.3.2.2 --- squid3/src/DiskIO/DiskDaemon/DiskdFile.cc 17 Aug 2007 02:56:26 -0000 1.3.2.1 +++ squid3/src/DiskIO/DiskDaemon/DiskdFile.cc 15 Oct 2007 09:16:43 -0000 1.3.2.2 @@ -1,6 +1,5 @@ - /* - * $Id: DiskdFile.cc,v 1.3.2.1 2007/08/17 02:56:26 amosjeffries Exp $ + * $Id: DiskdFile.cc,v 1.3.2.2 2007/10/15 09:16:43 amosjeffries Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -51,7 +50,7 @@ CBDATA_CLASS_INIT(DiskdFile); void * -DiskdFile::operator new (size_t) +DiskdFile::operator new(size_t unused) { CBDATA_INIT_TYPE(DiskdFile); DiskdFile *result = cbdataAlloc(DiskdFile); @@ -62,14 +61,14 @@ } void -DiskdFile::operator delete (void *address) +DiskdFile::operator delete(void *address) { DiskdFile *t = static_cast(address); debugs(79, 3, "diskdFile with base " << t << " deleting"); cbdataFree(t); } -DiskdFile::DiskdFile (char const *aPath, DiskdIOStrategy *anIO) : errorOccured (false), IO(anIO), +DiskdFile::DiskdFile(char const *aPath, DiskdIOStrategy *anIO) : errorOccured (false), IO(anIO), inProgressIOs (0) { assert (aPath); @@ -85,7 +84,7 @@ } void -DiskdFile::open (int flags, mode_t aMode, IORequestor::Pointer callback) +DiskdFile::open(int flags, mode_t aMode, RefCount< IORequestor > callback) { debugs(79, 3, "DiskdFile::open: " << this << " opening for " << callback.getRaw()); assert (ioRequestor.getRaw() == NULL); @@ -116,7 +115,7 @@ } void -DiskdFile::create (int flags, mode_t aMode, IORequestor::Pointer callback) +DiskdFile::create(int flags, mode_t aMode, RefCount< IORequestor > callback) { debugs(79, 3, "DiskdFile::create: " << this << " creating for " << callback.getRaw()); assert (ioRequestor.getRaw() == NULL); Index: squid3/src/DiskIO/DiskDaemon/DiskdFile.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskDaemon/DiskdFile.h,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -u -r1.2 -r1.2.14.1 --- squid3/src/DiskIO/DiskDaemon/DiskdFile.h 21 Aug 2006 01:51:50 -0000 1.2 +++ squid3/src/DiskIO/DiskDaemon/DiskdFile.h 15 Oct 2007 09:16:43 -0000 1.2.14.1 @@ -1,6 +1,5 @@ - /* - * $Id: DiskdFile.h,v 1.2 2006/08/21 01:51:50 squidadm Exp $ + * $Id: DiskdFile.h,v 1.2.14.1 2007/10/15 09:16:43 amosjeffries Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -44,27 +43,30 @@ struct diomsg; +/** + \ingroup diskd + */ class DiskdFile : public DiskFile { public: - void * operator new (size_t); - void operator delete (void *); - DiskdFile (char const *path, DiskdIOStrategy *); + void * operator new(size_t); + void operator delete(void *); + DiskdFile(char const *path, DiskdIOStrategy *); ~DiskdFile(); - virtual void open (int, mode_t, RefCount); - virtual void create (int, mode_t, RefCount); + virtual void open(int flags, mode_t aMode, RefCount callback); + virtual void create(int flags, mode_t aMode, RefCount callback); virtual void read(ReadRequest *); virtual void write(WriteRequest *); - virtual void close (); + virtual void close(); virtual bool error() const; virtual bool canRead() const; - virtual bool ioInProgress()const; + virtual bool ioInProgress() const; /* Temporary */ int getID() const {return id;} - void completed (diomsg *); + void completed(diomsg *); private: int id; Index: squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 17 Aug 2007 02:56:26 -0000 1.9.2.1 +++ squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 15 Oct 2007 09:16:43 -0000 1.9.2.2 @@ -1,6 +1,5 @@ - /* - * $Id: DiskdIOStrategy.cc,v 1.9.2.1 2007/08/17 02:56:26 amosjeffries Exp $ + * $Id: DiskdIOStrategy.cc,v 1.9.2.2 2007/10/15 09:16:43 amosjeffries Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -359,7 +358,7 @@ } int -DiskdIOStrategy::send(int mtype, int id, StoreIOState::Pointer sio, size_t size, off_t offset, ssize_t shm_offset) +DiskdIOStrategy::send(int mtype, int id, RefCount sio, size_t size, off_t offset, ssize_t shm_offset) { diomsg M; M.callback_data = cbdataReference(sio.getRaw()); Index: squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.h,v retrieving revision 1.3.10.1 retrieving revision 1.3.10.2 diff -u -r1.3.10.1 -r1.3.10.2 --- squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.h 17 Aug 2007 02:56:26 -0000 1.3.10.1 +++ squid3/src/DiskIO/DiskDaemon/DiskdIOStrategy.h 15 Oct 2007 09:16:44 -0000 1.3.10.2 @@ -1,6 +1,5 @@ - /* - * $Id: DiskdIOStrategy.h,v 1.3.10.1 2007/08/17 02:56:26 amosjeffries Exp $ + * $Id: DiskdIOStrategy.h,v 1.3.10.2 2007/10/15 09:16:44 amosjeffries Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -37,16 +36,9 @@ #ifndef __STORE_DISKDIOSTRATEGY_H__ #define __STORE_DISKDIOSTRATEGY_H__ -/* - * magic2 is the point at which we start blocking on msgsnd/msgrcv. - * If a queue has magic2 (or more) messages away, then we read the - * queue until the level falls below magic2. Recommended value - * is 75% of SHMBUFS. magic1 is the number of messages away which we - * stop allowing open/create for. - */ - struct diomsg; +/// \ingroup diskd class SharedMemory { @@ -75,6 +67,7 @@ class ReadRequest; +/// \ingroup diskd class DiskdIOStrategy : public DiskIOStrategy { @@ -89,8 +82,9 @@ virtual void sync(); virtual int callback(); virtual void statfs(StoreEntry & sentry)const; - int send(int mtype, int id, DiskdFile *theFile, size_t size, off_t offset, ssize_t shm_offset, RefCountable_ *); - /* public for accessing return address's */ + int send(int mtype, int id, DiskdFile *theFile, size_t size, off_t offset, ssize_t shm_offset, RefCountable_ *requestor); + + /** public for accessing return address's */ SharedMemory shm; private: @@ -105,8 +99,21 @@ int SEND(diomsg * M, int mtype, int id, size_t size, off_t offset, ssize_t shm_offset); void handle(diomsg * M); void unlinkDone(diomsg * M); + + /** + * magic1 is the number of messages away which we + * stop allowing open/create for. + */ int magic1; + + /** + * magic2 is the point at which we start blocking on msgsnd/msgrcv. + * If a queue has magic2 (or more) messages away, then we read the + * queue until the level falls below magic2. Recommended value + * is 75% of SHMBUFS. + */ int magic2; + int away; int smsgid; int rmsgid; @@ -114,9 +121,10 @@ size_t instanceID; }; +/// \ingroup diskd #define SHMBUF_BLKSZ SM_PAGE_SIZE - +/// \ingroup diskd struct diskd_stats_t { int open_fail_queue_len; @@ -138,6 +146,7 @@ open, create, close, unlink, read, write; }; +/// \ingroup diskd extern diskd_stats_t diskd_stats; #endif Index: squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -r1.10 -r1.10.2.1 --- squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 30 Apr 2007 17:51:42 -0000 1.10 +++ squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 15 Oct 2007 09:16:44 -0000 1.10.2.1 @@ -1,6 +1,5 @@ - /* - * $Id: DiskThreadsDiskFile.cc,v 1.10 2007/04/30 17:51:42 squidadm Exp $ + * $Id: DiskThreadsDiskFile.cc,v 1.10.2.1 2007/10/15 09:16:44 amosjeffries Exp $ * * DEBUG: section 79 Disk IO Routines * AUTHOR: Robert Collins @@ -61,13 +60,13 @@ } void -DiskThreadsDiskFile::operator delete (void *address) +DiskThreadsDiskFile::operator delete(void *address) { DiskThreadsDiskFile *t = static_cast(address); cbdataFree(t); } -DiskThreadsDiskFile::DiskThreadsDiskFile (char const *aPath, DiskThreadsIOStrategy *anIO):fd(-1), errorOccured (false), IO(anIO), +DiskThreadsDiskFile::DiskThreadsDiskFile(char const *aPath, DiskThreadsIOStrategy *anIO):fd(-1), errorOccured (false), IO(anIO), inProgressIOs (0) { assert (aPath); @@ -82,7 +81,7 @@ } void -DiskThreadsDiskFile::open (int flags, mode_t mode, IORequestor::Pointer callback) +DiskThreadsDiskFile::open(int flags, mode_t mode, RefCount callback) { statCounter.syscalls.disk.opens++; #if !ASYNC_OPEN @@ -131,7 +130,7 @@ } void -DiskThreadsDiskFile::create (int flags, mode_t mode, IORequestor::Pointer callback) +DiskThreadsDiskFile::create(int flags, mode_t mode, RefCount callback) { statCounter.syscalls.disk.opens++; #if !ASYNC_CREATE @@ -221,7 +220,7 @@ } void -DiskThreadsDiskFile::close () +DiskThreadsDiskFile::close() { debugs(79, 3, "DiskThreadsDiskFile::close: " << this << " closing for " << ioRequestor.getRaw()); @@ -267,7 +266,7 @@ } bool -DiskThreadsDiskFile::ioInProgress()const +DiskThreadsDiskFile::ioInProgress() const { return inProgressIOs > 0; } @@ -289,7 +288,7 @@ } void -DiskThreadsDiskFile::readDone(int rvfd, const char *buf, int len, int errflag, ReadRequest::Pointer request) +DiskThreadsDiskFile::readDone(int rvfd, const char *buf, int len, int errflag, RefCount request) { debugs(79, 3, "DiskThreadsDiskFile::readDone: FD " << rvfd); assert (fd == rvfd); @@ -339,7 +338,7 @@ } void -DiskThreadsDiskFile::writeDone (int rvfd, int errflag, size_t len, WriteRequest::Pointer request) +DiskThreadsDiskFile::writeDone(int rvfd, int errflag, size_t len, RefCount request) { assert (rvfd == fd); static int loop_detect = 0; @@ -370,7 +369,7 @@ template void * -IoResult::operator new (size_t) +IoResult::operator new(size_t unused) { CBDATA_INIT_TYPE(IoResult); IoResult *result = cbdataAlloc(IoResult); @@ -379,8 +378,7 @@ template void -IoResult::operator delete (void *address) +IoResult::operator delete(void *address) { cbdataFree(address); } - Index: squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -u -r1.2 -r1.2.14.1 --- squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h 21 Aug 2006 01:51:50 -0000 1.2 +++ squid3/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h 15 Oct 2007 09:16:44 -0000 1.2.14.1 @@ -1,6 +1,5 @@ - /* - * $Id: DiskThreadsDiskFile.h,v 1.2 2006/08/21 01:51:50 squidadm Exp $ + * $Id: DiskThreadsDiskFile.h,v 1.2.14.1 2007/10/15 09:16:44 amosjeffries Exp $ * * DEBUG: section 79 Disk IO Routines * AUTHOR: Robert Collins @@ -44,21 +43,21 @@ { public: - void * operator new (size_t); - void operator delete (void *); - DiskThreadsDiskFile (char const *path, DiskThreadsIOStrategy *); + void * operator new(size_t); + void operator delete(void *); + DiskThreadsDiskFile(char const *path, DiskThreadsIOStrategy *); ~DiskThreadsDiskFile(); - virtual void open (int, mode_t, RefCount); - virtual void create (int, mode_t, RefCount); + virtual void open(int flags, mode_t mode, RefCount callback); + virtual void create(int flags, mode_t mode, RefCount callback); virtual void read(ReadRequest *); virtual void write(WriteRequest *); - virtual void close (); + virtual void close(); virtual bool error() const; virtual int getFD() const { return fd;} virtual bool canRead() const; virtual bool canWrite() const; - virtual bool ioInProgress()const; + virtual bool ioInProgress() const; private: #if ASYNC_READ @@ -87,14 +86,13 @@ CBDATA_CLASS(DiskThreadsDiskFile); void doClose(); - void readDone(int fd, const char *buf, int len, int errflag, RefCount); - void writeDone (int fd, int errflag, size_t len, RefCount); + void readDone(int fd, const char *buf, int len, int errflag, RefCount request); + void writeDone(int fd, int errflag, size_t len, RefCount request); }; #include "DiskIO/ReadRequest.h" template - class IoResult {