mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Fixup debug output (#1617)
This commit is contained in:
@@ -18,39 +18,52 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "fuse_kernel.h"
|
||||
|
||||
void debug_fuse_open_out(const uint64_t unique,
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
int fuse_debug_set_output(const std::string &filepath);
|
||||
|
||||
void fuse_debug_open_out(const uint64_t unique,
|
||||
const struct fuse_open_out *arg,
|
||||
const uint64_t argsize);
|
||||
void debug_fuse_init_in(const struct fuse_init_in *arg);
|
||||
void debug_fuse_init_out(const uint64_t unique,
|
||||
void fuse_debug_init_in(const struct fuse_init_in *arg);
|
||||
void fuse_debug_init_out(const uint64_t unique,
|
||||
const struct fuse_init_out *arg,
|
||||
const uint64_t argsize);
|
||||
void debug_fuse_entry_out(const uint64_t unique,
|
||||
void fuse_debug_entry_out(const uint64_t unique,
|
||||
const struct fuse_entry_out *arg,
|
||||
const uint64_t argsize);
|
||||
void debug_fuse_attr_out(const uint64_t unique,
|
||||
void fuse_debug_attr_out(const uint64_t unique,
|
||||
const struct fuse_attr_out *arg,
|
||||
const uint64_t argsize);
|
||||
void debug_fuse_entry_open_out(const uint64_t unique,
|
||||
void fuse_debug_entry_open_out(const uint64_t unique,
|
||||
const struct fuse_entry_out *earg,
|
||||
const struct fuse_open_out *oarg);
|
||||
void debug_fuse_readlink(const uint64_t unique,
|
||||
void fuse_debug_readlink(const uint64_t unique,
|
||||
const char *linkname);
|
||||
void debug_fuse_write_out(const uint64_t unique,
|
||||
void fuse_debug_write_out(const uint64_t unique,
|
||||
const struct fuse_write_out *arg);
|
||||
void debug_fuse_statfs_out(const uint64_t unique,
|
||||
void fuse_debug_statfs_out(const uint64_t unique,
|
||||
const struct fuse_statfs_out *arg);
|
||||
void debug_fuse_getxattr_out(const uint64_t unique,
|
||||
void fuse_debug_getxattr_out(const uint64_t unique,
|
||||
const struct fuse_getxattr_out *arg);
|
||||
void debug_fuse_lk_out(const uint64_t unique,
|
||||
void fuse_debug_lk_out(const uint64_t unique,
|
||||
const struct fuse_lk_out *arg);
|
||||
void debug_fuse_bmap_out(const uint64_t unique,
|
||||
void fuse_debug_bmap_out(const uint64_t unique,
|
||||
const struct fuse_bmap_out *arg);
|
||||
void debug_fuse_in_header(const struct fuse_in_header *hdr);
|
||||
void fuse_debug_statx_out(const uint64_t unique,
|
||||
const struct fuse_statx_out *arg);
|
||||
void fuse_debug_data_out(const uint64_t unique,
|
||||
const size_t size);
|
||||
void fuse_debug_ioctl_out(const uint64_t unique,
|
||||
const struct fuse_ioctl_out *arg);
|
||||
void fuse_debug_poll_out(const uint64_t unique,
|
||||
const struct fuse_poll_out *arg);
|
||||
void fuse_debug_in_header(const struct fuse_in_header *hdr);
|
||||
void fuse_debug_out_header(const struct fuse_out_header *hdr);
|
||||
|
||||
std::string fuse_debug_init_flag_name(const uint64_t);
|
||||
|
||||
@@ -359,9 +359,6 @@ int fuse_main(int argc,
|
||||
|
||||
void fuse_populate_maintenance_thread(struct fuse *fuse);
|
||||
|
||||
int fuse_log_metrics_get(void);
|
||||
void fuse_log_metrics_set(int enabled);
|
||||
|
||||
|
||||
/**
|
||||
* Iterate over cache removing stale entries
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "base_types.h"
|
||||
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#define FUSE_CFG_INVALID_ID -1
|
||||
@@ -11,6 +13,9 @@
|
||||
|
||||
struct fuse_cfg_t
|
||||
{
|
||||
template<typename T>
|
||||
using sp = std::shared_ptr<T>;
|
||||
|
||||
s64 uid = FUSE_CFG_INVALID_ID;
|
||||
bool valid_uid() const;
|
||||
|
||||
@@ -23,7 +28,15 @@ struct fuse_cfg_t
|
||||
s64 remember_nodes = 0;
|
||||
|
||||
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:
|
||||
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;
|
||||
|
||||
+1148
-547
File diff suppressed because it is too large
Load Diff
+2
-17
@@ -14,6 +14,7 @@
|
||||
#include "syslog.hpp"
|
||||
|
||||
#include "crc32b.h"
|
||||
#include "debug.hpp"
|
||||
#include "khash.h"
|
||||
#include "kvec.h"
|
||||
#include "mutex.hpp"
|
||||
@@ -67,8 +68,6 @@
|
||||
|
||||
#define PARAM(inarg) ((void*)(((char*)(inarg)) + sizeof(*(inarg))))
|
||||
|
||||
static int g_LOG_METRICS = 0;
|
||||
|
||||
struct fuse_config
|
||||
{
|
||||
};
|
||||
@@ -3752,7 +3751,7 @@ fuse_populate_maintenance_thread(struct fuse *f_)
|
||||
|
||||
MaintenanceThread::push_job([=](int count_)
|
||||
{
|
||||
if(g_LOG_METRICS)
|
||||
if(fuse_cfg.debug)
|
||||
metrics_log_nodes_info_to_tmp_dir(f_);
|
||||
});
|
||||
}
|
||||
@@ -3777,8 +3776,6 @@ fuse_new(struct fuse_chan *ch,
|
||||
if(fuse_opt_parse(args,&f.conf,fuse_lib_opts,fuse_lib_opt_proc) == -1)
|
||||
goto out_free_fs;
|
||||
|
||||
g_LOG_METRICS = fuse_cfg.debug;
|
||||
|
||||
f.se = fuse_lowlevel_new_common(args,&llop,sizeof(llop),&f);
|
||||
if(f.se == NULL)
|
||||
goto out_free_fs;
|
||||
@@ -3854,18 +3851,6 @@ fuse_destroy(struct fuse *)
|
||||
kv_destroy(f.remembered_nodes);
|
||||
}
|
||||
|
||||
void
|
||||
fuse_log_metrics_set(int log_)
|
||||
{
|
||||
g_LOG_METRICS = log_;
|
||||
}
|
||||
|
||||
int
|
||||
fuse_log_metrics_get(void)
|
||||
{
|
||||
return g_LOG_METRICS;
|
||||
}
|
||||
|
||||
int
|
||||
fuse_passthrough_open(const int fd_)
|
||||
{
|
||||
|
||||
@@ -19,3 +19,28 @@ fuse_cfg_t::valid_umask() const
|
||||
{
|
||||
return (umask != FUSE_CFG_INVALID_UMASK);
|
||||
}
|
||||
|
||||
std::shared_ptr<FILE>
|
||||
fuse_cfg_t::log_file() const
|
||||
{
|
||||
return std::atomic_load(&_log_file);
|
||||
}
|
||||
|
||||
void
|
||||
fuse_cfg_t::log_file(std::shared_ptr<FILE> f_)
|
||||
{
|
||||
std::atomic_store(&_log_file, f_);
|
||||
}
|
||||
|
||||
std::shared_ptr<std::string>
|
||||
fuse_cfg_t::log_filepath() const
|
||||
{
|
||||
return std::atomic_load(&_log_filepath);
|
||||
}
|
||||
|
||||
void
|
||||
fuse_cfg_t::log_filepath(const std::string &s_)
|
||||
{
|
||||
std::atomic_store(&_log_filepath,
|
||||
std::make_shared<std::string>(s_));
|
||||
}
|
||||
|
||||
@@ -240,6 +240,15 @@ int
|
||||
fuse_reply_err(fuse_req_t *req_,
|
||||
int err_)
|
||||
{
|
||||
if(fuse_cfg.debug)
|
||||
{
|
||||
struct fuse_out_header hdr = {};
|
||||
hdr.unique = req_->ctx.unique;
|
||||
hdr.error = (err_ > 0) ? -err_ : err_;
|
||||
hdr.len = sizeof(struct fuse_out_header);
|
||||
fuse_debug_out_header(&hdr);
|
||||
}
|
||||
|
||||
return send_reply(req_,err_,NULL,0);
|
||||
}
|
||||
|
||||
@@ -308,6 +317,9 @@ fuse_reply_entry(fuse_req_t *req,
|
||||
// the kernel.
|
||||
#endif
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_entry_out(req->ctx.unique,&arg,size);
|
||||
|
||||
return send_reply_ok(req, &arg, size);
|
||||
}
|
||||
|
||||
@@ -331,6 +343,9 @@ fuse_reply_create(fuse_req_t *req,
|
||||
fill_entry(earg, e);
|
||||
fill_open(oarg, f);
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_entry_open_out(req->ctx.unique,earg,oarg);
|
||||
|
||||
return send_reply_ok(req, &buf, entrysize + sizeof(struct fuse_open_out));
|
||||
}
|
||||
|
||||
@@ -347,6 +362,9 @@ fuse_reply_attr(fuse_req_t *req,
|
||||
arg.attr_valid_nsec = 0;
|
||||
convert_stat(attr,&arg.attr);
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_attr_out(req->ctx.unique,&arg,size);
|
||||
|
||||
return send_reply_ok(req,&arg,size);
|
||||
}
|
||||
|
||||
@@ -363,6 +381,9 @@ fuse_reply_statx(fuse_req_t *req_,
|
||||
outarg.attr_valid_nsec = 0;
|
||||
outarg.stat = *(struct fuse_statx*)st_;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_statx_out(req_->ctx.unique,&outarg);
|
||||
|
||||
return send_reply_ok(req_,&outarg,sizeof(outarg));
|
||||
}
|
||||
|
||||
@@ -370,6 +391,9 @@ int
|
||||
fuse_reply_readlink(fuse_req_t *req,
|
||||
const char *linkname)
|
||||
{
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_readlink(req->ctx.unique,linkname);
|
||||
|
||||
return send_reply_ok(req, linkname, strlen(linkname));
|
||||
}
|
||||
|
||||
@@ -381,6 +405,9 @@ fuse_reply_open(fuse_req_t *req,
|
||||
|
||||
fill_open(&arg, f);
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_open_out(req->ctx.unique,&arg,sizeof(arg));
|
||||
|
||||
return send_reply_ok(req, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
@@ -392,6 +419,9 @@ fuse_reply_write(fuse_req_t *req,
|
||||
|
||||
arg.size = count;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_write_out(req->ctx.unique,&arg);
|
||||
|
||||
return send_reply_ok(req, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
@@ -400,6 +430,9 @@ fuse_reply_buf(fuse_req_t *req,
|
||||
const char *buf,
|
||||
size_t size)
|
||||
{
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_data_out(req->ctx.unique,size);
|
||||
|
||||
return send_reply_ok(req, buf, size);
|
||||
}
|
||||
|
||||
@@ -436,6 +469,9 @@ fuse_reply_data(fuse_req_t *req,
|
||||
out.unique = req->ctx.unique;
|
||||
out.error = 0;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_data_out(req->ctx.unique,bufsize_);
|
||||
|
||||
res = fuse_send_msg(req->f,req->ch,iov,2);
|
||||
if(res <= 0)
|
||||
{
|
||||
@@ -458,6 +494,9 @@ fuse_reply_statfs(fuse_req_t *req,
|
||||
|
||||
convert_statfs(stbuf, &arg.st);
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_statfs_out(req->ctx.unique,&arg);
|
||||
|
||||
return send_reply_ok(req, &arg, size);
|
||||
}
|
||||
|
||||
@@ -469,6 +508,9 @@ fuse_reply_xattr(fuse_req_t *req,
|
||||
|
||||
arg.size = count;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_getxattr_out(req->ctx.unique,&arg);
|
||||
|
||||
return send_reply_ok(req, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
@@ -489,6 +531,9 @@ fuse_reply_lock(fuse_req_t *req,
|
||||
}
|
||||
arg.lk.pid = lock->l_pid;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_lk_out(req->ctx.unique,&arg);
|
||||
|
||||
return send_reply_ok(req, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
@@ -500,6 +545,9 @@ fuse_reply_bmap(fuse_req_t *req,
|
||||
|
||||
arg.block = idx;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_bmap_out(req->ctx.unique,&arg);
|
||||
|
||||
return send_reply_ok(req, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
@@ -541,6 +589,9 @@ fuse_reply_ioctl_retry(fuse_req_t *req,
|
||||
arg.flags |= FUSE_IOCTL_RETRY;
|
||||
arg.in_iovs = in_count;
|
||||
arg.out_iovs = out_count;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_ioctl_out(req->ctx.unique,&arg);
|
||||
iov[count].iov_base = &arg;
|
||||
iov[count].iov_len = sizeof(arg);
|
||||
count++;
|
||||
@@ -619,6 +670,9 @@ fuse_reply_ioctl(fuse_req_t *req,
|
||||
arg.in_iovs = 0;
|
||||
arg.out_iovs = 0;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_ioctl_out(req->ctx.unique,&arg);
|
||||
|
||||
count = 1;
|
||||
iov[count].iov_base = &arg;
|
||||
iov[count].iov_len = sizeof(arg);
|
||||
@@ -649,6 +703,10 @@ fuse_reply_ioctl_iov(fuse_req_t *req,
|
||||
return fuse_reply_err(req, ENOMEM);
|
||||
|
||||
arg.result = result;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_ioctl_out(req->ctx.unique,&arg);
|
||||
|
||||
padded_iov[1].iov_base = &arg;
|
||||
padded_iov[1].iov_len = sizeof(arg);
|
||||
|
||||
@@ -668,6 +726,9 @@ fuse_reply_poll(fuse_req_t *req,
|
||||
|
||||
arg.revents = revents;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_poll_out(req->ctx.unique,&arg);
|
||||
|
||||
return send_reply_ok(req, &arg, sizeof(arg));
|
||||
}
|
||||
|
||||
@@ -1272,6 +1333,9 @@ do_init(fuse_req_t *req,
|
||||
|
||||
fuse_syslog_fuse_init_out(&outarg);
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_init_out(req->ctx.unique,&outarg,outargsize);
|
||||
|
||||
send_reply_ok(req, &outarg, outargsize);
|
||||
}
|
||||
|
||||
@@ -1722,9 +1786,13 @@ fuse_send_errno(struct fuse_ll *f_,
|
||||
|
||||
out.unique = unique_id_;
|
||||
out.error = -errno_;
|
||||
out.len = sizeof(struct fuse_out_header);
|
||||
iov.iov_base = &out;
|
||||
iov.iov_len = sizeof(struct fuse_out_header);
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_out_header(&out);
|
||||
|
||||
fuse_send_msg(f_,ch_,&iov,1);
|
||||
}
|
||||
|
||||
@@ -1777,6 +1845,9 @@ fuse_ll_buf_process_read(struct fuse_session *se_,
|
||||
|
||||
in = (struct fuse_in_header*)msgbuf_->mem;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_in_header(in);
|
||||
|
||||
req = fuse_ll_alloc_req(se_->f);
|
||||
if(req == NULL)
|
||||
return fuse_send_enomem(se_->f,se_->ch,in->unique);
|
||||
@@ -1817,6 +1888,9 @@ fuse_ll_buf_process_read_init(struct fuse_session *se_,
|
||||
|
||||
in = (struct fuse_in_header*)msgbuf_->mem;
|
||||
|
||||
if(fuse_cfg.debug)
|
||||
fuse_debug_in_header(in);
|
||||
|
||||
req = fuse_ll_alloc_req(se_->f);
|
||||
if(req == NULL)
|
||||
return fuse_send_enomem(se_->f,se_->ch,in->unique);
|
||||
|
||||
+22
-17
@@ -24,32 +24,37 @@ directly.](mailto:support@spawn.link)**
|
||||
* Solution already ruled out and why.
|
||||
* The details from the output of the
|
||||
[mergerfs.collect-info](tooling.md#mergerfscollect-info) tool.
|
||||
* Alternatively:
|
||||
* Version of mergerfs: `mergerfs --version`
|
||||
* mergerfs settings / arguments: from fstab, systemd unit, command
|
||||
line, OMV plugin, etc.
|
||||
* Version of the OS: `uname -a` and `lsb_release -a`
|
||||
* List of branches, their filesystem types, sizes (before and after
|
||||
issue): `df -h`, `lsblk -o NAME,FSTYPE,FSSIZE,SIZE,MOUNTPOINTS,RM,RO,ROTA`
|
||||
* **All** information about the relevant paths and files: permissions, ownership, etc.
|
||||
* **All** information about the application making the requests: version, uid/gid
|
||||
* **All** information about the relevant paths and files: permissions,
|
||||
ownership, etc. Some of this is collected by the tool but only the
|
||||
branch root details.
|
||||
* **All** information about the application making the requests:
|
||||
version, uid/gid. Try though to replicate any issues with common
|
||||
core utilities.
|
||||
* Try to recreate the problem in the simplest way using standard
|
||||
programs: `ln`, `mv`, `cp`, `ls`, `dd`, etc. With the most simple
|
||||
mergerfs setup possible such as using only a single branch, well
|
||||
supported branch filesystem, maybe reduce to using a single thread,
|
||||
etc.
|
||||
* Runtime environment:
|
||||
* Is mergerfs running within a container?
|
||||
* Are the client apps using mergerfs running in a container?
|
||||
* A `strace` of the app having problems:
|
||||
* `strace -fvTtt -s 256 -o /tmp/app.strace.txt <cmd>`
|
||||
* A `strace` of mergerfs **while** the program is trying to do
|
||||
whatever it is failing to do:
|
||||
* `strace -fvTtt -s 256 -p <mergerfsPID> -o /tmp/mergerfs.strace.txt`
|
||||
* **Precise** directions on replicating the issue. Do not leave
|
||||
**anything** out.
|
||||
* Try to recreate the problem in the simplest way using standard
|
||||
programs: `ln`, `mv`, `cp`, `ls`, `dd`, etc. With the most simple
|
||||
mergerfs setup possible.
|
||||
* A `strace` of mergerfs **before** and **while** the program is
|
||||
trying to do whatever it is failing to do:
|
||||
* `strace -fvTtt -s 256 -p <mergerfsPID> -o
|
||||
/tmp/mergerfs.strace.txt`
|
||||
* If mergerfs is blocking or appears stuck:
|
||||
* `gdb -q --batch -ex "set pagination off" -ex "thread apply all
|
||||
bt full" -ex quit --pid <mergerfsPID> > /tmp/mergerfs.stacktrace.txt`
|
||||
* **Precise** step-by-step directions on replicating the issue. Do not
|
||||
leave **anything** out.
|
||||
|
||||
|
||||
### Contact / Issue submission
|
||||
|
||||
In order of preference.
|
||||
|
||||
* github.com: [https://github.com/trapexit/mergerfs/issues](https://github.com/trapexit/mergerfs/issues)
|
||||
* discord: [https://discord.gg/MpAr69V](https://discord.gg/MpAr69V)
|
||||
* reddit: [https://www.reddit.com/r/mergerfs](https://www.reddit.com/r/mergerfs)
|
||||
|
||||
+3
-3
@@ -110,7 +110,7 @@ Config::Config()
|
||||
lazy_umount_mountpoint(false),
|
||||
link_cow(false),
|
||||
link_exdev(LinkEXDEV::ENUM::PASSTHROUGH),
|
||||
log_metrics(false),
|
||||
log_file({}),
|
||||
minfreespace(branches.minfreespace),
|
||||
mountpoint(),
|
||||
moveonenospc(true),
|
||||
@@ -137,7 +137,7 @@ Config::Config()
|
||||
xattr(XAttr::ENUM::PASSTHROUGH),
|
||||
|
||||
_congestion_threshold(fuse_cfg.congestion_threshold),
|
||||
_debug(fuse_cfg.debug),
|
||||
_debug(false),
|
||||
_gid(fuse_cfg.gid),
|
||||
_max_background(fuse_cfg.max_background),
|
||||
_mount(mountpoint),
|
||||
@@ -260,7 +260,7 @@ Config::Config()
|
||||
_map["lazy-umount-mountpoint"] = &lazy_umount_mountpoint;
|
||||
_map["link-cow"] = &link_cow;
|
||||
_map["link-exdev"] = &link_exdev;
|
||||
_map["log.metrics"] = &log_metrics;
|
||||
_map["log.file"] = &log_file;
|
||||
_map["minfreespace"] = &minfreespace;
|
||||
_map["mount"] = &_mount;
|
||||
_map["mountpoint"] = &_mountpoint;
|
||||
|
||||
+5
-3
@@ -19,12 +19,13 @@
|
||||
#include "branches.hpp"
|
||||
#include "category.hpp"
|
||||
#include "config_cachefiles.hpp"
|
||||
#include "config_debug.hpp"
|
||||
#include "config_dummy.hpp"
|
||||
#include "config_flushonclose.hpp"
|
||||
#include "config_follow_symlinks.hpp"
|
||||
#include "config_inodecalc.hpp"
|
||||
#include "config_link_exdev.hpp"
|
||||
#include "config_log_metrics.hpp"
|
||||
#include "config_log_file.hpp"
|
||||
#include "config_moveonenospc.hpp"
|
||||
#include "config_nfsopenhack.hpp"
|
||||
#include "config_noforget.hpp"
|
||||
@@ -140,7 +141,7 @@ public:
|
||||
ConfigBOOL lazy_umount_mountpoint;
|
||||
ConfigBOOL link_cow;
|
||||
LinkEXDEV link_exdev;
|
||||
LogMetrics log_metrics;
|
||||
LogFile log_file;
|
||||
TFSRef<u64> minfreespace;
|
||||
fs::path mountpoint;
|
||||
MoveOnENOSPC moveonenospc;
|
||||
@@ -169,7 +170,7 @@ public:
|
||||
|
||||
private:
|
||||
TFSRef<int> _congestion_threshold;
|
||||
TFSRef<bool> _debug;
|
||||
Debug _debug;
|
||||
CfgDummy _dummy;
|
||||
TFSRef<s64> _gid;
|
||||
TFSRef<int> _max_background;
|
||||
@@ -201,6 +202,7 @@ public:
|
||||
void keys_xattr(std::string &s) const;
|
||||
ssize_t keys_listxattr(char *list, size_t size) const;
|
||||
ssize_t keys_listxattr_size() const;
|
||||
const Str2TFStrMap& get_map() const { return _map; }
|
||||
|
||||
public:
|
||||
int get(const std::string &key, std::string *val) const;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2026, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config_debug.hpp"
|
||||
|
||||
#include "debug.hpp"
|
||||
#include "from_string.hpp"
|
||||
#include "fuse_cfg.hpp"
|
||||
#include "to_string.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
Debug::Debug(const bool v_)
|
||||
{
|
||||
fuse_cfg.debug = v_;
|
||||
}
|
||||
|
||||
std::string
|
||||
Debug::to_string(void) const
|
||||
{
|
||||
return str::to(fuse_cfg.debug);
|
||||
}
|
||||
|
||||
int
|
||||
Debug::from_string(const std::string_view s_)
|
||||
{
|
||||
int rv;
|
||||
bool val;
|
||||
|
||||
rv = str::from(s_,&val);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
fuse_cfg.debug = val;
|
||||
|
||||
// If debug is being enabled, ensure output file is set
|
||||
if(val)
|
||||
{
|
||||
auto log_file_path = fuse_cfg.log_filepath();
|
||||
if(log_file_path && !log_file_path->empty())
|
||||
fuse_debug_set_output(*log_file_path);
|
||||
else
|
||||
fuse_debug_set_output({}); // Use stderr
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2026, Antonio SJ Musumeci <trapexit@spawn.link>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tofrom_string.hpp"
|
||||
|
||||
class Debug : public ToFromString
|
||||
{
|
||||
public:
|
||||
Debug(const bool);
|
||||
|
||||
public:
|
||||
std::string to_string(void) const final;
|
||||
int from_string(const std::string_view) final;
|
||||
};
|
||||
@@ -16,38 +16,31 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config_log_metrics.hpp"
|
||||
#include "from_string.hpp"
|
||||
#include "to_string.hpp"
|
||||
#include "config_log_file.hpp"
|
||||
|
||||
#include "fuse.h"
|
||||
#include "debug.hpp"
|
||||
#include "fuse_cfg.hpp"
|
||||
|
||||
LogMetrics::LogMetrics(const bool val_)
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
LogFile::LogFile(const std::string &s_)
|
||||
{
|
||||
fuse_log_metrics_set(val_);
|
||||
fuse_debug_set_output(s_);
|
||||
}
|
||||
|
||||
std::string
|
||||
LogMetrics::to_string(void) const
|
||||
LogFile::to_string(void) const
|
||||
{
|
||||
bool val;
|
||||
auto filepath = fuse_cfg.log_filepath();
|
||||
|
||||
val = fuse_log_metrics_get();
|
||||
|
||||
return str::to(val);
|
||||
return (filepath ? *filepath : "");
|
||||
}
|
||||
|
||||
int
|
||||
LogMetrics::from_string(const std::string_view s_)
|
||||
LogFile::from_string(const std::string_view s_)
|
||||
{
|
||||
int rv;
|
||||
bool val;
|
||||
const std::string s{s_};
|
||||
|
||||
rv = str::from(s_,&val);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
fuse_log_metrics_set(val);
|
||||
|
||||
return 0;
|
||||
return fuse_debug_set_output(s);
|
||||
}
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
#include "tofrom_string.hpp"
|
||||
|
||||
class LogMetrics : public ToFromString
|
||||
class LogFile : public ToFromString
|
||||
{
|
||||
public:
|
||||
LogMetrics(const bool);
|
||||
LogFile(const std::string &);
|
||||
|
||||
public:
|
||||
std::string to_string(void) const final;
|
||||
@@ -233,5 +233,13 @@ FUSE::init(fuse_conn_info *conn_)
|
||||
SysLog::warning("passthrough and cache.writeback are incompatible.");
|
||||
}
|
||||
|
||||
SysLog::info("Config:");
|
||||
for(const auto &kv : cfg.get_map())
|
||||
{
|
||||
if(not kv.second->display)
|
||||
continue;
|
||||
SysLog::info("{}={}",kv.first,kv.second->to_string());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+5
-1
@@ -315,12 +315,16 @@ _main(int argc_,
|
||||
SysLog::info("mergerfs v{} started",MERGERFS_VERSION);
|
||||
SysLog::info("Go to https://trapexit.github.io/mergerfs/latest/support for support");
|
||||
|
||||
for(int i = 0; i < argc_; i++)
|
||||
SysLog::info("argv[{}]: {}",i,argv_[i]);
|
||||
|
||||
options::parse(&args);
|
||||
|
||||
if(!cfg.errs.empty())
|
||||
{
|
||||
for(auto &err : cfg.errs)
|
||||
{
|
||||
std::string s = err.to_string();
|
||||
const std::string s = err.to_string();
|
||||
|
||||
SysLog::error("error: {}",s);
|
||||
fmt::println(stderr,"mergerfs: ERROR - {}",s);
|
||||
|
||||
@@ -172,6 +172,12 @@ _lshw(const std::string &output_)
|
||||
::_run({"lshw"},output_);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_journalctl(const std::string &output_)
|
||||
{
|
||||
::_run({"journalctl","-t","mergerfs","--since","60 minutes ago"},output_);
|
||||
}
|
||||
|
||||
int
|
||||
mergerfs::collect_info::main(int argc_,
|
||||
@@ -208,6 +214,7 @@ mergerfs::collect_info::main(int argc_,
|
||||
::_fstab(output_filepath);
|
||||
::_software_versions(output_filepath);
|
||||
::_lshw(output_filepath);
|
||||
::_journalctl(output_filepath);
|
||||
|
||||
fmt::print("* Upload the following file to your"
|
||||
" GitHub ticket or put on https://pastebin.com"
|
||||
|
||||
Reference in New Issue
Block a user