#include "squid.h"
#include "DiskIO/DiskThreads/CommIO.h"
#include "DiskThreads.h"
#include "fd.h"
#include "mem/Pool.h"
#include "SquidConfig.h"
#include "Store.h"
#include <cerrno>
#include <csignal>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
Go to the source code of this file.
Classes | |
struct | squidaio_request_t |
struct | squidaio_request_queue_t |
struct | squidaio_thread_t |
Macros | |
#define | RIDICULOUS_LENGTH 4096 |
#define | AIO_LARGE_BUFS 16384 |
#define | AIO_MEDIUM_BUFS AIO_LARGE_BUFS >> 1 |
#define | AIO_SMALL_BUFS AIO_LARGE_BUFS >> 2 |
#define | AIO_TINY_BUFS AIO_LARGE_BUFS >> 3 |
#define | AIO_MICRO_BUFS 128 |
Typedefs | |
typedef enum _squidaio_thread_status | squidaio_thread_status |
typedef struct squidaio_request_t | squidaio_request_t |
typedef struct squidaio_request_queue_t | squidaio_request_queue_t |
typedef struct squidaio_thread_t | squidaio_thread_t |
Enumerations | |
enum | _squidaio_thread_status { _THREAD_STARTING = 0 , _THREAD_WAITING , _THREAD_BUSY , _THREAD_FAILED , _THREAD_DONE , _THREAD_STARTING = 0 , _THREAD_WAITING , _THREAD_BUSY , _THREAD_FAILED , _THREAD_DONE } |
Variables | |
static squidaio_thread_t * | threads = nullptr |
static int | squidaio_initialised = 0 |
static Mem::Allocator * | squidaio_large_bufs = nullptr |
static Mem::Allocator * | squidaio_medium_bufs = nullptr |
static Mem::Allocator * | squidaio_small_bufs = nullptr |
static Mem::Allocator * | squidaio_tiny_bufs = nullptr |
static Mem::Allocator * | squidaio_micro_bufs = nullptr |
static int | request_queue_len = 0 |
static Mem::Allocator * | squidaio_request_pool = nullptr |
static Mem::Allocator * | squidaio_thread_pool = nullptr |
static squidaio_request_queue_t | request_queue |
struct { | |
squidaio_request_t * head | |
squidaio_request_t ** tailp | |
} | request_queue2 |
static squidaio_request_queue_t | done_queue |
struct { | |
squidaio_request_t * head | |
squidaio_request_t ** tailp | |
} | done_requests |
static HANDLE | main_thread |
Macro Definition Documentation
◆ AIO_LARGE_BUFS
#define AIO_LARGE_BUFS 16384 |
Definition at line 99 of file aiops_win32.cc.
◆ AIO_MEDIUM_BUFS
#define AIO_MEDIUM_BUFS AIO_LARGE_BUFS >> 1 |
Definition at line 100 of file aiops_win32.cc.
◆ AIO_MICRO_BUFS
#define AIO_MICRO_BUFS 128 |
Definition at line 103 of file aiops_win32.cc.
◆ AIO_SMALL_BUFS
#define AIO_SMALL_BUFS AIO_LARGE_BUFS >> 2 |
Definition at line 101 of file aiops_win32.cc.
◆ AIO_TINY_BUFS
#define AIO_TINY_BUFS AIO_LARGE_BUFS >> 3 |
Definition at line 102 of file aiops_win32.cc.
◆ RIDICULOUS_LENGTH
#define RIDICULOUS_LENGTH 4096 |
Definition at line 25 of file aiops_win32.cc.
Typedef Documentation
◆ squidaio_request_queue_t
typedef struct squidaio_request_queue_t squidaio_request_queue_t |
◆ squidaio_request_t
typedef struct squidaio_request_t squidaio_request_t |
◆ squidaio_thread_status
typedef enum _squidaio_thread_status squidaio_thread_status |
Definition at line 34 of file aiops_win32.cc.
◆ squidaio_thread_t
typedef struct squidaio_thread_t squidaio_thread_t |
Definition at line 68 of file aiops_win32.cc.
Enumeration Type Documentation
◆ _squidaio_thread_status
Enumerator | |
---|---|
_THREAD_STARTING | |
_THREAD_WAITING | |
_THREAD_BUSY | |
_THREAD_FAILED | |
_THREAD_DONE | |
_THREAD_STARTING | |
_THREAD_WAITING | |
_THREAD_BUSY | |
_THREAD_FAILED | |
_THREAD_DONE |
Definition at line 27 of file aiops_win32.cc.
Function Documentation
◆ squidaio_cancel()
int squidaio_cancel | ( | squidaio_result_t * | resultp | ) |
Definition at line 695 of file aiops_win32.cc.
References _AIO_OP_NONE, squidaio_result_t::_data, squidaio_request_t::cancelled, debugs, squidaio_request_t::request_type, squidaio_result_t::result_type, and squidaio_request_t::resultp.
◆ squidaio_cleanup_request()
|
static |
Definition at line 632 of file aiops_win32.cc.
References _AIO_OP_CLOSE, _AIO_OP_OPEN, _AIO_OP_OPENDIR, _AIO_OP_READ, _AIO_OP_STAT, _AIO_OP_UNLINK, _AIO_OP_WRITE, squidaio_result_t::aio_errno, squidaio_result_t::aio_return, squidaio_request_t::cancelled, squidaio_request_t::err, squidaio_request_t::fd, Mem::Allocator::freeOne(), NULL, squidaio_request_t::path, squidaio_request_t::request_type, squidaio_request_t::resultp, squidaio_request_t::ret, squidaio_request_pool, squidaio_xfree(), squidaio_xstrfree(), squidaio_request_t::statp, and squidaio_request_t::tmpstatp.
Referenced by squidaio_poll_done().
◆ squidaio_close()
int squidaio_close | ( | int | fd, |
squidaio_result_t * | resultp | ||
) |
Definition at line 832 of file aiops_win32.cc.
References _AIO_OP_CLOSE, Mem::Allocator::alloc(), squidaio_request_t::cancelled, squidaio_request_t::fd, squidaio_request_t::request_type, squidaio_result_t::result_type, squidaio_request_t::resultp, squidaio_queue_request(), and squidaio_request_pool.
◆ squidaio_debug()
|
static |
Definition at line 1069 of file aiops_win32.cc.
References _AIO_OP_CLOSE, _AIO_OP_OPEN, _AIO_OP_READ, _AIO_OP_UNLINK, _AIO_OP_WRITE, debugs, squidaio_request_t::fd, squidaio_request_t::path, squidaio_request_t::request_type, and squidaio_request_t::ret.
Referenced by squidaio_poll_done().
◆ squidaio_do_close()
|
static |
Definition at line 854 of file aiops_win32.cc.
References DBG_CRITICAL, debugs, squidaio_request_t::err, squidaio_request_t::fd, and squidaio_request_t::ret.
Referenced by squidaio_thread_loop().
◆ squidaio_do_open()
|
static |
Definition at line 739 of file aiops_win32.cc.
References squidaio_request_t::err, squidaio_request_t::mode, squidaio_request_t::oflag, squidaio_request_t::path, and squidaio_request_t::ret.
Referenced by squidaio_thread_loop().
◆ squidaio_do_read()
|
static |
Definition at line 776 of file aiops_win32.cc.
References squidaio_request_t::bufferp, squidaio_request_t::buflen, squidaio_request_t::err, squidaio_request_t::fd, squidaio_request_t::offset, squidaio_request_t::ret, and squidaio_request_t::whence.
Referenced by squidaio_thread_loop().
◆ squidaio_do_stat()
|
static |
Definition at line 893 of file aiops_win32.cc.
References squidaio_request_t::err, squidaio_request_t::path, squidaio_request_t::ret, and squidaio_request_t::tmpstatp.
Referenced by squidaio_thread_loop().
◆ squidaio_do_unlink()
|
static |
Definition at line 923 of file aiops_win32.cc.
References squidaio_request_t::err, squidaio_request_t::path, and squidaio_request_t::ret.
Referenced by squidaio_thread_loop().
◆ squidaio_do_write()
|
static |
Definition at line 820 of file aiops_win32.cc.
References squidaio_request_t::bufferp, squidaio_request_t::buflen, squidaio_request_t::err, squidaio_request_t::fd, and squidaio_request_t::ret.
Referenced by squidaio_thread_loop().
◆ squidaio_get_pool()
|
static |
Definition at line 138 of file aiops_win32.cc.
References AIO_LARGE_BUFS, AIO_MEDIUM_BUFS, AIO_MICRO_BUFS, AIO_SMALL_BUFS, AIO_TINY_BUFS, size, squidaio_large_bufs, squidaio_medium_bufs, squidaio_micro_bufs, squidaio_small_bufs, and squidaio_tiny_bufs.
Referenced by squidaio_xfree(), squidaio_xmalloc(), and squidaio_xstrfree().
◆ squidaio_get_queue_len()
int squidaio_get_queue_len | ( | void | ) |
Definition at line 1063 of file aiops_win32.cc.
References request_queue_len.
◆ squidaio_init()
void squidaio_init | ( | void | ) |
Definition at line 201 of file aiops_win32.cc.
References _THREAD_FAILED, _THREAD_STARTING, AIO_LARGE_BUFS, AIO_MEDIUM_BUFS, AIO_MICRO_BUFS, AIO_SMALL_BUFS, AIO_TINY_BUFS, Mem::Allocator::alloc(), assert, squidaio_request_queue_t::blocked, squidaio_request_queue_t::cond, squidaio_thread_t::current_req, done_queue, squidaio_thread_t::dwThreadId, FALSE, fatal(), squidaio_request_queue_t::head, CommIO::Initialize(), main_thread, memPoolCreate, squidaio_request_queue_t::mutex, squidaio_thread_t::next, NULL, NUMTHREADS, request_queue, squidaio_request_queue_t::requests, squidaio_thread_t::requests, squidaio_initialised, squidaio_large_bufs, squidaio_medium_bufs, squidaio_micro_bufs, squidaio_request_pool, squidaio_small_bufs, squidaio_thread_loop(), squidaio_thread_pool, squidaio_tiny_bufs, squidaio_thread_t::status, squidaio_request_queue_t::tailp, squidaio_thread_t::thread, threads, and TRUE.
Referenced by squidaio_open(), squidaio_stat(), and squidaio_unlink().
◆ squidaio_open()
int squidaio_open | ( | const char * | path, |
int | oflag, | ||
mode_t | mode, | ||
squidaio_result_t * | resultp | ||
) |
Definition at line 712 of file aiops_win32.cc.
References _AIO_OP_OPEN, Mem::Allocator::alloc(), squidaio_request_t::cancelled, squidaio_request_t::mode, squidaio_request_t::oflag, squidaio_request_t::path, squidaio_request_t::request_type, squidaio_result_t::result_type, squidaio_request_t::resultp, squidaio_init(), squidaio_queue_request(), squidaio_request_pool, and squidaio_xstrdup().
◆ squidaio_operations_pending()
int squidaio_operations_pending | ( | void | ) |
Definition at line 1045 of file aiops_win32.cc.
References done_requests, and request_queue_len.
Referenced by squidaio_sync().
◆ squidaio_poll_done()
squidaio_result_t * squidaio_poll_done | ( | void | ) |
Definition at line 1001 of file aiops_win32.cc.
References squidaio_request_t::cancelled, debugs, done_requests, squidaio_request_t::err, squidaio_request_t::next, NULL, squidaio_request_t::request_type, CommIO::ResetNotifications(), squidaio_request_t::resultp, squidaio_request_t::ret, squidaio_cleanup_request(), squidaio_debug(), and squidaio_poll_queues().
◆ squidaio_poll_queues()
|
static |
Definition at line 954 of file aiops_win32.cc.
References squidaio_request_queue_t::cond, done_queue, done_requests, fatal(), squidaio_request_queue_t::head, squidaio_request_queue_t::mutex, squidaio_request_t::next, request_queue, request_queue2, request_queue_len, and squidaio_request_queue_t::tailp.
Referenced by squidaio_poll_done(), squidaio_shutdown(), and squidaio_sync().
◆ squidaio_queue_request()
|
static |
Definition at line 532 of file aiops_win32.cc.
References squidaio_result_t::_data, squidaio_request_queue_t::cond, DBG_CRITICAL, DBG_IMPORTANT, debugs, squidaio_request_t::err, fatal(), int, MAGIC1, squidaio_request_queue_t::mutex, squidaio_request_t::next, request_queue, request_queue2, request_queue_len, squidaio_request_t::request_type, squidaio_request_t::resultp, squidaio_request_t::ret, RIDICULOUS_LENGTH, squid_curtime, squidaio_sync(), and squidaio_request_queue_t::tailp.
Referenced by squidaio_close(), squidaio_open(), squidaio_read(), squidaio_stat(), squidaio_unlink(), and squidaio_write().
◆ squidaio_read()
int squidaio_read | ( | int | fd, |
char * | bufp, | ||
size_t | bufs, | ||
off_t | offset, | ||
int | whence, | ||
squidaio_result_t * | resultp | ||
) |
Definition at line 746 of file aiops_win32.cc.
References _AIO_OP_READ, Mem::Allocator::alloc(), squidaio_request_t::bufferp, squidaio_request_t::buflen, squidaio_request_t::cancelled, squidaio_request_t::fd, squidaio_request_t::offset, squidaio_request_t::request_type, squidaio_result_t::result_type, squidaio_request_t::resultp, squidaio_queue_request(), squidaio_request_pool, and squidaio_request_t::whence.
◆ squidaio_shutdown()
void squidaio_shutdown | ( | void | ) |
Definition at line 319 of file aiops_win32.cc.
References squidaio_request_queue_t::cond, done_queue, squidaio_thread_t::exit, main_thread, squidaio_request_queue_t::mutex, squidaio_thread_t::next, CommIO::NotifyIOClose(), NUMTHREADS, request_queue, request_queue_len, squidaio_initialised, squidaio_poll_queues(), squidaio_thread_t::thread, threads, TRUE, xcalloc(), and xfree.
◆ squidaio_stat()
int squidaio_stat | ( | const char * | path, |
struct stat * | sb, | ||
squidaio_result_t * | resultp | ||
) |
Definition at line 866 of file aiops_win32.cc.
References _AIO_OP_STAT, Mem::Allocator::alloc(), squidaio_request_t::cancelled, squidaio_request_t::path, squidaio_request_t::request_type, squidaio_result_t::result_type, squidaio_request_t::resultp, sb, squidaio_init(), squidaio_queue_request(), squidaio_request_pool, squidaio_xmalloc(), squidaio_xstrdup(), squidaio_request_t::statp, and squidaio_request_t::tmpstatp.
◆ squidaio_stats()
void squidaio_stats | ( | StoreEntry * | sentry | ) |
Definition at line 1099 of file aiops_win32.cc.
References squidaio_thread_t::dwThreadId, squidaio_thread_t::next, NUMTHREADS, squidaio_thread_t::requests, squidaio_initialised, storeAppendPrintf(), and threads.
◆ squidaio_sync()
int squidaio_sync | ( | void | ) |
Definition at line 1051 of file aiops_win32.cc.
References request_queue_len, squidaio_operations_pending(), and squidaio_poll_queues().
Referenced by squidaio_queue_request().
◆ squidaio_thread_loop()
|
static |
Definition at line 363 of file aiops_win32.cc.
References _AIO_OP_CLOSE, _AIO_OP_OPEN, _AIO_OP_OPENDIR, _AIO_OP_READ, _AIO_OP_STAT, _AIO_OP_UNLINK, _AIO_OP_WRITE, _THREAD_BUSY, _THREAD_DONE, _THREAD_FAILED, _THREAD_WAITING, squidaio_request_t::cancelled, squidaio_request_queue_t::cond, squidaio_thread_t::current_req, done_queue, squidaio_request_t::err, squidaio_thread_t::exit, FALSE, fatal(), squidaio_request_queue_t::head, squidaio_request_queue_t::mutex, squidaio_request_t::next, CommIO::NotifyIOCompleted(), request_queue, squidaio_request_t::request_type, squidaio_thread_t::requests, squidaio_request_t::ret, squidaio_do_close(), squidaio_do_open(), squidaio_do_read(), squidaio_do_stat(), squidaio_do_unlink(), squidaio_do_write(), squidaio_thread_t::status, and squidaio_request_queue_t::tailp.
Referenced by squidaio_init().
◆ squidaio_unlink()
int squidaio_unlink | ( | const char * | path, |
squidaio_result_t * | resultp | ||
) |
Definition at line 900 of file aiops_win32.cc.
References _AIO_OP_UNLINK, Mem::Allocator::alloc(), squidaio_request_t::cancelled, squidaio_request_t::path, squidaio_request_t::request_type, squidaio_result_t::result_type, squidaio_request_t::resultp, squidaio_init(), squidaio_queue_request(), squidaio_request_pool, and squidaio_xstrdup().
◆ squidaio_write()
int squidaio_write | ( | int | fd, |
char * | bufp, | ||
size_t | bufs, | ||
off_t | offset, | ||
int | whence, | ||
squidaio_result_t * | resultp | ||
) |
Definition at line 790 of file aiops_win32.cc.
References _AIO_OP_WRITE, Mem::Allocator::alloc(), squidaio_request_t::bufferp, squidaio_request_t::buflen, squidaio_request_t::cancelled, squidaio_request_t::fd, squidaio_request_t::offset, squidaio_request_t::request_type, squidaio_result_t::result_type, squidaio_request_t::resultp, squidaio_queue_request(), squidaio_request_pool, and squidaio_request_t::whence.
◆ squidaio_xfree()
void squidaio_xfree | ( | void * | p, |
int | size | ||
) |
Definition at line 181 of file aiops_win32.cc.
References size, squidaio_get_pool(), and xfree.
Referenced by squidaio_cleanup_request().
◆ squidaio_xmalloc()
void * squidaio_xmalloc | ( | int | size | ) |
Definition at line 157 of file aiops_win32.cc.
References size, squidaio_get_pool(), and xmalloc.
Referenced by squidaio_stat(), and squidaio_xstrdup().
◆ squidaio_xstrdup()
|
static |
Definition at line 169 of file aiops_win32.cc.
References squidaio_xmalloc().
Referenced by squidaio_open(), squidaio_stat(), and squidaio_unlink().
◆ squidaio_xstrfree()
|
static |
Definition at line 190 of file aiops_win32.cc.
References squidaio_get_pool(), and xfree.
Referenced by squidaio_cleanup_request().
Variable Documentation
◆ done_queue
|
static |
Definition at line 124 of file aiops_win32.cc.
Referenced by squidaio_init(), squidaio_poll_queues(), squidaio_shutdown(), and squidaio_thread_loop().
◆
struct { ... } done_requests |
Referenced by squidaio_operations_pending(), squidaio_poll_done(), and squidaio_poll_queues().
◆ head
squidaio_request_t* head |
Definition at line 117 of file aiops_win32.cc.
◆ main_thread
|
static |
Definition at line 135 of file aiops_win32.cc.
Referenced by squidaio_init(), and squidaio_shutdown().
◆ request_queue
|
static |
Definition at line 114 of file aiops_win32.cc.
Referenced by squidaio_init(), squidaio_poll_queues(), squidaio_queue_request(), squidaio_shutdown(), and squidaio_thread_loop().
◆
struct { ... } request_queue2 |
Referenced by squidaio_poll_queues(), and squidaio_queue_request().
◆ request_queue_len
|
static |
Definition at line 111 of file aiops_win32.cc.
Referenced by squidaio_get_queue_len(), squidaio_operations_pending(), squidaio_poll_queues(), squidaio_queue_request(), squidaio_shutdown(), and squidaio_sync().
◆ squidaio_initialised
|
static |
Definition at line 97 of file aiops_win32.cc.
Referenced by squidaio_init(), squidaio_shutdown(), and squidaio_stats().
◆ squidaio_large_bufs
|
static |
Definition at line 105 of file aiops_win32.cc.
Referenced by squidaio_get_pool(), and squidaio_init().
◆ squidaio_medium_bufs
|
static |
Definition at line 106 of file aiops_win32.cc.
Referenced by squidaio_get_pool(), and squidaio_init().
◆ squidaio_micro_bufs
|
static |
Definition at line 109 of file aiops_win32.cc.
Referenced by squidaio_get_pool(), and squidaio_init().
◆ squidaio_request_pool
|
static |
Definition at line 112 of file aiops_win32.cc.
Referenced by squidaio_cleanup_request(), squidaio_close(), squidaio_init(), squidaio_open(), squidaio_read(), squidaio_stat(), squidaio_unlink(), and squidaio_write().
◆ squidaio_small_bufs
|
static |
Definition at line 107 of file aiops_win32.cc.
Referenced by squidaio_get_pool(), and squidaio_init().
◆ squidaio_thread_pool
|
static |
Definition at line 113 of file aiops_win32.cc.
Referenced by squidaio_init().
◆ squidaio_tiny_bufs
|
static |
Definition at line 108 of file aiops_win32.cc.
Referenced by squidaio_get_pool(), and squidaio_init().
◆ tailp
squidaio_request_t ** tailp |
Definition at line 117 of file aiops_win32.cc.
◆ threads
|
static |
Definition at line 96 of file aiops_win32.cc.
Referenced by squidaio_init(), squidaio_shutdown(), and squidaio_stats().