comparison src/core/ngx_open_file_cache.c @ 544:f7ec98e3caeb NGINX_0_8_18

nginx 0.8.18 *) Feature: the "read_ahead" directive. *) Feature: now several "perl_modules" directive may be used. *) Feature: the "limit_req_log_level" and "limit_conn_log_level" directives. *) Bugfix: now "limit_req" directive conforms to the leaky bucket algorithm. Thanks to Maxim Dounin. *) Bugfix: nginx did not work on Linux/sparc. Thanks to Marcus Ramberg. *) Bugfix: nginx sent '\0' in a "Location" response header line on MKCOL request. Thanks to Xie Zhenye. *) Bugfix: zero status code was logged instead of 499 status code; the bug had appeared in 0.8.11. *) Bugfix: socket leak; the bug had appeared in 0.8.11.
author Igor Sysoev <http://sysoev.ru>
date Tue, 06 Oct 2009 00:00:00 +0400
parents 4c5d2c627a6c
children 566e105a89f1
comparison
equal deleted inserted replaced
543:7688992d2abb 544:f7ec98e3caeb
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) == NGX_FILE_ERROR) { 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