mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Move maintainence thread func take u64 rather than int
signed rollover is UB
This commit is contained in:
committed by
trapexit
parent
0cfab60f37
commit
0d05523dfd
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
@@ -9,5 +11,5 @@ class MaintenanceThread
|
||||
public:
|
||||
static void setup();
|
||||
static void stop();
|
||||
static void push_job(const std::function<void(int)> &func);
|
||||
static void push_job(const std::function<void(u64)> &func);
|
||||
};
|
||||
|
||||
@@ -3674,19 +3674,19 @@ fuse_gc1()
|
||||
void
|
||||
fuse_populate_maintenance_thread(struct fuse *f_)
|
||||
{
|
||||
MaintenanceThread::push_job([=](int count_)
|
||||
MaintenanceThread::push_job([=](u64 count_)
|
||||
{
|
||||
if(remember_nodes())
|
||||
fuse_prune_remembered_nodes();
|
||||
});
|
||||
|
||||
MaintenanceThread::push_job([](int count_)
|
||||
MaintenanceThread::push_job([](u64 count_)
|
||||
{
|
||||
if((count_ % 15) == 0)
|
||||
fuse_gc1();
|
||||
});
|
||||
|
||||
MaintenanceThread::push_job([=](int count_)
|
||||
MaintenanceThread::push_job([=](u64 count_)
|
||||
{
|
||||
if(fuse_cfg.debug)
|
||||
metrics_log_nodes_info_to_tmp_dir(f_);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
static pthread_t g_thread;
|
||||
static std::vector<std::function<void(int)>> g_funcs;
|
||||
static std::vector<std::function<void(u64)>> g_funcs;
|
||||
static mutex_t g_mutex;
|
||||
|
||||
static
|
||||
@@ -49,7 +49,7 @@ MaintenanceThread::setup()
|
||||
}
|
||||
|
||||
void
|
||||
MaintenanceThread::push_job(const std::function<void(int)> &func_)
|
||||
MaintenanceThread::push_job(const std::function<void(u64)> &func_)
|
||||
{
|
||||
LockGuard lg(g_mutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user