mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
make dropcacheonclose runtime configurable
This commit is contained in:
parent
23dbe48324
commit
8ba3a08f40
3 changed files with 34 additions and 28 deletions
|
|
@ -126,11 +126,11 @@ _split_attrval(const string &attrval,
|
|||
|
||||
static
|
||||
int
|
||||
_setxattr_srcmounts(vector<string> &srcmounts,
|
||||
_setxattr_srcmounts(const string &attrval,
|
||||
const int flags,
|
||||
vector<string> &srcmounts,
|
||||
pthread_rwlock_t &srcmountslock,
|
||||
const string &destmount,
|
||||
const string &attrval,
|
||||
const int flags)
|
||||
const string &destmount)
|
||||
{
|
||||
string instruction;
|
||||
string values;
|
||||
|
|
@ -162,16 +162,16 @@ _setxattr_srcmounts(vector<string> &srcmounts,
|
|||
|
||||
static
|
||||
int
|
||||
_setxattr_minfreespace(Config &config,
|
||||
const string &attrval,
|
||||
const int flags)
|
||||
_setxattr_uint64_t(const string &attrval,
|
||||
const int flags,
|
||||
uint64_t &uint)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if((flags & XATTR_CREATE) == XATTR_CREATE)
|
||||
return -EEXIST;
|
||||
|
||||
rv = num::to_uint64_t(attrval,config.minfreespace);
|
||||
rv = num::to_uint64_t(attrval,uint);
|
||||
if(rv == -1)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -180,24 +180,23 @@ _setxattr_minfreespace(Config &config,
|
|||
|
||||
static
|
||||
int
|
||||
_setxattr_moveonenospc(Config &config,
|
||||
const string &attrval,
|
||||
const int flags)
|
||||
_setxattr_bool(const string &attrval,
|
||||
const int flags,
|
||||
bool &value)
|
||||
{
|
||||
if((flags & XATTR_CREATE) == XATTR_CREATE)
|
||||
return -EEXIST;
|
||||
|
||||
if(attrval == "false")
|
||||
config.moveonenospc = false;
|
||||
value = false;
|
||||
else if(attrval == "true")
|
||||
config.moveonenospc = true;
|
||||
value = true;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int
|
||||
_setxattr_controlfile_func_policy(Config &config,
|
||||
|
|
@ -251,19 +250,23 @@ _setxattr_controlfile(Config &config,
|
|||
{
|
||||
case 3:
|
||||
if(attr[2] == "srcmounts")
|
||||
return _setxattr_srcmounts(config.srcmounts,
|
||||
return _setxattr_srcmounts(attrval,
|
||||
flags,
|
||||
config.srcmounts,
|
||||
config.srcmountslock,
|
||||
config.destmount,
|
||||
attrval,
|
||||
flags);
|
||||
config.destmount);
|
||||
else if(attr[2] == "minfreespace")
|
||||
return _setxattr_minfreespace(config,
|
||||
attrval,
|
||||
flags);
|
||||
return _setxattr_uint64_t(attrval,
|
||||
flags,
|
||||
config.minfreespace);
|
||||
else if(attr[2] == "moveonenospc")
|
||||
return _setxattr_moveonenospc(config,
|
||||
attrval,
|
||||
flags);
|
||||
return _setxattr_bool(attrval,
|
||||
flags,
|
||||
config.moveonenospc);
|
||||
else if(attr[2] == "dropcacheonclose")
|
||||
return _setxattr_bool(attrval,
|
||||
flags,
|
||||
config.dropcacheonclose);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue