mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-03-14 09:55:12 +08:00
Merge pull request #1156 from trapexit/options
Fix loading readonly / write once options from file
This commit is contained in:
commit
9744eab819
@ -63,10 +63,13 @@ namespace l
|
||||
IFERT("mount");
|
||||
IFERT("nullrw");
|
||||
IFERT("pid");
|
||||
IFERT("pin-threads");
|
||||
IFERT("process-thread-count");
|
||||
IFERT("read-thread-count");
|
||||
IFERT("readdirplus");
|
||||
IFERT("scheduling-priority");
|
||||
IFERT("threads");
|
||||
IFERT("version");
|
||||
IFERT("scheduling-priority");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -118,9 +121,11 @@ Config::Config()
|
||||
symlinkify_timeout(3600),
|
||||
fuse_read_thread_count(-1),
|
||||
fuse_process_thread_count(-1),
|
||||
fuse_pin_threads("false"),
|
||||
version(MERGERFS_VERSION),
|
||||
writeback_cache(false),
|
||||
xattr(XAttr::ENUM::PASSTHROUGH)
|
||||
xattr(XAttr::ENUM::PASSTHROUGH),
|
||||
_initialized(false)
|
||||
{
|
||||
_map["async_read"] = &async_read;
|
||||
_map["auto_cache"] = &auto_cache;
|
||||
@ -176,6 +181,7 @@ Config::Config()
|
||||
_map["nfsopenhack"] = &nfsopenhack;
|
||||
_map["nullrw"] = &nullrw;
|
||||
_map["pid"] = &pid;
|
||||
_map["pin-threads"] = &fuse_pin_threads;
|
||||
_map["posix_acl"] = &posix_acl;
|
||||
_map["readahead"] = &readahead;
|
||||
// _map["readdir"] = &readdir;
|
||||
@ -287,7 +293,7 @@ int
|
||||
Config::set(const std::string &key_,
|
||||
const std::string &value_)
|
||||
{
|
||||
if(l::readonly(key_))
|
||||
if(_initialized && l::readonly(key_))
|
||||
return -EROFS;
|
||||
|
||||
return set_raw(key_,value_);
|
||||
@ -362,6 +368,12 @@ Config::from_file(const std::string &filepath_,
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
Config::finish_initializing()
|
||||
{
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os_,
|
||||
const Config &c_)
|
||||
|
@ -146,11 +146,18 @@ public:
|
||||
ConfigUINT64 symlinkify_timeout;
|
||||
ConfigINT fuse_read_thread_count;
|
||||
ConfigINT fuse_process_thread_count;
|
||||
ConfigSTR fuse_pin_threads;
|
||||
ConfigSTR version;
|
||||
ConfigBOOL writeback_cache;
|
||||
XAttr xattr;
|
||||
|
||||
|
||||
private:
|
||||
bool _initialized;
|
||||
|
||||
public:
|
||||
void finish_initializing();
|
||||
|
||||
public:
|
||||
friend std::ostream& operator<<(std::ostream &s,
|
||||
const Config &c);
|
||||
|
@ -82,6 +82,7 @@ set_fuse_threads(Config::Write &cfg_,
|
||||
{
|
||||
set_kv_option("read-thread-count",cfg_->fuse_read_thread_count.to_string(),args_);
|
||||
set_kv_option("process-thread-count",cfg_->fuse_process_thread_count.to_string(),args_);
|
||||
set_kv_option("pin-threads",cfg_->fuse_pin_threads.to_string(),args_);
|
||||
}
|
||||
|
||||
static
|
||||
@ -135,7 +136,7 @@ should_ignore(const std::string &key_)
|
||||
"splice_move",
|
||||
"splice_read",
|
||||
"splice_write",
|
||||
"use_ino"
|
||||
"use_ino",
|
||||
};
|
||||
|
||||
return (IGNORED_KEYS.find(key_) != IGNORED_KEYS.end());
|
||||
@ -431,5 +432,7 @@ namespace options
|
||||
set_fsname(cfg,args_);
|
||||
set_subtype(args_);
|
||||
set_fuse_threads(cfg,args_);
|
||||
|
||||
cfg->finish_initializing();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user