#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 |
Detailed Description
Definition at line 42 of file DiskdIOStrategy.h.
Constructor & Destructor Documentation
◆ DiskdIOStrategy()
DiskdIOStrategy::DiskdIOStrategy | ( | ) |
Definition at line 89 of file DiskdIOStrategy.cc.
Member Function Documentation
◆ callback()
|
overridevirtual |
perform any pending callbacks
Reimplemented from DiskIOStrategy.
Definition at line 528 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().
◆ getOptionTree()
|
overridevirtual |
module specific options
Reimplemented from DiskIOStrategy.
Definition at line 423 of file DiskdIOStrategy.cc.
References optionQ1Dump(), optionQ1Parse(), optionQ2Dump(), optionQ2Parse(), and ConfigOptionVector::options.
◆ handle()
|
private |
Definition at line 289 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().
◆ init()
|
overridevirtual |
Init per-instance logic
Reimplemented from DiskIOStrategy.
Definition at line 137 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().
◆ load()
|
overridevirtual |
What is the current load? 999 = 99.9%
Implements DiskIOStrategy.
Definition at line 65 of file DiskdIOStrategy.cc.
◆ newFile()
|
overridevirtual |
Return a handle for performing IO operations
Implements DiskIOStrategy.
Definition at line 79 of file DiskdIOStrategy.cc.
References openFailed(), and shedLoad().
◆ newInstance()
|
staticprivate |
Definition at line 43 of file DiskdIOStrategy.cc.
References nextInstanceID.
◆ openFailed()
|
private |
Definition at line 73 of file DiskdIOStrategy.cc.
References diskd_stats, and diskd_stats_t::open_fail_queue_len.
Referenced by newFile().
◆ optionQ1Dump()
|
private |
Definition at line 465 of file DiskdIOStrategy.cc.
References magic1, and storeAppendPrintf().
Referenced by getOptionTree().
◆ optionQ1Parse()
|
private |
Definition at line 432 of file DiskdIOStrategy.cc.
References DBG_IMPORTANT, debugs, and magic1.
Referenced by getOptionTree().
◆ optionQ2Dump()
|
private |
Definition at line 497 of file DiskdIOStrategy.cc.
References magic2, and storeAppendPrintf().
Referenced by getOptionTree().
◆ optionQ2Parse()
|
private |
Definition at line 471 of file DiskdIOStrategy.cc.
References DBG_IMPORTANT, debugs, and magic2.
Referenced by getOptionTree().
◆ SEND()
|
private |
Definition at line 362 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, and xstrerr().
Referenced by send().
◆ send() [1/2]
int DiskdIOStrategy::send | ( | int | mtype, |
int | id, | ||
DiskdFile * | theFile, | ||
size_t | size, | ||
off_t | offset, | ||
ssize_t | shm_offset, | ||
Lock * | requestor | ||
) |
Definition at line 337 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().
◆ send() [2/2]
|
private |
Definition at line 352 of file DiskdIOStrategy.cc.
References diomsg::callback_data, cbdataReference, RefCount< C >::getRaw(), diomsg::newstyle, SEND(), and size.
◆ shedLoad()
|
overridevirtual |
Can the IO Strategy handle more requests ?
Implements DiskIOStrategy.
Definition at line 49 of file DiskdIOStrategy.cc.
References away, debugs, and magic1.
Referenced by newFile(), and unlinkFile().
◆ statfs()
|
overridevirtual |
cachemgr output on the IO instance stats
Reimplemented from DiskIOStrategy.
Definition at line 569 of file DiskdIOStrategy.cc.
References away, and storeAppendPrintf().
◆ sync()
|
overridevirtual |
flush all IO operations
Reimplemented from DiskIOStrategy.
Definition at line 507 of file DiskdIOStrategy.cc.
References away, callback(), DBG_IMPORTANT, debugs, and squid_curtime.
◆ unlinkDone()
|
private |
Definition at line 277 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().
◆ unlinkdUseful()
|
overridevirtual |
whether the IO Strategy can use unlinkd
Implements DiskIOStrategy.
Definition at line 93 of file DiskdIOStrategy.cc.
◆ unlinkFile()
|
overridevirtual |
unlink a file by path
Implements DiskIOStrategy.
Definition at line 99 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().
Member Data Documentation
◆ away
|
private |
Definition at line 89 of file DiskdIOStrategy.h.
Referenced by callback(), load(), SEND(), shedLoad(), statfs(), and sync().
◆ instanceID
|
private |
Definition at line 93 of file DiskdIOStrategy.h.
Referenced by init().
◆ magic1
|
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().
◆ magic2
|
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().
◆ nextInstanceID
|
staticprivate |
Definition at line 64 of file DiskdIOStrategy.h.
Referenced by newInstance().
◆ rmsgid
|
private |
Definition at line 91 of file DiskdIOStrategy.h.
Referenced by callback(), and init().
◆ shm
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().
◆ smsgid
|
private |
Definition at line 90 of file DiskdIOStrategy.h.
◆ wfd
|
private |
Definition at line 92 of file DiskdIOStrategy.h.
Referenced by init().
The documentation for this class was generated from the following files:
- src/DiskIO/DiskDaemon/DiskdIOStrategy.h
- src/DiskIO/DiskDaemon/DiskdIOStrategy.cc