add policy cache for 'open'

A fusepath -> basepath cache for `open` to limit the overhead of FUSE in 'open, read/write, close' patterns (such as Transmission).
This commit is contained in:
Antonio SJ Musumeci 2019-01-06 12:52:55 -05:00
parent 8e0aa1d9a6
commit 7a057daa0c
44 changed files with 858 additions and 649 deletions

View file

@ -202,6 +202,18 @@ parse_and_process_statfsignore(const std::string &value_,
return 0;
}
static
int
parse_and_process_cache(Config &config_,
const string &func_,
const string &value_)
{
if(func_ == "open")
return parse_and_process(value_,config_.open_cache.timeout);
return 1;
}
static
int
parse_and_process_arg(Config &config,
@ -233,6 +245,8 @@ parse_and_process_kv_arg(Config &config,
rv = config.set_func_policy(keypart[1],value);
else if(keypart[0] == "category")
rv = config.set_category_policy(keypart[1],value);
else if(keypart[0] == "cache")
rv = parse_and_process_cache(config,keypart[1],value);
}
else
{
@ -336,6 +350,8 @@ usage(void)
" splice_write, splice_move\n"
" -o func.<f>=<p> Set function <f> to policy <p>\n"
" -o category.<c>=<p> Set functions in category <c> to <p>\n"
" -o cache.open=<int> 'open' policy cache timeout in seconds.\n"
" default = 0 (disabled)\n"
" -o direct_io Bypass page caching, may increase write\n"
" speeds at the cost of reads. Please read docs\n"
" for more details as there are tradeoffs.\n"