DiskThreads.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/*
10 * DiskThreads.h
11 *
12 * Internal declarations for the DiskThreads routines
13 */
14
15#ifndef __DISKTHREADS_H__
16#define __DISKTHREADS_H__
17
18#include "dlink.h"
19#include "mem/forward.h"
20
21/* this non-standard-conformant include is needed in order to have stat(2) and struct stat
22 properly defined on some systems (e.g. OpenBSD 5.4) */
23#if HAVE_SYS_STAT_H
24#include <sys/stat.h>
25#endif
26
27#if AUFS_IO_THREADS
28#define NUMTHREADS AUFS_IO_THREADS
29#else
30#define NUMTHREADS (Config.cacheSwap.n_configured*16)
31#endif
32
33/* Queue limit where swapouts are deferred (load calculation) */
34#define MAGIC1 (NUMTHREADS*Config.cacheSwap.n_configured*5)
35/* Queue limit where swapins are deferred (open/create fails) */
36#define MAGIC2 (NUMTHREADS*Config.cacheSwap.n_configured*20)
37
38/* Which operations to run async */
39#define ASYNC_OPEN 1
40#define ASYNC_CLOSE 0
41#define ASYNC_CREATE 1
42#define ASYNC_WRITE 0
43#define ASYNC_READ 1
44
54};
56
57typedef void AIOCB(int fd, void *cbdata, const char *buf, int aio_return, int aio_errno);
58
60{
61public:
62 int aio_return = 0;
63 int aio_errno = 0;
65 void *_data = nullptr; /* Internal housekeeping */
66 void *data = nullptr; /* Available to the caller */
67};
68
70{
72public:
73 squidaio_ctrl_t() : done_handler(nullptr), free_func(nullptr) {}
74
76 int fd = 0;
77 int operation = 0;
79 void *done_handler_data = nullptr;
81 int len = 0;
82 char *bufp = nullptr;
85};
86
87void squidaio_init(void);
88void squidaio_shutdown(void);
90int squidaio_open(const char *, int, mode_t, squidaio_result_t *);
91int squidaio_read(int, char *, size_t, off_t, int, squidaio_result_t *);
92int squidaio_write(int, char *, size_t, off_t, int, squidaio_result_t *);
94
95int squidaio_stat(const char *, struct stat *, squidaio_result_t *);
96int squidaio_unlink(const char *, squidaio_result_t *);
100int squidaio_sync(void);
101int squidaio_get_queue_len(void);
102void *squidaio_xmalloc(int size);
103void squidaio_xfree(void *p, int size);
105
106void aioInit(void);
107void aioDone(void);
108void aioCancel(int);
109void aioOpen(const char *, int, mode_t, AIOCB *, void *);
110void aioClose(int);
111void aioWrite(int, off_t offset, char *, size_t size, AIOCB *, void *, FREE *);
112void aioRead(int, off_t offset, size_t size, AIOCB *, void *);
113
114void aioStat(char *, struct stat *, AIOCB *, void *);
115void aioUnlink(const char *, AIOCB *, void *);
116int aioQueueSize(void);
117
118#include "DiskIO/DiskFile.h"
119
121
123{
124public:
125 uint64_t open_start = 0;
126 uint64_t open_finish = 0;
127 uint64_t close_start = 0;
128 uint64_t close_finish = 0;
129 uint64_t cancel = 0;
130 uint64_t write_start = 0;
131 uint64_t write_finish = 0;
132 uint64_t read_start = 0;
133 uint64_t read_finish = 0;
134 uint64_t stat_start = 0;
135 uint64_t stat_finish = 0;
136 uint64_t unlink_start = 0;
137 uint64_t unlink_finish = 0;
138 uint64_t check_callback = 0;
139};
140
142extern dlink_list used_list;
143
144#endif
145
int squidaio_write(int, char *, size_t, off_t, int, squidaio_result_t *)
Definition: aiops.cc:712
void aioUnlink(const char *, AIOCB *, void *)
Definition: async_io.cc:183
int aioQueueSize(void)
Definition: async_io.cc:199
int squidaio_operations_pending(void)
Definition: aiops.cc:945
void aioWrite(int, off_t offset, char *, size_t size, AIOCB *, void *, FREE *)
Definition: async_io.cc:107
int squidaio_stat(const char *, struct stat *, squidaio_result_t *)
Definition: aiops.cc:779
int squidaio_opendir(const char *, squidaio_result_t *)
enum _squidaio_request_type squidaio_request_type
Definition: DiskThreads.h:55
void squidaio_init(void)
Definition: aiops.cc:216
void aioOpen(const char *, int, mode_t, AIOCB *, void *)
Definition: async_io.cc:29
void squidaio_stats(StoreEntry *)
Definition: aiops.cc:999
int squidaio_close(int, squidaio_result_t *)
Definition: aiops.cc:749
int squidaio_open(const char *, int, mode_t, squidaio_result_t *)
Definition: aiops.cc:638
void squidaio_shutdown(void)
Definition: aiops.cc:329
void aioStat(char *, struct stat *, AIOCB *, void *)
Definition: async_io.cc:165
void aioClose(int)
Definition: async_io.cc:47
int squidaio_cancel(squidaio_result_t *)
Definition: aiops.cc:621
squidaio_result_t * squidaio_poll_done(void)
Definition: aiops.cc:901
void aioDone(void)
_squidaio_request_type
Definition: DiskThreads.h:45
@ _AIO_OP_OPENDIR
Definition: DiskThreads.h:52
@ _AIO_OP_NONE
Definition: DiskThreads.h:46
@ _AIO_OP_WRITE
Definition: DiskThreads.h:49
@ _AIO_OP_UNLINK
Definition: DiskThreads.h:51
@ _AIO_OP_OPEN
Definition: DiskThreads.h:47
@ _AIO_OP_READ
Definition: DiskThreads.h:48
@ _AIO_OP_CLOSE
Definition: DiskThreads.h:50
@ _AIO_OP_STAT
Definition: DiskThreads.h:53
int squidaio_read(int, char *, size_t, off_t, int, squidaio_result_t *)
Definition: aiops.cc:672
int squidaio_unlink(const char *, squidaio_result_t *)
Definition: aiops.cc:813
void aioCancel(int)
Definition: async_io.cc:66
void aioInit(void)
AIOCounts squidaio_counts
Definition: async_io.cc:18
void AIOCB(int fd, void *cbdata, const char *buf, int aio_return, int aio_errno)
Definition: DiskThreads.h:57
void squidaio_xfree(void *p, int size)
Definition: aiops.cc:196
dlink_list used_list
Definition: async_io.cc:26
int squidaio_sync(void)
Definition: aiops.cc:951
int squidaio_get_queue_len(void)
Definition: aiops.cc:963
void aioRead(int, off_t offset, size_t size, AIOCB *, void *)
Definition: async_io.cc:135
void * squidaio_xmalloc(int size)
Definition: aiops.cc:171
int size
Definition: ModDevPoll.cc:75
uint64_t read_start
Definition: DiskThreads.h:132
uint64_t write_finish
Definition: DiskThreads.h:131
uint64_t read_finish
Definition: DiskThreads.h:133
uint64_t stat_finish
Definition: DiskThreads.h:135
uint64_t write_start
Definition: DiskThreads.h:130
uint64_t close_finish
Definition: DiskThreads.h:128
uint64_t close_start
Definition: DiskThreads.h:127
uint64_t check_callback
Definition: DiskThreads.h:138
uint64_t cancel
Definition: DiskThreads.h:129
uint64_t stat_start
Definition: DiskThreads.h:134
uint64_t unlink_finish
Definition: DiskThreads.h:137
uint64_t open_start
Definition: DiskThreads.h:125
uint64_t open_finish
Definition: DiskThreads.h:126
uint64_t unlink_start
Definition: DiskThreads.h:136
Definition: cbdata.cc:38
AIOCB * done_handler
Definition: DiskThreads.h:78
FREE * free_func
Definition: DiskThreads.h:83
void * done_handler_data
Definition: DiskThreads.h:79
squidaio_result_t result
Definition: DiskThreads.h:80
squidaio_ctrl_t * next
Definition: DiskThreads.h:75
dlink_node node
Definition: DiskThreads.h:84
MEMPROXY_CLASS(squidaio_ctrl_t)
enum _squidaio_request_type result_type
Definition: DiskThreads.h:64
void FREE(void *)
Definition: forward.h:37
unsigned short mode_t
Definition: types.h:129

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors