mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 02:48:59 -04:00
After handling a request, a sync read thread polls its /dev/fuse fd for up to fuse-read-spin-us microseconds before blocking in read(). Default 0 (disabled). Measured at 50us (tmpfs branch, direct_io): sequential 128K/1M reads +27-32%, 128K writes +14%, metadata walks +24-32%; no change on 8 parallel streams or 1M writes. Costs roughly one core on a busy-but-quiet mount, nothing when idle.
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "base_types.h"
|
|
|
|
#include <climits>
|
|
#include <cstdio>
|
|
#include <memory>
|
|
#include <shared_mutex>
|
|
#include <string>
|
|
|
|
#define FUSE_CFG_INVALID_ID -1
|
|
#define FUSE_CFG_INVALID_UMASK -1
|
|
|
|
|
|
struct fuse_cfg_t
|
|
{
|
|
template<typename T>
|
|
using sp = std::shared_ptr<T>;
|
|
|
|
s64 uid = FUSE_CFG_INVALID_ID;
|
|
bool valid_uid() const;
|
|
|
|
s64 gid = FUSE_CFG_INVALID_ID;
|
|
bool valid_gid() const;
|
|
|
|
s64 umask = FUSE_CFG_INVALID_UMASK;
|
|
bool valid_umask() const;
|
|
|
|
bool remember_nodes = false;
|
|
|
|
bool debug = false;
|
|
std::shared_ptr<FILE> log_file() const;
|
|
void log_file(std::shared_ptr<FILE>);
|
|
std::shared_ptr<std::string> log_filepath() const;
|
|
void log_filepath(const std::string &);
|
|
private:
|
|
mutable std::shared_mutex _log_mutex;
|
|
std::shared_ptr<FILE> _log_file = sp<FILE>(stderr,[](FILE*){});
|
|
std::shared_ptr<std::string> _log_filepath = sp<std::string>();
|
|
|
|
public:
|
|
int max_background = 0;
|
|
int congestion_threshold = 0;
|
|
u32 max_pages = 32;
|
|
int passthrough_max_stack_depth = 1;
|
|
|
|
int read_thread_count = 0;
|
|
int process_thread_count = -1;
|
|
int process_thread_queue_depth = 2;
|
|
// After each request a sync FUSE reader polls /dev/fuse for up to this many
|
|
// microseconds before blocking in read(). Trades CPU while the mount is
|
|
// busy for lower per-request latency on synchronous request streams.
|
|
// 0 disables.
|
|
u64 read_spin_us = 0;
|
|
std::string pin_threads = "false";
|
|
|
|
u16 request_timeout = 0;
|
|
};
|
|
|
|
extern fuse_cfg_t fuse_cfg;
|