4 * Internal declarations for the DiskThreads routines
7 #ifndef __DISKTHREADS_H__
8 #define __DISKTHREADS_H__
13 /* this non-standard-conformant include is needed in order to have stat(2) and struct stat
14 properly defined on some systems (e.g. OpenBSD 5.4) */
20 #define NUMTHREADS AUFS_IO_THREADS
22 #define NUMTHREADS (Config.cacheSwap.n_configured*16)
25 /* Queue limit where swapouts are deferred (load calculation) */
26 #define MAGIC1 (NUMTHREADS*Config.cacheSwap.n_configured*5)
27 /* Queue limit where swapins are deferred (open/create fails) */
28 #define MAGIC2 (NUMTHREADS*Config.cacheSwap.n_configured*20)
30 /* Which operations to run async */
33 #define ASYNC_CREATE 1
37 enum _squidaio_request_type
{
47 typedef enum _squidaio_request_type squidaio_request_type
;
49 typedef void AIOCB(int fd
, void *cbdata
, const char *buf
, int aio_return
, int aio_errno
);
51 struct squidaio_result_t
{
54 enum _squidaio_request_type result_type
;
55 void *_data
; /* Internal housekeeping */
56 void *data
; /* Available to the caller */
59 struct squidaio_ctrl_t
{
61 struct squidaio_ctrl_t
*next
;
65 void *done_handler_data
;
66 squidaio_result_t result
;
73 void squidaio_init(void);
74 void squidaio_shutdown(void);
75 int squidaio_cancel(squidaio_result_t
*);
76 int squidaio_open(const char *, int, mode_t
, squidaio_result_t
*);
77 int squidaio_read(int, char *, size_t, off_t
, int, squidaio_result_t
*);
78 int squidaio_write(int, char *, size_t, off_t
, int, squidaio_result_t
*);
79 int squidaio_close(int, squidaio_result_t
*);
81 int squidaio_stat(const char *, struct stat
*, squidaio_result_t
*);
82 int squidaio_unlink(const char *, squidaio_result_t
*);
83 int squidaio_opendir(const char *, squidaio_result_t
*);
84 squidaio_result_t
*squidaio_poll_done(void);
85 int squidaio_operations_pending(void);
86 int squidaio_sync(void);
87 int squidaio_get_queue_len(void);
88 void *squidaio_xmalloc(int size
);
89 void squidaio_xfree(void *p
, int size
);
90 void squidaio_stats(StoreEntry
*);
95 void aioOpen(const char *, int, mode_t
, AIOCB
*, void *);
97 void aioWrite(int, off_t offset
, char *, size_t size
, AIOCB
*, void *, FREE
*);
98 void aioRead(int, off_t offset
, size_t size
, AIOCB
*, void *);
100 void aioStat(char *, struct stat
*, AIOCB
*, void *);
101 void aioUnlink(const char *, AIOCB
*, void *);
102 int aioQueueSize(void);
104 #include "DiskIO/DiskFile.h"
106 class DiskThreadsIOStrategy
;
110 uint64_t open_finish
;
111 uint64_t close_start
;
112 uint64_t close_finish
;
114 uint64_t write_start
;
115 uint64_t write_finish
;
117 uint64_t read_finish
;
119 uint64_t stat_finish
;
120 uint64_t unlink_start
;
121 uint64_t unlink_finish
;
122 uint64_t check_callback
;
125 extern AIOCounts squidaio_counts
;
126 extern dlink_list used_list
;