aiops.cc File Reference
#include "squid.h"
#include "DiskIO/DiskThreads/CommIO.h"
#include "DiskThreads.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "Store.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 MemAllocatorsquidaio_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 = NULL
 
static int squidaio_initialised = 0
 
static MemAllocatorsquidaio_large_bufs = NULL
 
static MemAllocatorsquidaio_medium_bufs = NULL
 
static MemAllocatorsquidaio_small_bufs = NULL
 
static MemAllocatorsquidaio_tiny_bufs = NULL
 
static MemAllocatorsquidaio_micro_bufs = NULL
 
static int request_queue_len = 0
 
static MemAllocatorsquidaio_request_pool = NULL
 
static MemAllocatorsquidaio_thread_pool = NULL
 
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

#define AIO_LARGE_BUFS   16384

Definition at line 109 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

#define AIO_MEDIUM_BUFS   AIO_LARGE_BUFS >> 1

Definition at line 110 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

#define AIO_MICRO_BUFS   128

Definition at line 113 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

#define AIO_SMALL_BUFS   AIO_LARGE_BUFS >> 2

Definition at line 111 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

#define AIO_TINY_BUFS   AIO_LARGE_BUFS >> 3

Definition at line 112 of file aiops.cc.

Referenced by squidaio_get_pool(), and squidaio_init().

#define RIDICULOUS_LENGTH   4096

Definition at line 38 of file aiops.cc.

Referenced by squidaio_queue_request().

Typedef Documentation

Definition at line 47 of file aiops.cc.

Definition at line 80 of file aiops.cc.

Enumeration Type Documentation

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

int squidaio_cancel ( squidaio_result_t resultp)

Definition at line 625 of file aiops.cc.

Referenced by aioCancel().

int squidaio_close ( int  fd,
squidaio_result_t resultp 
)

Definition at line 753 of file aiops.cc.

Referenced by aioClose().

static void squidaio_do_close ( squidaio_request_t requestp)
static

Definition at line 775 of file aiops.cc.

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

Referenced by squidaio_thread_loop().

static void squidaio_do_open ( squidaio_request_t requestp)
static
static void squidaio_do_stat ( squidaio_request_t requestp)
static
static void squidaio_do_unlink ( squidaio_request_t requestp)
static
static void squidaio_do_write ( squidaio_request_t requestp)
static
int squidaio_get_queue_len ( void  )

Definition at line 967 of file aiops.cc.

Referenced by DiskThreadsIOStrategy::aioStats().

void squidaio_init ( void  )

Definition at line 220 of file aiops.cc.

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

int squidaio_open ( const char *  path,
int  oflag,
mode_t  mode,
squidaio_result_t resultp 
)

Definition at line 642 of file aiops.cc.

Referenced by aioOpen().

int squidaio_operations_pending ( void  )

Definition at line 949 of file aiops.cc.

Referenced by squidaio_sync().

squidaio_result_t* squidaio_poll_done ( void  )

Definition at line 905 of file aiops.cc.

Referenced by DiskThreadsIOStrategy::callback().

int squidaio_read ( int  fd,
char *  bufp,
size_t  bufs,
off_t  offset,
int  whence,
squidaio_result_t resultp 
)

Definition at line 676 of file aiops.cc.

Referenced by aioRead().

void squidaio_shutdown ( void  )

Definition at line 333 of file aiops.cc.

Referenced by DiskThreadsIOStrategy::done().

int squidaio_stat ( const char *  path,
struct stat *  sb,
squidaio_result_t resultp 
)

Definition at line 783 of file aiops.cc.

Referenced by aioStat().

void squidaio_stats ( StoreEntry sentry)

Definition at line 1003 of file aiops.cc.

Referenced by DiskThreadsIOStrategy::aioStats().

int squidaio_sync ( void  )

Definition at line 955 of file aiops.cc.

Referenced by squidaio_queue_request(), and DiskThreadsIOStrategy::sync().

int squidaio_unlink ( const char *  path,
squidaio_result_t resultp 
)

Definition at line 817 of file aiops.cc.

Referenced by aioUnlink().

int squidaio_write ( int  fd,
char *  bufp,
size_t  bufs,
off_t  offset,
int  whence,
squidaio_result_t resultp 
)

Definition at line 716 of file aiops.cc.

Referenced by aioWrite().

void squidaio_xfree ( void *  p,
int  size 
)

Definition at line 197 of file aiops.cc.

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

void* squidaio_xmalloc ( int  size)

Definition at line 171 of file aiops.cc.

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

static char* squidaio_xstrdup ( const char *  str)
static

Definition at line 185 of file aiops.cc.

References len, p, and squidaio_xmalloc().

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

static void squidaio_xstrfree ( char *  str)
static

Definition at line 208 of file aiops.cc.

References MemAllocator::freeOne(), len, NULL, squidaio_get_pool(), and xfree.

Referenced by squidaio_cleanup_request().

Variable Documentation

squidaio_request_queue_t done_queue
static

Definition at line 134 of file aiops.cc.

struct { ... } done_requests
Initial value:
= {
}
static struct @47 done_requests
#define NULL
Definition: types.h:166

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

pthread_attr_t globattr
static

Definition at line 144 of file aiops.cc.

Referenced by squidaio_init().

pthread_t main_thread
static

Definition at line 149 of file aiops.cc.

Referenced by squidaio_init().

squidaio_request_queue_t request_queue
static

Definition at line 124 of file aiops.cc.

struct { ... } request_queue2
Initial value:
= {
}
static struct @46 request_queue2
#define NULL
Definition: types.h:166

Referenced by squidaio_poll_queues(), and squidaio_queue_request().

int squidaio_initialised = 0
static

Definition at line 107 of file aiops.cc.

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

MemAllocator* squidaio_large_bufs = NULL
static

Definition at line 115 of file aiops.cc.

Referenced by squidaio_get_pool().

MemAllocator* squidaio_medium_bufs = NULL
static

Definition at line 116 of file aiops.cc.

Referenced by squidaio_get_pool().

MemAllocator* squidaio_micro_bufs = NULL
static

Definition at line 119 of file aiops.cc.

Referenced by squidaio_get_pool().

MemAllocator* squidaio_request_pool = NULL
static

Definition at line 122 of file aiops.cc.

MemAllocator* squidaio_small_bufs = NULL
static

Definition at line 117 of file aiops.cc.

Referenced by squidaio_get_pool().

MemAllocator* squidaio_thread_pool = NULL
static

Definition at line 123 of file aiops.cc.

MemAllocator* squidaio_tiny_bufs = NULL
static

Definition at line 118 of file aiops.cc.

Referenced by squidaio_get_pool().

Definition at line 127 of file aiops.cc.

squidaio_thread_t* threads = NULL
static

Definition at line 106 of file aiops.cc.

Referenced by squidaio_init(), and squidaio_stats().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors