diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2021-12-29 15:17:26 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2021-12-29 15:17:26 +0300 |
commit | f3363a8dbe29b3159881e259b2690c78757c946f (patch) | |
tree | dfc3e7dd6803c65a8b2a94c941fe258d05f6c756 /src/core/ngx_output_chain.c | |
parent | fa21bf0cc7ba2d94f66a061d644163547d79e6a2 (diff) | |
parent | 054944feb352ce16c5ef99e3fb58b8fd5796c0f1 (diff) | |
download | nginx-f3363a8dbe29b3159881e259b2690c78757c946f.tar.gz nginx-f3363a8dbe29b3159881e259b2690c78757c946f.zip |
Merged with the default branch.
Diffstat (limited to 'src/core/ngx_output_chain.c')
-rw-r--r-- | src/core/ngx_output_chain.c | 49 |
1 files changed, 13 insertions, 36 deletions
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index fd4603b19..857074253 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -29,10 +29,6 @@ static ngx_inline ngx_int_t ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf); -#if (NGX_HAVE_AIO_SENDFILE) -static ngx_int_t ngx_output_chain_aio_setup(ngx_output_chain_ctx_t *ctx, - ngx_file_t *file); -#endif static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in); static ngx_int_t ngx_output_chain_align_file_buf(ngx_output_chain_ctx_t *ctx, @@ -260,10 +256,6 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) } #endif - if (buf->in_file && buf->file->directio) { - return 0; - } - sendfile = ctx->sendfile; #if (NGX_SENDFILE_LIMIT) @@ -274,6 +266,19 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) #endif +#if !(NGX_HAVE_SENDFILE_NODISKIO) + + /* + * With DIRECTIO, disable sendfile() unless sendfile(SF_NOCACHE) + * is available. + */ + + if (buf->in_file && buf->file->directio) { + sendfile = 0; + } + +#endif + if (!sendfile) { if (!ngx_buf_in_memory(buf)) { @@ -283,12 +288,6 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) buf->in_file = 0; } -#if (NGX_HAVE_AIO_SENDFILE) - if (ctx->aio_preload && buf->in_file) { - (void) ngx_output_chain_aio_setup(ctx, buf->file); - } -#endif - if (ctx->need_in_memory && !ngx_buf_in_memory(buf)) { return 0; } @@ -301,28 +300,6 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) } -#if (NGX_HAVE_AIO_SENDFILE) - -static ngx_int_t -ngx_output_chain_aio_setup(ngx_output_chain_ctx_t *ctx, ngx_file_t *file) -{ - ngx_event_aio_t *aio; - - if (file->aio == NULL && ngx_file_aio_init(file, ctx->pool) != NGX_OK) { - return NGX_ERROR; - } - - aio = file->aio; - - aio->data = ctx->filter_ctx; - aio->preload_handler = ctx->aio_preload; - - return NGX_OK; -} - -#endif - - static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in) |