Browse Source

[core] perf adjustments to avoid load miss

master
Glenn Strauss 1 year ago
parent
commit
86e5f09062
  1. 7
      src/response.c
  2. 3
      src/stat_cache.h

7
src/response.c

@ -310,6 +310,9 @@ static handler_t http_response_physical_path_check(request_st * const r) {
return HANDLER_FINISHED;
}
if (S_ISREG(sce->st.st_mode)) /*(common case)*/
return HANDLER_GO_ON;
if (S_ISDIR(sce->st.st_mode)) {
if (r->uri.path.ptr[buffer_string_length(&r->uri.path) - 1] != '/') {
/* redirect to .../ */
@ -318,8 +321,8 @@ static handler_t http_response_physical_path_check(request_st * const r) {
return HANDLER_FINISHED;
}
} else if (!S_ISREG(sce->st.st_mode)) {
/* any special handling of non-reg files ?*/
} else {
/* any special handling of other non-reg files ?*/
}
return HANDLER_GO_ON;

3
src/stat_cache.h

@ -50,7 +50,10 @@ void stat_cache_delete_entry(const char *name, uint32_t len);
void stat_cache_delete_dir(const char *name, uint32_t len);
void stat_cache_invalidate_entry(const char *name, uint32_t len);
stat_cache_entry * stat_cache_get_entry(const buffer *name);
__attribute_cold__
int stat_cache_path_contains_symlink(const buffer *name, log_error_st *errh);
int stat_cache_open_rdonly_fstat (const buffer *name, struct stat *st, int symlinks);
void stat_cache_trigger_cleanup(void);

Loading…
Cancel
Save