Mercurial > hg > nginx-ranges
comparison src/core/ngx_open_file_cache.c @ 578:f3a9e57d2e17
Merge with current.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 11 Mar 2010 21:27:17 +0300 |
parents | f7ec98e3caeb |
children | 566e105a89f1 |
comparison
equal
deleted
inserted
replaced
539:5f4de8cf0d9d | 578:f3a9e57d2e17 |
---|---|
13 * open file cache caches | 13 * open file cache caches |
14 * open file handles with stat() info; | 14 * open file handles with stat() info; |
15 * directories stat() info; | 15 * directories stat() info; |
16 * files and directories errors: not found, access denied, etc. | 16 * files and directories errors: not found, access denied, etc. |
17 */ | 17 */ |
18 | |
19 | |
20 #define NGX_MIN_READ_AHEAD (128 * 1024) | |
18 | 21 |
19 | 22 |
20 static void ngx_open_file_cache_cleanup(void *data); | 23 static void ngx_open_file_cache_cleanup(void *data); |
21 static ngx_int_t ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, | 24 static ngx_int_t ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, |
22 ngx_log_t *log); | 25 ngx_log_t *log); |
522 of->fd = NGX_INVALID_FILE; | 525 of->fd = NGX_INVALID_FILE; |
523 | 526 |
524 } else { | 527 } else { |
525 of->fd = fd; | 528 of->fd = fd; |
526 | 529 |
530 if (of->read_ahead && ngx_file_size(&fi) > NGX_MIN_READ_AHEAD) { | |
531 if (ngx_read_ahead(fd, of->read_ahead) == NGX_ERROR) { | |
532 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, | |
533 ngx_read_ahead_n " \"%s\" failed", name); | |
534 } | |
535 } | |
536 | |
527 if (of->directio <= ngx_file_size(&fi)) { | 537 if (of->directio <= ngx_file_size(&fi)) { |
528 if (ngx_directio_on(fd) == -1) { | 538 if (ngx_directio_on(fd) == NGX_FILE_ERROR) { |
529 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, | 539 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, |
530 ngx_directio_on_n " \"%s\" failed", name); | 540 ngx_directio_on_n " \"%s\" failed", name); |
531 | 541 |
532 } else { | 542 } else { |
533 of->is_directio = 1; | 543 of->is_directio = 1; |