mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
symlinkify: file -> symlink-to-original-file after timeout
This commit is contained in:
parent
25ce9938c6
commit
6a7675f2bf
13 changed files with 290 additions and 47 deletions
|
|
@ -106,8 +106,8 @@ set_default_options(fuse_args &args)
|
|||
|
||||
static
|
||||
int
|
||||
parse_and_process_minfreespace(const std::string &value,
|
||||
uint64_t &minfreespace)
|
||||
parse_and_process(const std::string &value,
|
||||
uint64_t &minfreespace)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
|
@ -120,8 +120,22 @@ parse_and_process_minfreespace(const std::string &value,
|
|||
|
||||
static
|
||||
int
|
||||
parse_and_process_boolean(const std::string &value,
|
||||
bool &boolean)
|
||||
parse_and_process(const std::string &value,
|
||||
time_t &time)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = num::to_time_t(value,time);
|
||||
if(rv == -1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
parse_and_process(const std::string &value,
|
||||
bool &boolean)
|
||||
{
|
||||
if(value == "false")
|
||||
boolean = false;
|
||||
|
|
@ -167,11 +181,15 @@ parse_and_process_kv_arg(Config &config,
|
|||
else
|
||||
{
|
||||
if(key == "minfreespace")
|
||||
rv = parse_and_process_minfreespace(value,config.minfreespace);
|
||||
rv = parse_and_process(value,config.minfreespace);
|
||||
else if(key == "moveonenospc")
|
||||
rv = parse_and_process_boolean(value,config.moveonenospc);
|
||||
rv = parse_and_process(value,config.moveonenospc);
|
||||
else if(key == "dropcacheonclose")
|
||||
rv = parse_and_process_boolean(value,config.dropcacheonclose);
|
||||
rv = parse_and_process(value,config.dropcacheonclose);
|
||||
else if(key == "symlinkify")
|
||||
rv = parse_and_process(value,config.symlinkify);
|
||||
else if(key == "symlinkify_timeout")
|
||||
rv = parse_and_process(value,config.symlinkify_timeout);
|
||||
}
|
||||
|
||||
if(rv == -1)
|
||||
|
|
@ -261,12 +279,18 @@ usage(void)
|
|||
" 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"
|
||||
" -o moveonenospc=<bool> Try to move file to another drive when ENOSPC\n"
|
||||
" on write. default=false\n"
|
||||
" -o dropcacheonclose=<bool>\n"
|
||||
" when a file is closed suggest to OS it drop\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"
|
||||
" -o symlinkify=<bool> Read-only files, after a timeout, will be turned\n"
|
||||
" into symlinks. Read docs for limitations and\n"
|
||||
" possible issues. default=false\n"
|
||||
" -o symlinkify_timeout=<int>\n"
|
||||
" timeout in seconds before will turn to symlinks.\n"
|
||||
" default=3600\n"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue