Skip to content

Commit

Permalink
Stage to master: stat cache negative entries (#428)
Browse files Browse the repository at this point in the history
* Store negative (non-existing) entries in stat cache (#409)
  • Loading branch information
jerryblakley authored Jan 29, 2018
1 parent a848ce6 commit a4d0fba
Show file tree
Hide file tree
Showing 22 changed files with 2,412 additions and 227 deletions.
12 changes: 8 additions & 4 deletions src/bloom-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ static values_t byte_bit_location(unsigned long startvalue, int bits_in_chunk) {
int bloomfilter_add(bloomfilter_options_t *options, const void *key, size_t klen) {
values_t values;

log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT, "bloomfilter_add: enter \'%s\' :: salt %ul", key, options->salt);
log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT, "bloomfilter_add: enter \'%s\' :: salt %lu", key, options->salt);
values.hashvalue = options->hashfcn(options->salt, key, klen);
for (unsigned int idx = 0; idx < options->num_chunks; idx++) {
values = byte_bit_location(values.hashvalue, options->bits_in_chunk);
log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT, "bloomfilter_add: iter %d :: key: \'%s\' :: salt: %ul :: byte %d :: bit %d", idx, key, values.hashvalue, values.bytevalue, values.bitvalue);
log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT,
"bloomfilter_add: iter %d :: key: \'%s\' :: salt: %lu :: byte %d :: bit %d",
idx, key, values.hashvalue, values.bytevalue, values.bitvalue);
options->bitfield[values.bytevalue] |= values.bitvalue;
}
return 0;
Expand All @@ -207,11 +209,13 @@ int bloomfilter_add(bloomfilter_options_t *options, const void *key, size_t klen
bool bloomfilter_exists(bloomfilter_options_t * options, const void *key, size_t klen) {
values_t values;

log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT, "bloomfilter_exists: enter \'%s\' :: salt %ul", key, options->salt);
log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT, "bloomfilter_exists: enter \'%s\' :: salt %lu", key, options->salt);
values.hashvalue = options->hashfcn(options->salt, key, klen);
for (unsigned int idx = 0; idx < options->num_chunks; idx++) {
values = byte_bit_location(values.hashvalue, options->bits_in_chunk);
log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT, "bloomfilter_exists: iter %d :: key: \'%s\' :: salt: %ul :: byte %d :: bit %d", idx, key, values.hashvalue, values.bytevalue, values.bitvalue);
log_print(LOG_DEBUG, SECTION_BLOOM_DEFAULT,
"bloomfilter_exists: iter %d :: key: \'%s\' :: salt: %lu :: byte %d :: bit %d",
idx, key, values.hashvalue, values.bytevalue, values.bitvalue);
if ((options->bitfield[values.bytevalue] & values.bitvalue) == 0) return false;
}
return true;
Expand Down
538 changes: 378 additions & 160 deletions src/fusedav.c

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/props.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static size_t header_callback(void *contents, size_t length, size_t nmemb, __unu
"header_callback: got readonly:'%s'", header);
} else if (strcasestr(header, "readwrite") != NULL) {
clear_readonly_mode();
log_print(LOG_INFO, SECTION_PROPS_DEFAULT,
log_print(LOG_DEBUG, SECTION_PROPS_DEFAULT,
"header_callback: got readwrite:'%s'", header);
} else {
// If we get something other than readonly or readwrite, punt. Default is read-write
Expand All @@ -363,7 +363,7 @@ static size_t header_callback(void *contents, size_t length, size_t nmemb, __unu
}
}

log_print(LOG_INFO, SECTION_PROPS_DEFAULT, "header_callback: '%s' :: %d, %d", header, length, nmemb);
log_print(LOG_DEBUG, SECTION_PROPS_DEFAULT, "header_callback: '%s' :: %d, %d", header, length, nmemb);
free(header);
return length * nmemb;
}
Expand Down Expand Up @@ -441,7 +441,7 @@ int simple_propfind(const char *path, size_t depth, time_t last_updated, props_r
"<D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>");

// Perform the request and parse the response.
log_print(LOG_INFO, SECTION_PROPS_DEFAULT, "%s: About to perform (%s) PROPFIND (%ul).",
log_print(LOG_INFO, SECTION_PROPS_DEFAULT, "%s: About to perform (%s) PROPFIND (%lu).",
funcname, last_updated > 0 ? "progressive" : "complete", last_updated);

timed_curl_easy_perform(session, &res, &response_code, &elapsed_time);
Expand Down
4 changes: 2 additions & 2 deletions src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ static int session_debug(__unused CURL *handle, curl_infotype type, char *data,
// We want to see the "Trying <ip addr> message, but the others only when in some
// level of debug
if (strstr(msg, "Trying")) {
log_print(LOG_INFO, SECTION_SESSION_DEFAULT, "cURL: %s", msg);
log_print(LOG_DEBUG, SECTION_SESSION_DEFAULT, "cURL: %s", msg);
print_ipaddr_pair(msg);
}
else {
log_print(LOG_INFO, SECTION_SESSION_DEFAULT, "cURL: %s", msg);
log_print(LOG_DEBUG, SECTION_SESSION_DEFAULT, "cURL: %s", msg);
}
free(msg);
}
Expand Down
Loading

0 comments on commit a4d0fba

Please sign in to comment.