Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to nginx 1.22.1 #1719

Merged
merged 18 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,6 @@ ngx_http_multi_upstream_init_connection(ngx_connection_t *c,
fake_u->peer.connection = c;
#if (NGX_HAVE_FILE_AIO || NGX_COMPAT)
fake_u->output.aio_handler = u->output.aio_handler;
#if (NGX_HAVE_AIO_SENDFILE || NGX_COMPAT)
fake_u->output.aio_preload = u->output.aio_preload;
#endif
#endif

#if (NGX_THREADS || NGX_COMPAT)
Expand Down
3 changes: 0 additions & 3 deletions src/core/ngx_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ struct ngx_output_chain_ctx_s {

#if (NGX_HAVE_FILE_AIO || NGX_COMPAT)
ngx_output_chain_aio_pt aio_handler;
#if (NGX_HAVE_AIO_SENDFILE || NGX_COMPAT)
ssize_t (*aio_preload)(ngx_buf_t *file);
#endif
#endif

#if (NGX_THREADS || NGX_COMPAT)
Expand Down
32 changes: 0 additions & 32 deletions src/core/ngx_output_chain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -292,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;
}
Expand All @@ -310,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)
Expand Down
4 changes: 0 additions & 4 deletions src/event/ngx_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ struct ngx_event_aio_s {

ngx_fd_t fd;

#if (NGX_HAVE_AIO_SENDFILE || NGX_COMPAT)
ssize_t (*preload_handler)(ngx_buf_t *file);
#endif

#if (NGX_HAVE_EVENTFD)
int64_t res;
#endif
Expand Down
54 changes: 0 additions & 54 deletions src/http/ngx_http_copy_filter_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ typedef struct {
static void ngx_http_copy_aio_handler(ngx_output_chain_ctx_t *ctx,
ngx_file_t *file);
static void ngx_http_copy_aio_event_handler(ngx_event_t *ev);
#if (NGX_HAVE_AIO_SENDFILE)
static ssize_t ngx_http_copy_aio_sendfile_preload(ngx_buf_t *file);
static void ngx_http_copy_aio_sendfile_event_handler(ngx_event_t *ev);
#endif
#endif
#if (NGX_THREADS)
static ngx_int_t ngx_http_copy_thread_handler(ngx_thread_task_t *task,
Expand Down Expand Up @@ -128,9 +124,6 @@ ngx_http_copy_filter(ngx_http_request_t *r, ngx_chain_t *in)
#if (NGX_HAVE_FILE_AIO)
if (ngx_file_aio && clcf->aio == NGX_HTTP_AIO_ON) {
ctx->aio_handler = ngx_http_copy_aio_handler;
#if (NGX_HAVE_AIO_SENDFILE)
ctx->aio_preload = ngx_http_copy_aio_sendfile_preload;
#endif
}
#endif

Expand Down Expand Up @@ -207,53 +200,6 @@ ngx_http_copy_aio_event_handler(ngx_event_t *ev)
ngx_http_run_posted_requests(c);
}


#if (NGX_HAVE_AIO_SENDFILE)

static ssize_t
ngx_http_copy_aio_sendfile_preload(ngx_buf_t *file)
{
ssize_t n;
static u_char buf[1];
ngx_event_aio_t *aio;
ngx_http_request_t *r;
ngx_output_chain_ctx_t *ctx;

n = ngx_file_aio_read(file->file, buf, 1, file->file_pos, NULL);

if (n == NGX_AGAIN) {
aio = file->file->aio;
aio->handler = ngx_http_copy_aio_sendfile_event_handler;

r = aio->data;
r->main->blocked++;
r->aio = 1;

ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
ctx->aio = 1;
}

return n;
}


static void
ngx_http_copy_aio_sendfile_event_handler(ngx_event_t *ev)
{
ngx_event_aio_t *aio;
ngx_http_request_t *r;

aio = ev->data;
r = aio->data;

r->main->blocked--;
r->aio = 0;
ev->complete = 0;

r->connection->write->handler(r->connection->write);
}

#endif
#endif


Expand Down
13 changes: 0 additions & 13 deletions src/http/ngx_http_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -4879,19 +4879,6 @@ ngx_http_core_set_aio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
#endif
}

#if (NGX_HAVE_AIO_SENDFILE)

if (ngx_strcmp(value[1].data, "sendfile") == 0) {
clcf->aio = NGX_HTTP_AIO_ON;

ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"the \"sendfile\" parameter of "
"the \"aio\" directive is deprecated");
return NGX_CONF_OK;
}

#endif

if (ngx_strncmp(value[1].data, "threads", 7) == 0
&& (value[1].len == 7 || value[1].data[7] == '='))
{
Expand Down