3
A brief file description
5
@section license License
7
Licensed to the Apache Software Foundation (ASF) under one
8
or more contributor license agreements. See the NOTICE file
9
distributed with this work for additional information
10
regarding copyright ownership. The ASF licenses this file
11
to you under the Apache License, Version 2.0 (the
12
"License"); you may not use this file except in compliance
13
with the License. You may obtain a copy of the License at
15
http://www.apache.org/licenses/LICENSE-2.0
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
24
/****************************************************************************
26
Async Disk IO operations.
30
****************************************************************************/
36
#define TS_INLINE inline
39
#include "P_EventSystem.h"
43
// #define AIO_STATS 1
45
#undef AIO_MODULE_VERSION
46
#define AIO_MODULE_VERSION makeModuleVersion(AIO_MODULE_MAJOR_VERSION,\
47
AIO_MODULE_MINOR_VERSION,\
48
PRIVATE_MODULE_HEADER)
51
struct AIOCallbackInternal: public AIOCallback
55
ink_hrtime sleep_time;
56
int io_complete(int event, void *data);
59
const size_t to_zero = sizeof(AIOCallbackInternal)
60
- (size_t) & (((AIOCallbackInternal *) 0)->aiocb);
61
memset((char *) &(this->aiocb), 0, to_zero);
62
SET_HANDLER(&AIOCallbackInternal::io_complete);
63
// we do a memset() on AIOCallback and AIOCallbackInternal, so it sets all the members to 0
64
// coverity[uninit_member]
71
return (off_t) aiocb.aio_nbytes == (off_t) aio_result;
75
AIOCallbackInternal::io_complete(int event, void *data)
79
if (!action.cancelled)
80
action.continuation->handleEvent(AIO_EVENT_DONE, this);
86
Que(AIOCallback, link) aio_todo; /* queue for holding non-http requests */
87
Que(AIOCallback, link) http_aio_todo; /* queue for http requests */
88
/* Atomic list to temporarily hold the request if the
89
lock for a particular queue cannot be acquired */
90
InkAtomicList aio_temp_list;
93
int index; /* position of this struct in the aio_reqs array */
94
volatile int pending; /* number of outstanding requests on the disk */
95
volatile int queued; /* total number of aio_todo and http_todo requests */
96
volatile int filedes; /* the file descriptor for the requests */
97
volatile int requests_queued;
101
class AIOTestData:public Continuation
109
int ink_aio_stats(int event, void *data);
111
AIOTestData():Continuation(new_ProxyMutex()), num_req(0), num_temp(0), num_queue(0)
113
start = ink_get_hrtime();
114
SET_HANDLER(&AIOTestData::ink_aio_stats);
121
AIO_STAT_READ_PER_SEC,
122
AIO_STAT_KB_READ_PER_SEC,
123
AIO_STAT_WRITE_PER_SEC,
124
AIO_STAT_KB_WRITE_PER_SEC,
127
extern RecRawStatBlock *aio_rsb;
130
extern NTIOCompletionPort aio_completion_port;