]> git.ipfire.org Git - thirdparty/squid.git/blame - src/fs/aufs/store_asyncufs.h
Andres Kroonmaa's hi-res cpu profiling patch
[thirdparty/squid.git] / src / fs / aufs / store_asyncufs.h
CommitLineData
cd748f27 1/*
2 * store_aufs.h
3 *
4 * Internal declarations for the aufs routines
5 */
6
7#ifndef __STORE_ASYNCUFS_H__
8#define __STORE_ASYNCUFS_H__
9
f85c88f3 10#ifdef AUFS_IO_THREADS
11#define NUMTHREADS AUFS_IO_THREADS
cd748f27 12#else
55f0e6f7 13#define NUMTHREADS (Config.cacheSwap.n_configured*16)
cd748f27 14#endif
15
55f0e6f7 16/* Queue limit where swapouts are deferred (load calculation) */
17#define MAGIC1 (NUMTHREADS*Config.cacheSwap.n_configured*5)
18/* Queue limit where swapins are deferred (open/create fails) */
19#define MAGIC2 (NUMTHREADS*Config.cacheSwap.n_configured*20)
20
21/* Which operations to run async */
22#define ASYNC_OPEN 1
23#define ASYNC_CLOSE 0
24#define ASYNC_CREATE 1
25#define ASYNC_WRITE 0
26#define ASYNC_READ 1
cd748f27 27
c04d4f40 28struct _squidaio_result_t {
cd748f27 29 int aio_return;
30 int aio_errno;
f0debecb 31 void *_data; /* Internal housekeeping */
32 void *data; /* Available to the caller */
cd748f27 33};
34
c04d4f40 35typedef struct _squidaio_result_t squidaio_result_t;
cd748f27 36
37typedef void AIOCB(int fd, void *, int aio_return, int aio_errno);
38
c04d4f40 39int squidaio_cancel(squidaio_result_t *);
40int squidaio_open(const char *, int, mode_t, squidaio_result_t *);
41int squidaio_read(int, char *, int, off_t, int, squidaio_result_t *);
42int squidaio_write(int, char *, int, off_t, int, squidaio_result_t *);
43int squidaio_close(int, squidaio_result_t *);
44int squidaio_stat(const char *, struct stat *, squidaio_result_t *);
45int squidaio_unlink(const char *, squidaio_result_t *);
46int squidaio_truncate(const char *, off_t length, squidaio_result_t *);
47int squidaio_opendir(const char *, squidaio_result_t *);
48squidaio_result_t *squidaio_poll_done(void);
49int squidaio_operations_pending(void);
50int squidaio_sync(void);
51int squidaio_get_queue_len(void);
cd748f27 52
53void aioInit(void);
54void aioDone(void);
a4b8110e 55void aioCancel(int);
56void aioOpen(const char *, int, mode_t, AIOCB *, void *);
cd748f27 57void aioClose(int);
58void aioWrite(int, int offset, char *, int size, AIOCB *, void *, FREE *);
59void aioRead(int, int offset, char *, int size, AIOCB *, void *);
60void aioStat(char *, struct stat *, AIOCB *, void *);
61void aioUnlink(const char *, AIOCB *, void *);
15a47d1d 62void aioTruncate(const char *, off_t length, AIOCB *, void *);
6a566b9c 63int aioCheckCallbacks(SwapDir *);
cd748f27 64void aioSync(SwapDir *);
a4b8110e 65int aioQueueSize(void);
cd748f27 66
c04d4f40 67struct _squidaioinfo_t {
cd748f27 68 int swaplog_fd;
69 int l1;
70 int l2;
71 fileMap *map;
72 int suggest;
73};
74
c04d4f40 75struct _squidaiostate_t {
cd748f27 76 int fd;
77 struct {
78 unsigned int close_request:1;
79 unsigned int reading:1;
80 unsigned int writing:1;
81 unsigned int opening:1;
55f0e6f7 82 unsigned int write_kicking:1;
83 unsigned int read_kicking:1;
84 unsigned int inreaddone:1;
cd748f27 85 } flags;
86 const char *read_buf;
87 link_list *pending_writes;
88 link_list *pending_reads;
89};
90
58cd5bbd 91struct _queued_write {
92 char *buf;
93 size_t size;
94 off_t offset;
95 FREE *free_func;
96};
97
98struct _queued_read {
99 char *buf;
100 size_t size;
101 off_t offset;
102 STRCB *callback;
103 void *callback_data;
104};
105
c04d4f40 106typedef struct _squidaioinfo_t squidaioinfo_t;
107typedef struct _squidaiostate_t squidaiostate_t;
cd748f27 108
c04d4f40 109/* The squidaio_state memory pools */
110extern MemPool *squidaio_state_pool;
111extern MemPool *aufs_qread_pool;
112extern MemPool *aufs_qwrite_pool;
cd748f27 113
114extern void storeAufsDirMapBitReset(SwapDir *, sfileno);
115extern int storeAufsDirMapBitAllocate(SwapDir *);
116
a4b8110e 117extern char *storeAufsDirFullPath(SwapDir * SD, sfileno filn, char *fullpath);
cd748f27 118extern void storeAufsDirUnlinkFile(SwapDir *, sfileno);
a4b8110e 119extern void storeAufsDirReplAdd(SwapDir * SD, StoreEntry *);
cd748f27 120extern void storeAufsDirReplRemove(StoreEntry *);
121
122/*
123 * Store IO stuff
124 */
125extern STOBJCREATE storeAufsCreate;
126extern STOBJOPEN storeAufsOpen;
127extern STOBJCLOSE storeAufsClose;
128extern STOBJREAD storeAufsRead;
129extern STOBJWRITE storeAufsWrite;
130extern STOBJUNLINK storeAufsUnlink;
131
132#endif