diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-08-28 13:21:12 +0000 |
|---|---|---|
| committer | Jonathan Kolb <jon@b0g.us> | 2009-08-28 13:21:12 +0000 |
| commit | 802fd20929172c84d0fae425d432cb4113b61708 (patch) | |
| tree | a1c12524eedc78161bfdd88994911ee06a7b0731 /src/core | |
| parent | 0761e54cdc650d741c4ed56e008ea15e1147733f (diff) | |
| download | nginx-802fd20929172c84d0fae425d432cb4113b61708.tar.gz | |
Changes with nginx 0.8.11 28 Aug 2009v0.8.11
*) Change: directive "gzip_disable msie6" enables gzipping for
MSIE 6.0 SV1.
*) Feature: file AIO support on FreeBSD and Linux.
*) Feature: the "directio_alignment" directive.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/nginx.h | 4 | ||||
| -rw-r--r-- | src/core/ngx_buf.h | 17 | ||||
| -rw-r--r-- | src/core/ngx_core.h | 1 | ||||
| -rw-r--r-- | src/core/ngx_file.h | 5 | ||||
| -rw-r--r-- | src/core/ngx_output_chain.c | 34 | ||||
| -rw-r--r-- | src/core/ngx_string.c | 2 |
6 files changed, 46 insertions, 17 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h index 819f02c35..f693e9aab 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,8 +8,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 8010 -#define NGINX_VERSION "0.8.10" +#define nginx_version 8011 +#define NGINX_VERSION "0.8.11" #define NGINX_VER "nginx/" NGINX_VERSION #define NGINX_VAR "NGINX" diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h index 56e03992d..ba4854489 100644 --- a/src/core/ngx_buf.h +++ b/src/core/ngx_buf.h @@ -67,9 +67,16 @@ typedef struct { } ngx_bufs_t; +typedef struct ngx_output_chain_ctx_s ngx_output_chain_ctx_t; + typedef ngx_int_t (*ngx_output_chain_filter_pt)(void *ctx, ngx_chain_t *in); -typedef struct { +#if (NGX_HAVE_FILE_AIO) +typedef void (*ngx_output_chain_aio_pt)(ngx_output_chain_ctx_t *ctx, + ngx_file_t *file); +#endif + +struct ngx_output_chain_ctx_s { ngx_buf_t *buf; ngx_chain_t *in; ngx_chain_t *free; @@ -83,6 +90,8 @@ typedef struct { unsigned need_in_memory:1; unsigned need_in_temp:1; + off_t alignment; + ngx_pool_t *pool; ngx_int_t allocated; ngx_bufs_t bufs; @@ -90,7 +99,11 @@ typedef struct { ngx_output_chain_filter_pt output_filter; void *filter_ctx; -} ngx_output_chain_ctx_t; + +#if (NGX_HAVE_FILE_AIO) + ngx_output_chain_aio_pt aio; +#endif +}; typedef struct { diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h index d5f18b84c..58d0b8030 100644 --- a/src/core/ngx_core.h +++ b/src/core/ngx_core.h @@ -19,6 +19,7 @@ typedef struct ngx_open_file_s ngx_open_file_t; typedef struct ngx_command_s ngx_command_t; typedef struct ngx_file_s ngx_file_t; typedef struct ngx_event_s ngx_event_t; +typedef struct ngx_event_aio_s ngx_event_aio_t; typedef struct ngx_connection_s ngx_connection_t; typedef void (*ngx_event_handler_pt)(ngx_event_t *ev); diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h index 56315433b..8b502539a 100644 --- a/src/core/ngx_file.h +++ b/src/core/ngx_file.h @@ -22,10 +22,15 @@ struct ngx_file_s { ngx_log_t *log; +#if (NGX_HAVE_FILE_AIO) + ngx_event_aio_t *aio; +#endif + unsigned valid_info:1; unsigned directio:1; }; + #define NGX_MAX_PATH_LEVEL 3 diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index 6d6d241c1..0e3925812 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -16,14 +16,12 @@ /* * When DIRECTIO is enabled FreeBSD, Solaris, and MacOSX read directly * to an application memory from a device if parameters are aligned - * to device sector boundary(512 bytes). They fallback to usual read + * to device sector boundary (512 bytes). They fallback to usual read * operation if the parameters are not aligned. * Linux allows DIRECTIO only if the parameters are aligned to a filesystem * sector boundary, otherwise it returns EINVAL. The sector size is * usually 512 bytes, however, on XFS it may be 4096 bytes. */ -#define NGX_DIRECTIO_BLOCK 4096 - #define NGX_NONE 1 @@ -337,7 +335,7 @@ ngx_output_chain_align_file_buf(ngx_output_chain_ctx_t *ctx, off_t bsize) ctx->directio = 1; - size = (size_t) (in->file_pos - (in->file_pos & ~(NGX_DIRECTIO_BLOCK - 1))); + size = (size_t) (in->file_pos - (in->file_pos & ~(ctx->alignment - 1))); if (size == 0) { @@ -348,7 +346,7 @@ ngx_output_chain_align_file_buf(ngx_output_chain_ctx_t *ctx, off_t bsize) size = (size_t) bsize; } else { - size = NGX_DIRECTIO_BLOCK - size; + size = (size_t) ctx->alignment - size; if ((off_t) size > bsize) { size = (size_t) bsize; @@ -423,7 +421,7 @@ ngx_output_chain_get_buf(ngx_output_chain_ctx_t *ctx, off_t bsize) * userland buffer direct usage conjunctly with directio */ - b->start = ngx_pmemalign(ctx->pool, size, NGX_DIRECTIO_BLOCK); + b->start = ngx_pmemalign(ctx->pool, size, (size_t) ctx->alignment); if (b->start == NULL) { return NGX_ERROR; } @@ -519,8 +517,26 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx) #endif +#if (NGX_HAVE_FILE_AIO) + + if (ctx->aio) { + n = ngx_file_aio_read(src->file, dst->pos, (size_t) size, + src->file_pos, ctx->pool); + if (n == NGX_AGAIN) { + ctx->aio(ctx, src->file); + return NGX_AGAIN; + } + + } else { + n = ngx_read_file(src->file, dst->pos, (size_t) size, + src->file_pos); + } +#else + n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos); +#endif + #if (NGX_HAVE_ALIGNED_DIRECTIO) if (ctx->unaligned) { @@ -545,12 +561,6 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx) return (ngx_int_t) n; } -#if (NGX_FILE_AIO_READ) - if (n == NGX_AGAIN) { - return (ngx_int_t) n; - } -#endif - if (n != size) { ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0, ngx_read_file_n " read only %z of %O from \"%s\"", diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index 0e33e3804..62dde82d9 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -90,7 +90,7 @@ ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src) * * reserved: * %t ptrdiff_t - * %S null-teminated wchar string + * %S null-terminated wchar string * %C wchar */ |
