summaryrefslogtreecommitdiffhomepage
path: root/src/core/ngx_output_chain.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-07-30 12:34:04 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-07-30 12:34:04 +0000
commit385af286421e983f744f7f5d339b8060ccd36302 (patch)
tree81c46d0dad40506cc3a331c6ffaf454da85a0177 /src/core/ngx_output_chain.c
parent749449097847cc3bee9e4e3966122a94149b755b (diff)
downloadnginx-385af286421e983f744f7f5d339b8060ccd36302.tar.gz
nginx-385af286421e983f744f7f5d339b8060ccd36302.tar.bz2
directio
Diffstat (limited to 'src/core/ngx_output_chain.c')
-rw-r--r--src/core/ngx_output_chain.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 423a650d3..c4bd67851 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -32,6 +32,7 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
size_t size;
ngx_int_t rc, last;
ngx_uint_t recycled;
+ ngx_buf_t *b;
ngx_chain_t *cl, *out, **last_out;
if (ctx->in == NULL && ctx->busy == NULL) {
@@ -161,13 +162,29 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
}
}
- ctx->buf = ngx_create_temp_buf(ctx->pool, size);
- if (ctx->buf == NULL) {
+ b = ngx_calloc_buf(ctx->pool);
+ if (b == NULL) {
return NGX_ERROR;
}
- ctx->buf->tag = ctx->tag;
- ctx->buf->recycled = recycled;
+ /*
+ * allocate block aligned to a disk sector size
+ * to enable O_DIRECT
+ */
+
+ b->start = ngx_pmemalign(ctx->pool, size, 512);
+ if (b->start == NULL) {
+ return NGX_ERROR;
+ }
+
+ b->pos = b->start;
+ b->last = b->start;
+ b->end = b->last + size;
+ b->temporary = 1;
+ b->tag = ctx->tag;
+ b->recycled = recycled;
+
+ ctx->buf = b;
ctx->allocated++;
}
}