mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Revert removal of readdir init setup, simplify cfg usage (#1520)
This commit is contained in:
parent
99c28ad3bc
commit
f64ff9ca1e
42 changed files with 388 additions and 426 deletions
|
|
@ -79,16 +79,16 @@ _calculate_flush(FlushOnClose const flushonclose_,
|
|||
|
||||
static
|
||||
void
|
||||
_config_to_ffi_flags(Config::Read &cfg_,
|
||||
_config_to_ffi_flags(Config &cfg_,
|
||||
const int tid_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
switch(cfg_->cache_files)
|
||||
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;
|
||||
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;
|
||||
|
|
@ -114,7 +114,7 @@ _config_to_ffi_flags(Config::Read &cfg_,
|
|||
std::string proc_name;
|
||||
|
||||
proc_name = procfs::get_name(tid_);
|
||||
if(cfg_->cache_files_process_names.count(proc_name) == 0)
|
||||
if(cfg_.cache_files_process_names.count(proc_name) == 0)
|
||||
{
|
||||
ffi_->direct_io = 1;
|
||||
ffi_->keep_cache = 0;
|
||||
|
|
@ -129,7 +129,7 @@ _config_to_ffi_flags(Config::Read &cfg_,
|
|||
break;
|
||||
}
|
||||
|
||||
if(cfg_->parallel_direct_writes == true)
|
||||
if(cfg_.parallel_direct_writes == true)
|
||||
ffi_->parallel_direct_writes = ffi_->direct_io;
|
||||
}
|
||||
|
||||
|
|
@ -229,28 +229,27 @@ _create_for_insert_lambda(const fuse_context *fc_,
|
|||
{
|
||||
int rv;
|
||||
FileInfo *fi;
|
||||
Config::Read cfg;
|
||||
const ugid::Set ugid(fc_->uid,fc_->gid);
|
||||
|
||||
::_config_to_ffi_flags(cfg,fc_->pid,ffi_);
|
||||
if(cfg->writeback_cache)
|
||||
if(cfg.writeback_cache)
|
||||
::_tweak_flags_writeback_cache(&ffi_->flags);
|
||||
ffi_->noflush = !::_calculate_flush(cfg->flushonclose,
|
||||
ffi_->noflush = !::_calculate_flush(cfg.flushonclose,
|
||||
ffi_->flags);
|
||||
|
||||
rv = ::_create(cfg->func.getattr.policy,
|
||||
cfg->func.create.policy,
|
||||
cfg->branches,
|
||||
rv = ::_create(cfg.func.getattr.policy,
|
||||
cfg.func.create.policy,
|
||||
cfg.branches,
|
||||
fusepath_,
|
||||
ffi_,
|
||||
mode_,
|
||||
fc_->umask);
|
||||
if(rv == -EROFS)
|
||||
{
|
||||
Config::Write()->branches.find_and_set_mode_ro();
|
||||
rv = ::_create(cfg->func.getattr.policy,
|
||||
cfg->func.create.policy,
|
||||
cfg->branches,
|
||||
cfg.branches.find_and_set_mode_ro();
|
||||
rv = ::_create(cfg.func.getattr.policy,
|
||||
cfg.func.create.policy,
|
||||
cfg.branches,
|
||||
fusepath_,
|
||||
ffi_,
|
||||
mode_,
|
||||
|
|
@ -265,7 +264,7 @@ _create_for_insert_lambda(const fuse_context *fc_,
|
|||
of_->ref_count = 1;
|
||||
of_->fi = fi;
|
||||
|
||||
switch(_(cfg->passthrough,ffi_->flags))
|
||||
switch(_(cfg.passthrough,ffi_->flags))
|
||||
{
|
||||
case _(Passthrough::ENUM::RO,O_RDONLY):
|
||||
case _(Passthrough::ENUM::WO,O_WRONLY):
|
||||
|
|
@ -359,7 +358,6 @@ namespace FUSE
|
|||
mode_t mode_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
Config::Read cfg;
|
||||
const fuse_context *fc = fuse_get_context();
|
||||
|
||||
return ::_create(fc,fusepath_,mode_,ffi_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue