remove defaults, hard code atomic_o_trunc, big_writes, and default_permissions

`defaults` is a value used by all filesystems and isn't passed through to
mergerfs when mounting via the fstab or the mount command. This led
to inconsistent application of options. atomic_o_trunc, big_writes, and
default_permissions should be enabled all the time anyway and splice_*
can lead to issues so they are not always enabled.
This commit is contained in:
Antonio SJ Musumeci 2019-01-30 21:58:48 -05:00
parent 21d690a210
commit c5b2415daf
5 changed files with 35 additions and 58 deletions

View file

@ -28,10 +28,11 @@ namespace mergerfs
{
ugid::init();
conn->want |= FUSE_CAP_ASYNC_READ;
conn->want |= FUSE_CAP_ATOMIC_O_TRUNC;
conn->want |= FUSE_CAP_BIG_WRITES;
conn->want |= FUSE_CAP_DONT_MASK;
#ifdef FUSE_CAP_IOCTL_DIR
conn->want |= FUSE_CAP_IOCTL_DIR;
#endif
return &Config::get_writable();
}

View file

@ -62,7 +62,6 @@ namespace local
return local::ioctl(fi->fd,cmd_,data_);
}
#ifdef FUSE_IOCTL_DIR
#ifndef O_NOATIME
#define O_NOATIME 0
@ -119,7 +118,6 @@ namespace local
cmd_,
data_);
}
#endif
}
namespace mergerfs
@ -134,10 +132,8 @@ namespace mergerfs
unsigned int flags_,
void *data_)
{
#ifdef FUSE_IOCTL_DIR
if(flags_ & FUSE_IOCTL_DIR)
return local::ioctl_dir(ffi_,cmd_,data_);
#endif
return local::ioctl_file(ffi_,cmd_,data_);
}

View file

@ -52,11 +52,9 @@ void
set_option(fuse_args &args,
const std::string &option_)
{
string option;
option = "-o" + option_;
fuse_opt_insert_arg(&args,1,option.c_str());
fuse_opt_add_arg(&args,"-o");
fuse_opt_add_arg(&args,option_.c_str());
}
static
@ -103,12 +101,8 @@ void
set_default_options(fuse_args &args)
{
set_option(args,"atomic_o_trunc");
set_option(args,"auto_cache");
set_option(args,"big_writes");
set_option(args,"default_permissions");
set_option(args,"splice_move");
set_option(args,"splice_read");
set_option(args,"splice_write");
}
static
@ -240,7 +234,7 @@ parse_and_process_arg(Config &config,
fuse_args *outargs)
{
if(arg == "defaults")
return (set_default_options(*outargs),0);
return 0;
else if(arg == "direct_io")
return (config.direct_io=true,0);
@ -363,10 +357,6 @@ usage(void)
"mergerfs options:\n"
" <srcpaths> ':' delimited list of directories. Supports\n"
" shell globbing (must be escaped in shell)\n"
" -o defaults Default FUSE options which seem to provide the\n"
" best performance: atomic_o_trunc, auto_cache,\n"
" big_writes, default_permissions, splice_read,\n"
" splice_write, splice_move\n"
" -o func.<f>=<p> Set function <f> to policy <p>\n"
" -o category.<c>=<p> Set functions in category <c> to <p>\n"
" -o cache.open=<int> 'open' policy cache timeout in seconds.\n"
@ -488,6 +478,7 @@ namespace mergerfs
opts,
::option_processor);
set_default_options(args);
set_fsname(args,config.branches);
set_subtype(args);
}