mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Add flushonclose feature
This commit is contained in:
parent
7d6c8e9333
commit
6aa6452d3e
11 changed files with 196 additions and 3 deletions
|
|
@ -114,6 +114,24 @@ namespace l
|
|||
*flags_ &= ~O_APPEND;
|
||||
}
|
||||
|
||||
static
|
||||
bool
|
||||
calculate_flush(FlushOnClose const flushonclose_,
|
||||
int const flags_)
|
||||
{
|
||||
switch(flushonclose_)
|
||||
{
|
||||
case FlushOnCloseEnum::NEVER:
|
||||
return false;
|
||||
case FlushOnCloseEnum::OPENED_FOR_WRITE:
|
||||
return !l::rdonly(flags_);
|
||||
case FlushOnCloseEnum::ALWAYS:
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
config_to_ffi_flags(Config::Read &cfg_,
|
||||
|
|
@ -236,6 +254,9 @@ namespace FUSE
|
|||
if(cfg->writeback_cache)
|
||||
l::tweak_flags_writeback_cache(&ffi_->flags);
|
||||
|
||||
ffi_->noflush = !l::calculate_flush(cfg->flushonclose,
|
||||
ffi_->flags);
|
||||
|
||||
rv = l::open(cfg->func.open.policy,
|
||||
cfg->branches,
|
||||
fusepath_,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue