aiops.cc File Reference
#include "squid.h"
#include "DiskIO/DiskThreads/CommIO.h"
#include "DiskThreads.h"
#include "SquidConfig.h"
#include "Store.h"
#include "mem/Allocator.h"
#include "mem/Pool.h"
#include <cerrno>
#include <csignal>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <dirent.h>
Include dependency graph for aiops.cc:

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
}
 

Functions

static void squidaio_queue_request (squidaio_request_t *)
 
static void squidaio_cleanup_request (squidaio_request_t *)
 
void * squidaio_thread_loop (void *)
 
static void squidaio_do_open (squidaio_request_t *)
 
static void squidaio_do_read (squidaio_request_t *)
 
static void squidaio_do_write (squidaio_request_t *)
 
static void squidaio_do_close (squidaio_request_t *)
 
static void squidaio_do_stat (squidaio_request_t *)
 
static void squidaio_do_unlink (squidaio_request_t *)
 
static void squidaio_debug (squidaio_request_t *)
 
static void squidaio_poll_queues (void)
 
static Mem::Allocatorsquidaio_get_pool (int size)
 
void * squidaio_xmalloc (int size)
 
static char * squidaio_xstrdup (const char *str)
 
void squidaio_xfree (void *p, int size)
 
static void squidaio_xstrfree (char *str)
 
void squidaio_init (void)
 
void squidaio_shutdown (void)
 
int squidaio_cancel (squidaio_result_t *resultp)
 
int squidaio_open (const char *path, int oflag, mode_t mode, squidaio_result_t *resultp)
 
int squidaio_read (int fd, char *bufp, size_t bufs, off_t offset, int whence, squidaio_result_t *resultp)
 
int squidaio_write (int fd, char *bufp, size_t bufs, off_t offset, int whence, squidaio_result_t *resultp)
 
int squidaio_close (int fd, squidaio_result_t *resultp)
 
int squidaio_stat (const char *path, struct stat *sb, squidaio_result_t *resultp)
 
int squidaio_unlink (const char *path, squidaio_result_t *resultp)
 
squidaio_result_tsquidaio_poll_done (void)
 
int squidaio_operations_pending (void)
 
int squidaio_sync (void)
 
int squidaio_get_queue_len (void)
 
void squidaio_stats (StoreEntry *sentry)
 

Variables

static squidaio_thread_tthreads = nullptr
 
static int squidaio_initialised = 0
 
static Mem::Allocatorsquidaio_large_bufs = nullptr
 
static Mem::Allocatorsquidaio_medium_bufs = nullptr
 
static Mem::Allocatorsquidaio_small_bufs = nullptr
 
static Mem::Allocatorsquidaio_tiny_bufs = nullptr
 
static Mem::Allocatorsquidaio_micro_bufs = nullptr
 
static int request_queue_len = 0
 
static Mem::Allocatorsquidaio_request_pool = nullptr
 
static Mem::Allocatorsquidaio_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 pthread_attr_t globattr
 
static pthread_t main_thread
 

Macro Definition Documentation

◆ AIO_LARGE_BUFS

#define AIO_LARGE_BUFS   16384

Definition at line 109 of file aiops.cc.

◆ AIO_MEDIUM_BUFS

#define AIO_MEDIUM_BUFS   AIO_LARGE_BUFS >> 1

Definition at line 110 of file aiops.cc.

◆ AIO_MICRO_BUFS

#define AIO_MICRO_BUFS   128

Definition at line 113 of file aiops.cc.

◆ AIO_SMALL_BUFS

#define AIO_SMALL_BUFS   AIO_LARGE_BUFS >> 2

Definition at line 111 of file aiops.cc.

◆ AIO_TINY_BUFS

#define AIO_TINY_BUFS   AIO_LARGE_BUFS >> 3

Definition at line 112 of file aiops.cc.

◆ RIDICULOUS_LENGTH

#define RIDICULOUS_LENGTH   4096

Definition at line 38 of file aiops.cc.

Typedef Documentation

◆ squidaio_request_queue_t

◆ squidaio_request_t

◆ squidaio_thread_status

Definition at line 47 of file aiops.cc.

◆ squidaio_thread_t

Definition at line 80 of file aiops.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 40 of file aiops.cc.

Function Documentation

◆ squidaio_cancel()

◆ squidaio_cleanup_request()

◆ squidaio_close()

◆ squidaio_debug()

◆ squidaio_do_close()

static void squidaio_do_close ( squidaio_request_t requestp)
static

Definition at line 771 of file aiops.cc.

References squidaio_request_t::err, squidaio_request_t::fd, and squidaio_request_t::ret.

Referenced by squidaio_thread_loop().

◆ squidaio_do_open()

static void squidaio_do_open ( squidaio_request_t requestp)
static

◆ squidaio_do_read()

◆ squidaio_do_stat()

static void squidaio_do_stat ( squidaio_request_t requestp)
static

◆ squidaio_do_unlink()

static void squidaio_do_unlink ( squidaio_request_t requestp)
static

◆ squidaio_do_write()

static void squidaio_do_write ( squidaio_request_t requestp)
static

◆ squidaio_get_pool()

◆ squidaio_get_queue_len()

int squidaio_get_queue_len ( void  )

Definition at line 963 of file aiops.cc.

References request_queue_len.

Referenced by DiskThreadsIOStrategy::aioStats().

◆ squidaio_init()

◆ squidaio_open()

◆ squidaio_operations_pending()

int squidaio_operations_pending ( void  )

Definition at line 945 of file aiops.cc.

References done_requests, and request_queue_len.

Referenced by squidaio_sync().

◆ squidaio_poll_done()

◆ squidaio_poll_queues()

◆ squidaio_queue_request()

◆ squidaio_read()

◆ squidaio_shutdown()

void squidaio_shutdown ( void  )

◆ squidaio_stat()

◆ squidaio_stats()

◆ squidaio_sync()

int squidaio_sync ( void  )

◆ squidaio_thread_loop()

◆ squidaio_unlink()

◆ squidaio_write()

◆ squidaio_xfree()

void squidaio_xfree ( void *  p,
int  size 
)

Definition at line 196 of file aiops.cc.

References size, squidaio_get_pool(), and xfree.

Referenced by aioCancel(), DiskThreadsIOStrategy::callback(), and squidaio_cleanup_request().

◆ squidaio_xmalloc()

void * squidaio_xmalloc ( int  size)

Definition at line 171 of file aiops.cc.

References size, squidaio_get_pool(), and xmalloc.

Referenced by aioRead(), squidaio_stat(), and squidaio_xstrdup().

◆ squidaio_xstrdup()

static char * squidaio_xstrdup ( const char *  str)
static

Definition at line 184 of file aiops.cc.

References squidaio_xmalloc().

Referenced by squidaio_open(), squidaio_stat(), and squidaio_unlink().

◆ squidaio_xstrfree()

static void squidaio_xstrfree ( char *  str)
static

Definition at line 205 of file aiops.cc.

References squidaio_get_pool(), and xfree.

Referenced by squidaio_cleanup_request().

Variable Documentation

◆ done_queue

squidaio_request_queue_t done_queue
static

Definition at line 134 of file aiops.cc.

Referenced by squidaio_init(), squidaio_poll_queues(), and squidaio_thread_loop().

◆ 

struct { ... } done_requests
Initial value:
= {
nullptr, &done_requests.head
}
static struct @44 done_requests

Referenced by squidaio_operations_pending(), squidaio_poll_done(), and squidaio_poll_queues().

◆ globattr

pthread_attr_t globattr
static

Definition at line 144 of file aiops.cc.

Referenced by squidaio_init().

◆ head

Definition at line 127 of file aiops.cc.

Referenced by Security::Sslv2Record::Sslv2Record(), CbDataListContainer< C >::~CbDataListContainer(), aclDestroyAcls(), aclFindNfMarkConfig(), aclGetDenyInfoPage(), aclMapTOS(), aclParseDenyInfoLine(), Splay< V >::begin(), AsyncCall::dequeue(), Splay< V >::destroy(), dump_acl_access(), dump_acl_address(), dump_acl_b_size_t(), dump_acl_list(), dump_acl_tos(), dump_refreshpattern(), CbDataListContainer< C >::empty(), Adaptation::Icap::ModXact::encapsulateHead(), ESISegmentFreeList(), Splay< V >::find(), Splay< V >::finish(), for_each(), free_acl_access(), free_acl_address(), free_acl_b_size_t(), free_acl_tos(), free_cachemgrpasswd(), free_IpAddress_list(), free_refreshpattern(), gen_conf(), gen_default(), gen_default_if_none(), gen_default_postscriptum(), gen_dump(), gen_free(), gen_parse(), idnsSendQueryVC(), IncreaseSum(), SplayConstIterator< V >::init(), Splay< V >::insert(), Security::HandshakeParser::isSslv2Record(), ESISegment::ListAppend(), match(), Adaptation::Icap::ModXact::packHead(), parse_acl_access(), parse_acl_address(), parse_acl_b_size_t(), parse_acl_tos(), parse_cachemgrpasswd(), parse_IpAddress_list(), parse_refreshpattern(), ACL::ParseAclLine(), parseCommandline(), Ftp::Client::parseControlReply(), Adaptation::Icap::ModXact::parseHead(), parsePortCfg(), CbDataListContainer< C >::pop_front(), CbDataListContainer< C >::push_back(), Splay< V >::remove(), squid_rn_addroute(), squid_rn_delete(), squid_rn_inithead(), squid_rn_insert(), squid_rn_lookup(), squid_rn_match(), squid_rn_search(), squid_rn_search_m(), Splay< V >::start(), Splay< V >::visitEach(), wccp2SortCacheList(), and ClientInfo::writeOrDequeue().

◆ main_thread

pthread_t main_thread
static

Definition at line 149 of file aiops.cc.

Referenced by squidaio_init().

◆ request_queue

squidaio_request_queue_t request_queue
static

◆ 

struct { ... } request_queue2
Initial value:
= {
nullptr, &request_queue2.head
}
static struct @43 request_queue2

Referenced by squidaio_poll_queues(), and squidaio_queue_request().

◆ request_queue_len

◆ squidaio_initialised

int squidaio_initialised = 0
static

Definition at line 107 of file aiops.cc.

Referenced by squidaio_init(), squidaio_shutdown(), and squidaio_stats().

◆ squidaio_large_bufs

Mem::Allocator* squidaio_large_bufs = nullptr
static

Definition at line 115 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

◆ squidaio_medium_bufs

Mem::Allocator* squidaio_medium_bufs = nullptr
static

Definition at line 116 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

◆ squidaio_micro_bufs

Mem::Allocator* squidaio_micro_bufs = nullptr
static

Definition at line 119 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

◆ squidaio_request_pool

◆ squidaio_small_bufs

Mem::Allocator* squidaio_small_bufs = nullptr
static

Definition at line 117 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

◆ squidaio_thread_pool

Mem::Allocator* squidaio_thread_pool = nullptr
static

Definition at line 123 of file aiops.cc.

Referenced by squidaio_init().

◆ squidaio_tiny_bufs

Mem::Allocator* squidaio_tiny_bufs = nullptr
static

Definition at line 118 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

◆ tailp

Definition at line 127 of file aiops.cc.

◆ threads

squidaio_thread_t* threads = nullptr
static

Definition at line 106 of file aiops.cc.

Referenced by squidaio_init(), and squidaio_stats().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors