add option to drop file caches before closing files

This commit is contained in:
Antonio SJ Musumeci 2017-02-18 13:45:43 -05:00
parent 3a89491507
commit 6aa62d03ff
4 changed files with 42 additions and 19 deletions

View file

@ -120,13 +120,13 @@ parse_and_process_minfreespace(const std::string &value,
static
int
parse_and_process_moveonenospc(const std::string &value,
bool &moveonenospc)
parse_and_process_boolean(const std::string &value,
bool &boolean)
{
if(value == "false")
moveonenospc = false;
boolean = false;
else if(value == "true")
moveonenospc = true;
boolean = true;
else
return 1;
@ -169,7 +169,9 @@ parse_and_process_kv_arg(Config &config,
if(key == "minfreespace")
rv = parse_and_process_minfreespace(value,config.minfreespace);
else if(key == "moveonenospc")
rv = parse_and_process_moveonenospc(value,config.moveonenospc);
rv = parse_and_process_boolean(value,config.moveonenospc);
else if(key == "dropcacheonclose")
rv = parse_and_process_boolean(value,config.dropcacheonclose);
}
if(rv == -1)
@ -246,20 +248,25 @@ usage(void)
"mergerfs options:\n"
" <srcpaths> ':' delimited list of directories. Supports\n"
" shell globbing (must be escaped in shell)\n"
" -o defaults default FUSE options which seem to provide the\n"
" -o defaults Default FUSE options which seem to provide the\n"
" best performance: atomic_o_trunc, auto_cache,\n"
" big_writes, default_permissions, splice_read,\n"
" splice_write, splice_move\n"
" -o direct_io bypass additional caching, increases write\n"
" speeds at the cost of reads\n"
" -o use_ino mergerfs will generate inode values rather than\n"
" autogenerated by libfuse\n"
" -o minfreespace=<int> minimum free space needed for certain policies:\n"
" default 4G\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 direct_io Bypass additional caching, increases write\n"
" speeds at the cost of reads. Please read docs\n"
" for more details as there are tradeoffs.\n"
" -o use_ino Have mergerfs generate inode values rather than\n"
" autogenerated by libfuse. Suggested.\n"
" -o minfreespace=<int> minimum free space needed for certain policies.\n"
" default=4G\n"
" -o moveonenospc=<bool> try to move file to another drive when ENOSPC\n"
" on write: default false\n"
" -o func.<f>=<p> set function <f> to policy <p>\n"
" -o category.<c>=<p> set functions in category <c> to <p>\n"
" on write. default=false\n"
" -o dropcacheonclose=<bool>\n"
" when a file is closed suggest to OS it drop\n"
" the file's cache. This is useful when direct_io\n"
" is disabled. default=false\n"
<< std::endl;
}
@ -267,7 +274,8 @@ static
void
version(void)
{
std::cout << "mergerfs version: " << MERGERFS_VERSION
std::cout << "mergerfs version: "
<< MERGERFS_VERSION
<< std::endl;
}