mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Rework config, centralize fuse config (#1547)
This commit is contained in:
parent
00e5467e99
commit
727c522fb8
46 changed files with 1294 additions and 1316 deletions
|
|
@ -46,7 +46,7 @@
|
|||
*/
|
||||
static
|
||||
void
|
||||
_tweak_flags_writeback_cache(int *flags_)
|
||||
_tweak_flags_cache_writeback(int *flags_)
|
||||
{
|
||||
if((*flags_ & O_ACCMODE) == O_WRONLY)
|
||||
*flags_ = ((*flags_ & ~O_ACCMODE) | O_RDWR);
|
||||
|
|
@ -87,11 +87,6 @@ _config_to_ffi_flags(Config &cfg_,
|
|||
{
|
||||
switch(cfg_.cache_files)
|
||||
{
|
||||
case CacheFiles::ENUM::LIBFUSE:
|
||||
ffi_->direct_io = cfg_.direct_io;
|
||||
ffi_->keep_cache = cfg_.kernel_cache;
|
||||
ffi_->auto_cache = cfg_.auto_cache;
|
||||
break;
|
||||
case CacheFiles::ENUM::OFF:
|
||||
ffi_->direct_io = 1;
|
||||
ffi_->keep_cache = 0;
|
||||
|
|
@ -215,8 +210,8 @@ _create(const Policy::Search &searchFunc_,
|
|||
constexpr
|
||||
const
|
||||
uint64_t
|
||||
_(const PassthroughEnum e_,
|
||||
const uint64_t m_)
|
||||
_(const PassthroughIOEnum e_,
|
||||
const uint64_t m_)
|
||||
{
|
||||
return ((((uint64_t)e_) << 32) | (m_ & O_ACCMODE));
|
||||
}
|
||||
|
|
@ -234,8 +229,8 @@ _create_for_insert_lambda(const fuse_req_ctx_t *ctx_,
|
|||
const ugid::Set ugid(ctx_->uid,ctx_->gid);
|
||||
|
||||
::_config_to_ffi_flags(cfg,ctx_->pid,ffi_);
|
||||
if(cfg.writeback_cache)
|
||||
::_tweak_flags_writeback_cache(&ffi_->flags);
|
||||
if(cfg.cache_writeback)
|
||||
::_tweak_flags_cache_writeback(&ffi_->flags);
|
||||
ffi_->noflush = !::_calculate_flush(cfg.flushonclose,
|
||||
ffi_->flags);
|
||||
|
||||
|
|
@ -266,13 +261,13 @@ _create_for_insert_lambda(const fuse_req_ctx_t *ctx_,
|
|||
of_->ref_count = 1;
|
||||
of_->fi = fi;
|
||||
|
||||
switch(_(cfg.passthrough,ffi_->flags))
|
||||
switch(_(cfg.passthrough_io,ffi_->flags))
|
||||
{
|
||||
case _(Passthrough::ENUM::RO,O_RDONLY):
|
||||
case _(Passthrough::ENUM::WO,O_WRONLY):
|
||||
case _(Passthrough::ENUM::RW,O_RDONLY):
|
||||
case _(Passthrough::ENUM::RW,O_WRONLY):
|
||||
case _(Passthrough::ENUM::RW,O_RDWR):
|
||||
case _(PassthroughIO::ENUM::RO,O_RDONLY):
|
||||
case _(PassthroughIO::ENUM::WO,O_WRONLY):
|
||||
case _(PassthroughIO::ENUM::RW,O_RDONLY):
|
||||
case _(PassthroughIO::ENUM::RW,O_WRONLY):
|
||||
case _(PassthroughIO::ENUM::RW,O_RDWR):
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue