mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-27 14:18:54 +08:00
checkpoint
This commit is contained in:
parent
8f6467a11c
commit
8e1d4c5a8e
@ -62,6 +62,10 @@ exdev = 'passthrough'
|
||||
policy = 'base'
|
||||
ignore = 'none'
|
||||
|
||||
[func.readdir]
|
||||
policy = 'posix'
|
||||
readdirplus = false
|
||||
|
||||
[cache]
|
||||
files = 'off'
|
||||
statfs = 0
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace l
|
||||
{
|
||||
@ -41,40 +43,24 @@ namespace l
|
||||
static
|
||||
void
|
||||
want_if_capable(fuse_conn_info *conn_,
|
||||
const int flag_)
|
||||
const int flag_,
|
||||
const char *str_)
|
||||
{
|
||||
if(capable(conn_,flag_))
|
||||
want(conn_,flag_);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
want_if_capable(fuse_conn_info *conn_,
|
||||
const int flag_,
|
||||
bool *want_)
|
||||
{
|
||||
if(*want_ && l::capable(conn_,flag_))
|
||||
{
|
||||
l::want(conn_,flag_);
|
||||
return;
|
||||
}
|
||||
|
||||
*want_ = false;
|
||||
else
|
||||
fprintf(stderr,"mergerfs: warning - want to enable %s but not available\n",str_);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
want_if_capable_max_pages(fuse_conn_info *conn_,
|
||||
State &s_)
|
||||
uint64_t max_pages_)
|
||||
{
|
||||
if(l::capable(conn_,FUSE_CAP_MAX_PAGES))
|
||||
{
|
||||
l::want(conn_,FUSE_CAP_MAX_PAGES);
|
||||
conn_->max_pages = s_->fuse_msg_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_->fuse_msg_size = FUSE_DEFAULT_MAX_PAGES_PER_REQ;
|
||||
conn_->max_pages = max_pages_;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,28 +76,35 @@ namespace FUSE::INIT
|
||||
bool wb_cache;
|
||||
bool readdirplus;
|
||||
bool cache_symlinks;
|
||||
uint64_t max_pages;
|
||||
|
||||
async_read = toml::find_or(s->toml,"fuse","async-read",true);
|
||||
posix_acl = toml::find_or(s->toml,"fuse","posix-acl",false);
|
||||
wb_cache = toml::find_or(s->toml,"cache","writeback",false);
|
||||
readdirplus = toml::find_or(s->toml,"func","readdir","readdirplus",false);
|
||||
cache_symlinks = toml::find_or(s->toml,"cache","symlinks",false);
|
||||
max_pages = toml::find_or(s->toml,"fuse","message-size",256);
|
||||
|
||||
async_read = toml::find_or(s->config_toml,"fuse","async-read",true);
|
||||
posix_acl = toml::find_or(s->config_toml,"fuse","posix-acl",false);
|
||||
wb_cache = toml::find_or(s->config_toml,"cache","writeback",false);
|
||||
readdirplus = toml::find_or(s->config_toml,"func","readdir","readdirplus",false);
|
||||
cache_symlinks = toml::find_or(s->config_toml,"cache","symlinks",false);
|
||||
|
||||
ugid::init();
|
||||
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_DIO);
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ,&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,&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,&readdirplus);
|
||||
//l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS_AUTO);
|
||||
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL,&posix_acl);
|
||||
l::want_if_capable(conn_,FUSE_CAP_WRITEBACK_CACHE,&wb_cache);
|
||||
l::want_if_capable_max_pages(conn_,s);
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_DIO,"ASYNC_DIO");
|
||||
l::want_if_capable(conn_,FUSE_CAP_ATOMIC_O_TRUNC,"ATOMIC_O_TRUNC");
|
||||
l::want_if_capable(conn_,FUSE_CAP_BIG_WRITES,"BIG_WRITES");
|
||||
l::want_if_capable(conn_,FUSE_CAP_DONT_MASK,"DONT_MASK");
|
||||
l::want_if_capable(conn_,FUSE_CAP_IOCTL_DIR,"IOCTL_DIR");
|
||||
l::want_if_capable(conn_,FUSE_CAP_PARALLEL_DIROPS,"PARALLEL_DIROPS");
|
||||
l::want_if_capable_max_pages(conn_,max_pages);
|
||||
//l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS_AUTO,"READIR_PLUS_AUTO");
|
||||
if(async_read)
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ,"ASYNC_READ");
|
||||
if(cache_symlinks)
|
||||
l::want_if_capable(conn_,FUSE_CAP_CACHE_SYMLINKS,"CACHE_SYMLINKS");
|
||||
if(readdirplus)
|
||||
l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS,"READDIR_PLUS");
|
||||
if(posix_acl)
|
||||
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL,"POSIX_ACL");
|
||||
if(wb_cache)
|
||||
l::want_if_capable(conn_,FUSE_CAP_WRITEBACK_CACHE,"WRITEBACK_CACHE");
|
||||
conn_->want &= ~FUSE_CAP_POSIX_LOCKS;
|
||||
conn_->want &= ~FUSE_CAP_FLOCK_LOCKS;
|
||||
|
||||
|
@ -159,9 +159,13 @@ namespace l
|
||||
|
||||
memset(&ops,0,sizeof(fuse_operations));
|
||||
|
||||
args.argc = argc_;
|
||||
args.argv = argv_;
|
||||
args.allocated = 0;
|
||||
args.argc = 0;
|
||||
args.argv = NULL;
|
||||
args.allocated = 1;
|
||||
|
||||
for(int i = 0; i < argc_; i++)
|
||||
fuse_opt_add_arg(&args,argv_[i]);
|
||||
fuse_opt_add_arg(&args,"/tmp/test");
|
||||
|
||||
l::setup_resources();
|
||||
l::get_fuse_operations(ops);
|
||||
|
@ -26,6 +26,7 @@ StateBase::Ptr g_STATE;
|
||||
|
||||
StateBase::StateBase(const toml::value &toml_)
|
||||
:
|
||||
toml(toml_),
|
||||
branches(toml_),
|
||||
access(toml_),
|
||||
chmod(toml_),
|
||||
|
@ -67,6 +67,9 @@ public:
|
||||
public:
|
||||
StateBase(const toml::value &);
|
||||
|
||||
public:
|
||||
const toml::value toml;
|
||||
|
||||
public:
|
||||
uint64_t fuse_msg_size;
|
||||
|
||||
@ -130,9 +133,6 @@ public:
|
||||
FUSE::UNLINK::Policy unlink;
|
||||
FUSE::UTIMENS::Policy utimens;
|
||||
FUSE::WRITE::Policy write;
|
||||
|
||||
public:
|
||||
const toml::value config_toml;
|
||||
};
|
||||
|
||||
class State
|
||||
|
Loading…
x
Reference in New Issue
Block a user