comparison src/event/ngx_event.h @ 5980:ccad84a174e0

Refactored sendfile() AIO preload. This reduces layering violation and simplifies the logic of AIO preread, since it's now triggered by the send chain function itself without falling back to the copy filter. The context of AIO operation is now stored per file buffer, which makes it possible to properly handle cases when multiple buffers come from different locations, each with its own configuration.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 11 Feb 2015 17:52:15 +0300
parents 3efdd7788bb0
children ea58dfd07782
comparison
equal deleted inserted replaced
5979:b2920b517490 5980:ccad84a174e0
166 struct ngx_event_aio_s { 166 struct ngx_event_aio_s {
167 void *data; 167 void *data;
168 ngx_event_handler_pt handler; 168 ngx_event_handler_pt handler;
169 ngx_file_t *file; 169 ngx_file_t *file;
170 170
171 #if (NGX_HAVE_AIO_SENDFILE)
172 ssize_t (*preload_handler)(ngx_buf_t *file);
173 #endif
174
171 ngx_fd_t fd; 175 ngx_fd_t fd;
172 176
173 #if (NGX_HAVE_EVENTFD) 177 #if (NGX_HAVE_EVENTFD)
174 int64_t res; 178 int64_t res;
175 #if (NGX_TEST_BUILD_EPOLL) 179 #if (NGX_TEST_BUILD_EPOLL)
177 size_t nbytes; 181 size_t nbytes;
178 #endif 182 #endif
179 #else 183 #else
180 ngx_err_t err; 184 ngx_err_t err;
181 size_t nbytes; 185 size_t nbytes;
182 #endif
183
184 #if (NGX_HAVE_AIO_SENDFILE)
185 off_t last_offset;
186 #endif 186 #endif
187 187
188 ngx_aiocb_t aiocb; 188 ngx_aiocb_t aiocb;
189 ngx_event_t event; 189 ngx_event_t event;
190 }; 190 };