Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-09-30 17:21:52 +0400
committerIgor Sysoev <igor@sysoev.ru>2009-09-30 17:21:52 +0400
commit3266171fd4691d173f698f1c0c246322a94588e2 (patch)
treec6ff4969a31639d546af48a644c5c11b5716b82d /src/core/ngx_open_file_cache.c
parent687b0e99ea4ff631e447fff2d177d0c9297529fc (diff)
read_ahead
Diffstat (limited to 'src/core/ngx_open_file_cache.c')
-rw-r--r--src/core/ngx_open_file_cache.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c
index 5f6e0b263..6aa66fd4e 100644
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -17,6 +17,9 @@
*/
+#define NGX_MIN_READ_AHEAD (128 * 1024)
+
+
static void ngx_open_file_cache_cleanup(void *data);
static ngx_int_t ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of,
ngx_log_t *log);
@@ -524,6 +527,13 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log)
} else {
of->fd = fd;
+ if (of->read_ahead && ngx_file_size(&fi) > NGX_MIN_READ_AHEAD) {
+ if (ngx_read_ahead(fd, of->read_ahead) == NGX_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ ngx_read_ahead_n " \"%s\" failed", name);
+ }
+ }
+
if (of->directio <= ngx_file_size(&fi)) {
if (ngx_directio_on(fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,