|
Squid Web Cache v8/master
|
#include <DiskdIOStrategy.h>
Public Member Functions | |
| DiskdIOStrategy () | |
| bool | shedLoad () override |
| int | load () override |
| RefCount< DiskFile > | newFile (char const *path) override |
| bool | unlinkdUseful () const override |
| void | unlinkFile (char const *) override |
| ConfigOption * | getOptionTree () const override |
| void | init () override |
| void | sync () override |
| int | callback () override |
| void | statfs (StoreEntry &sentry) const override |
| int | send (int mtype, int id, DiskdFile *theFile, size_t size, off_t offset, ssize_t shm_offset, Lock *requestor) |
Public Attributes | |
| SharedMemory | shm |
Private Member Functions | |
| void | openFailed () |
| bool | optionQ1Parse (char const *option, const char *value, int reconfiguring) |
| void | optionQ1Dump (StoreEntry *e) const |
| bool | optionQ2Parse (char const *option, const char *value, int reconfiguring) |
| void | optionQ2Dump (StoreEntry *e) const |
| int | send (int mtype, int id, RefCount< StoreIOState > sio, size_t size, off_t offset, ssize_t shm_offset) |
| 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) |
Static Private Member Functions | |
| static size_t | newInstance () |
Private Attributes | |
| int | magic1 |
| int | magic2 |
| int | away |
| int | smsgid |
| int | rmsgid |
| int | wfd |
| size_t | instanceID |
Static Private Attributes | |
| static size_t | nextInstanceID |
Definition at line 42 of file DiskdIOStrategy.h.
| DiskdIOStrategy::DiskdIOStrategy | ( | ) |
Definition at line 90 of file DiskdIOStrategy.cc.
|
overridevirtual |
perform any pending callbacks
Reimplemented from DiskIOStrategy.
Definition at line 539 of file DiskdIOStrategy.cc.
References away, diskd_stats_t::block_queue_len, DBG_IMPORTANT, debugs, diskd_stats, handle(), magic2, diskd_stats_t::max_away, diomsg::msg_snd_rcv_sz, SharedMemory::put(), diskd_stats_t::recv_count, rmsgid, diskd_stats_t::sent_count, shm, and diomsg::shm_offset.
Referenced by sync().
|
overridevirtual |
module specific options
Reimplemented from DiskIOStrategy.
Definition at line 434 of file DiskdIOStrategy.cc.
References optionQ1Dump(), optionQ1Parse(), optionQ2Dump(), optionQ2Parse(), and ConfigOptionVector::options.
|
private |
Definition at line 300 of file DiskdIOStrategy.cc.
References _MQD_CLOSE, _MQD_CREATE, _MQD_OPEN, _MQD_READ, _MQD_UNLINK, _MQD_WRITE, assert, diomsg::callback_data, cbdataReferenceDone, cbdataReferenceValid(), DiskdFile::completed(), debugs, diomsg::mtype, diomsg::newstyle, diomsg::status, and unlinkDone().
Referenced by callback().
|
overridevirtual |
Init per-instance logic
Reimplemented from DiskIOStrategy.
Definition at line 143 of file DiskdIOStrategy.cc.
References comm_close, commSetNonBlocking(), commUnsetFdTimeout(), Config, DBG_CRITICAL, debugs, SquidConfig::diskd, fatal(), fatalf(), fd_note(), hIpc, SharedMemory::init(), instanceID, IPC_STREAM, ipcCreate(), magic2, MYNAME, pid, SquidConfig::Program, Comm::QuickPollRequired(), rmsgid, Ip::Address::setLocalhost(), shm, smsgid, wfd, and xstrerr().
|
overridevirtual |
What is the current load? 999 = 99.9%
Implements DiskIOStrategy.
Definition at line 66 of file DiskdIOStrategy.cc.
|
overridevirtual |
Return a handle for performing IO operations
Implements DiskIOStrategy.
Definition at line 80 of file DiskdIOStrategy.cc.
References openFailed(), and shedLoad().
|
staticprivate |
Definition at line 44 of file DiskdIOStrategy.cc.
References nextInstanceID.
|
private |
Definition at line 74 of file DiskdIOStrategy.cc.
References diskd_stats, and diskd_stats_t::open_fail_queue_len.
Referenced by newFile().
|
private |
Definition at line 476 of file DiskdIOStrategy.cc.
References magic1, and storeAppendPrintf().
Referenced by getOptionTree().
|
private |
Definition at line 443 of file DiskdIOStrategy.cc.
References DBG_IMPORTANT, debugs, and magic1.
Referenced by getOptionTree().
|
private |
Definition at line 508 of file DiskdIOStrategy.cc.
References magic2, and storeAppendPrintf().
Referenced by getOptionTree().
|
private |
Definition at line 482 of file DiskdIOStrategy.cc.
References DBG_IMPORTANT, debugs, and magic2.
Referenced by getOptionTree().
|
private |
Definition at line 373 of file DiskdIOStrategy.cc.
References assert, away, Store::Controller::callback(), diomsg::callback_data, cbdataReferenceDone, DBG_IMPORTANT, debugs, diskd_stats, diomsg::id, int, magic2, diomsg::msg_snd_rcv_sz, diomsg::mtype, MYNAME, diomsg::offset, SharedMemory::put(), Store::Root(), diskd_stats_t::sent_count, diomsg::seq_no, shm, diomsg::shm_offset, size, diomsg::size, smsgid, diomsg::status, xselect(), and xstrerr().
| int DiskdIOStrategy::send | ( | int | mtype, |
| int | id, | ||
| DiskdFile * | theFile, | ||
| size_t | size, | ||
| off_t | offset, | ||
| ssize_t | shm_offset, | ||
| Lock * | requestor | ||
| ) |
Definition at line 348 of file DiskdIOStrategy.cc.
References diomsg::callback_data, cbdataReference, Lock::lock(), diomsg::newstyle, diomsg::requestor, SEND, and size.
Referenced by DiskdFile::close(), DiskdFile::create(), DiskdFile::open(), DiskdFile::read(), unlinkFile(), and DiskdFile::write().
|
private |
Definition at line 363 of file DiskdIOStrategy.cc.
References diomsg::callback_data, cbdataReference, RefCount< C >::getRaw(), diomsg::newstyle, SEND, and size.
|
overridevirtual |
Can the IO Strategy handle more requests ?
Implements DiskIOStrategy.
Definition at line 50 of file DiskdIOStrategy.cc.
References away, debugs, and magic1.
Referenced by newFile(), and unlinkFile().
|
overridevirtual |
cachemgr output on the IO instance stats
Reimplemented from DiskIOStrategy.
Definition at line 580 of file DiskdIOStrategy.cc.
References away, and storeAppendPrintf().
|
overridevirtual |
flush all IO operations
Reimplemented from DiskIOStrategy.
Definition at line 518 of file DiskdIOStrategy.cc.
References away, callback(), DBG_IMPORTANT, debugs, and squid_curtime.
|
private |
Definition at line 288 of file DiskdIOStrategy.cc.
References SharedMemory::buf, debugs, StatCounters::disk, diskd_stats, diskd_stats_t::fail, shm, diomsg::shm_offset, statCounter, diomsg::status, diskd_stats_t::success, StatCounters::syscalls, diskd_stats_t::unlink, and StatCounters::unlinks.
Referenced by handle().
|
overridevirtual |
whether the IO Strategy can use unlinkd
Implements DiskIOStrategy.
Definition at line 94 of file DiskdIOStrategy.cc.
|
overridevirtual |
unlink a file by path
Implements DiskIOStrategy.
Definition at line 100 of file DiskdIOStrategy.cc.
References _MQD_UNLINK, DBG_IMPORTANT, debugs, diskd_stats, SharedMemory::get(), diskd_stats_t::ops, send(), shedLoad(), shm, SHMBUF_BLKSZ, diskd_stats_t::unlink, unlinkdUnlink(), xstrerr(), and xstrncpy().
|
private |
Definition at line 89 of file DiskdIOStrategy.h.
Referenced by callback(), load(), SEND(), shedLoad(), statfs(), and sync().
|
private |
Definition at line 93 of file DiskdIOStrategy.h.
Referenced by init().
|
private |
magic1 is the number of messages away which we stop allowing open/create for.
Definition at line 79 of file DiskdIOStrategy.h.
Referenced by optionQ1Dump(), optionQ1Parse(), and shedLoad().
|
private |
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.
Definition at line 87 of file DiskdIOStrategy.h.
Referenced by callback(), init(), load(), optionQ2Dump(), optionQ2Parse(), and SEND().
|
staticprivate |
Definition at line 64 of file DiskdIOStrategy.h.
Referenced by newInstance().
|
private |
Definition at line 91 of file DiskdIOStrategy.h.
Referenced by callback(), and init().
| SharedMemory DiskdIOStrategy::shm |
public for accessing return address's
Definition at line 60 of file DiskdIOStrategy.h.
Referenced by callback(), DiskdFile::create(), init(), DiskdFile::open(), DiskdFile::read(), DiskdFile::readDone(), SEND(), unlinkDone(), unlinkFile(), and DiskdFile::write().
|
private |
Definition at line 90 of file DiskdIOStrategy.h.
|
private |
Definition at line 92 of file DiskdIOStrategy.h.
Referenced by init().