mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-26 18:06:27 -05:00
config: rework global config, remove rwlock, make branches RCU like
Also added unit tests. Should have done separately but found a number of bugs.
This commit is contained in:
parent
2e4c6c5fd1
commit
538467b86d
327 changed files with 6691 additions and 3036 deletions
|
|
@ -17,7 +17,8 @@
|
|||
#include "config.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
#include <fuse.h>
|
||||
#include "fuse.h"
|
||||
|
||||
|
||||
namespace l
|
||||
{
|
||||
|
|
@ -64,16 +65,16 @@ namespace l
|
|||
static
|
||||
void
|
||||
want_if_capable_max_pages(fuse_conn_info *conn_,
|
||||
Config &c_)
|
||||
Config::Write &cfg_)
|
||||
{
|
||||
if(l::capable(conn_,FUSE_CAP_MAX_PAGES))
|
||||
{
|
||||
l::want(conn_,FUSE_CAP_MAX_PAGES);
|
||||
conn_->max_pages = c_.fuse_msg_size;
|
||||
conn_->max_pages = cfg_->fuse_msg_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
c_.fuse_msg_size = FUSE_DEFAULT_MAX_PAGES_PER_REQ;
|
||||
cfg_->fuse_msg_size = FUSE_DEFAULT_MAX_PAGES_PER_REQ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -83,24 +84,24 @@ namespace FUSE
|
|||
void *
|
||||
init(fuse_conn_info *conn_)
|
||||
{
|
||||
Config &config = Config::rw();
|
||||
Config::Write cfg;
|
||||
|
||||
ugid::init();
|
||||
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_DIO);
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ,&config.async_read);
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ,&cfg->async_read);
|
||||
l::want_if_capable(conn_,FUSE_CAP_ATOMIC_O_TRUNC);
|
||||
l::want_if_capable(conn_,FUSE_CAP_BIG_WRITES);
|
||||
l::want_if_capable(conn_,FUSE_CAP_CACHE_SYMLINKS,&config.cache_symlinks);
|
||||
l::want_if_capable(conn_,FUSE_CAP_CACHE_SYMLINKS,&cfg->cache_symlinks);
|
||||
l::want_if_capable(conn_,FUSE_CAP_DONT_MASK);
|
||||
l::want_if_capable(conn_,FUSE_CAP_IOCTL_DIR);
|
||||
l::want_if_capable(conn_,FUSE_CAP_PARALLEL_DIROPS);
|
||||
l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS,&config.readdirplus);
|
||||
l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS,&cfg->readdirplus);
|
||||
//l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS_AUTO);
|
||||
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL,&config.posix_acl);
|
||||
l::want_if_capable(conn_,FUSE_CAP_WRITEBACK_CACHE,&config.writeback_cache);
|
||||
l::want_if_capable_max_pages(conn_,config);
|
||||
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL,&cfg->posix_acl);
|
||||
l::want_if_capable(conn_,FUSE_CAP_WRITEBACK_CACHE,&cfg->writeback_cache);
|
||||
l::want_if_capable_max_pages(conn_,cfg);
|
||||
|
||||
return &config;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue