Browse Source

Allow setting of scheduling priority

pull/1125/head
Antonio SJ Musumeci 2 years ago
parent
commit
a7113bb163
  1. 5
      README.md
  2. 3
      src/config.cpp
  3. 2
      src/config.hpp
  4. 8
      src/mergerfs.cpp

5
README.md

@ -1,6 +1,6 @@
% mergerfs(1) mergerfs user manual % mergerfs(1) mergerfs user manual
% Antonio SJ Musumeci <trapexit@spawn.link> % Antonio SJ Musumeci <trapexit@spawn.link>
% 2023-01-24
% 2023-01-25
# NAME # NAME
@ -203,6 +203,9 @@ These options are the same regardless of whether you use them with the `mergerfs
`read-thread-count` refers to the number of threads reading FUSE `read-thread-count` refers to the number of threads reading FUSE
messages which are dispatched to process threads. -1 means disabled messages which are dispatched to process threads. -1 means disabled
otherwise acts like `read-thread-count`. (default: -1) otherwise acts like `read-thread-count`. (default: -1)
* **scheduling-priority=INT**: Set mergerfs' scheduling
priority. Valid values range from -20 to 19. See `setpriority` man
page for more details. (default: -10)
* **fsname=STR**: Sets the name of the filesystem as seen in * **fsname=STR**: Sets the name of the filesystem as seen in
**mount**, **df**, etc. Defaults to a list of the source paths **mount**, **df**, etc. Defaults to a list of the source paths
concatenated together with the longest common prefix removed. concatenated together with the longest common prefix removed.

3
src/config.cpp

@ -64,6 +64,7 @@ namespace l
IFERT("readdirplus"); IFERT("readdirplus");
IFERT("threads"); IFERT("threads");
IFERT("version"); IFERT("version");
IFERT("scheduling-priority");
return false; return false;
} }
@ -103,6 +104,7 @@ Config::Config()
readdir(ReadDir::ENUM::POSIX), readdir(ReadDir::ENUM::POSIX),
readdirplus(false), readdirplus(false),
rename_exdev(RenameEXDEV::ENUM::PASSTHROUGH), rename_exdev(RenameEXDEV::ENUM::PASSTHROUGH),
scheduling_priority(-10),
security_capability(true), security_capability(true),
srcmounts(branches), srcmounts(branches),
statfs(StatFS::ENUM::BASE), statfs(StatFS::ENUM::BASE),
@ -171,6 +173,7 @@ Config::Config()
// _map["readdir"] = &readdir; // _map["readdir"] = &readdir;
_map["readdirplus"] = &readdirplus; _map["readdirplus"] = &readdirplus;
_map["rename-exdev"] = &rename_exdev; _map["rename-exdev"] = &rename_exdev;
_map["scheduling-priority"] = &scheduling_priority;
_map["security_capability"] = &security_capability; _map["security_capability"] = &security_capability;
_map["srcmounts"] = &srcmounts; _map["srcmounts"] = &srcmounts;
_map["statfs"] = &statfs; _map["statfs"] = &statfs;

2
src/config.hpp

@ -133,6 +133,7 @@ public:
ReadDir readdir; ReadDir readdir;
ConfigBOOL readdirplus; ConfigBOOL readdirplus;
RenameEXDEV rename_exdev; RenameEXDEV rename_exdev;
ConfigINT scheduling_priority;
ConfigBOOL security_capability; ConfigBOOL security_capability;
SrcMounts srcmounts; SrcMounts srcmounts;
StatFS statfs; StatFS statfs;
@ -145,6 +146,7 @@ public:
ConfigBOOL writeback_cache; ConfigBOOL writeback_cache;
XAttr xattr; XAttr xattr;
public: public:
friend std::ostream& operator<<(std::ostream &s, friend std::ostream& operator<<(std::ostream &s,
const Config &c); const Config &c);

8
src/mergerfs.cpp

@ -139,15 +139,13 @@ namespace l
static static
void void
setup_resources(void)
setup_resources(const int scheduling_priority_)
{ {
const int prio = -10;
std::srand(time(NULL)); std::srand(time(NULL));
resources::reset_umask(); resources::reset_umask();
resources::maxout_rlimit_nofile(); resources::maxout_rlimit_nofile();
resources::maxout_rlimit_fsize(); resources::maxout_rlimit_fsize();
resources::setpriority(prio);
resources::setpriority(scheduling_priority_);
} }
static static
@ -204,7 +202,7 @@ namespace l
if(cfg->branches_mount_timeout > 0) if(cfg->branches_mount_timeout > 0)
l::wait_for_mount(cfg); l::wait_for_mount(cfg);
l::setup_resources();
l::setup_resources(cfg->scheduling_priority);
l::get_fuse_operations(ops,cfg->nullrw); l::get_fuse_operations(ops,cfg->nullrw);
return fuse_main(args.argc, return fuse_main(args.argc,

Loading…
Cancel
Save