add writeback caching

This commit is contained in:
Antonio SJ Musumeci 2020-02-07 14:05:03 -05:00
parent e6c8fa3fad
commit 903d39f968
10 changed files with 103 additions and 17 deletions

View file

@ -35,6 +35,21 @@ typedef Config::CacheFiles CacheFiles;
namespace l
{
static
int
tweak_flags_writeback_cache(const int flags_)
{
int flags;
flags = flags_;
if((flags & O_ACCMODE) == O_WRONLY)
flags = ((flags & ~O_ACCMODE) | O_RDWR);
if(flags & O_APPEND)
flags &= ~O_APPEND;
return flags;
}
static
int
open_core(const string &basepath_,
@ -122,6 +137,9 @@ namespace FUSE
break;
}
if(config.writeback_cache)
ffi_->flags = l::tweak_flags_writeback_cache(ffi_->flags);
return l::open(config.open,
config.open_cache,
config.branches,