allow setting of 'max_pages' (via 'fuse_msg_size')

Linux 4.20 and above allow setting the number of pages per FUSE message
upto 256 (4K * 256 = 1MiB). This can greatly increase read and write
speeds depending on the workload.
This commit is contained in:
Antonio SJ Musumeci 2019-05-30 18:59:18 -04:00
parent 24af276542
commit 7cbd88ac81
14 changed files with 345 additions and 210 deletions

View file

@ -102,6 +102,28 @@ set_default_options(fuse_args *args)
set_option(args,"default_permissions");
}
static
int
parse_and_process(const std::string &value_,
uint16_t &uint16_,
uint16_t min_,
uint16_t max_)
{
int rv;
uint64_t uint64;
rv = num::to_uint64_t(value_,uint64);
if(rv == -1)
return 1;
if((uint64 > max_) || (uint64 < min_))
return 1;
uint16_ = uint64;
return 0;
}
static
int
parse_and_process(const std::string &value_,
@ -345,6 +367,10 @@ parse_and_process_kv_arg(Config &config,
rv = parse_and_process(value,config.auto_cache);
else if(key == "async_read")
rv = parse_and_process(value,config.async_read);
else if(key == "fuse_msg_size")
rv = parse_and_process(value,config.fuse_msg_size,
1,
FUSE_MAX_MAX_PAGES);
}
if(rv == -1)