mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-01 08:31:45 +08:00
re-add minfreespace check to epmfs policy
This commit is contained in:
parent
26c2ebc843
commit
12cf57dc5a
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -32,13 +33,14 @@ static
|
||||||
int
|
int
|
||||||
_epmfs_create(const vector<string> &basepaths,
|
_epmfs_create(const vector<string> &basepaths,
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
|
const size_t minfreespace,
|
||||||
vector<const string*> &paths)
|
vector<const string*> &paths)
|
||||||
{
|
{
|
||||||
string fullpath;
|
string fullpath;
|
||||||
size_t epmfs;
|
size_t epmfs;
|
||||||
const string *epmfsbasepath;
|
const string *epmfsbasepath;
|
||||||
|
|
||||||
epmfs = 0;
|
epmfs = std::numeric_limits<size_t>::min();
|
||||||
epmfsbasepath = NULL;
|
epmfsbasepath = NULL;
|
||||||
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +56,8 @@ _epmfs_create(const vector<string> &basepaths,
|
||||||
continue;
|
continue;
|
||||||
if(readonly)
|
if(readonly)
|
||||||
continue;
|
continue;
|
||||||
|
if(spaceavail < minfreespace)
|
||||||
|
continue;
|
||||||
if(spaceavail < epmfs)
|
if(spaceavail < epmfs)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -112,10 +116,11 @@ int
|
||||||
_epmfs(const Category::Enum::Type type,
|
_epmfs(const Category::Enum::Type type,
|
||||||
const vector<string> &basepaths,
|
const vector<string> &basepaths,
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
vector<const string*> &paths)
|
const size_t minfreespace,
|
||||||
|
vector<const string*> &paths)
|
||||||
{
|
{
|
||||||
if(type == Category::Enum::create)
|
if(type == Category::Enum::create)
|
||||||
return _epmfs_create(basepaths,fusepath,paths);
|
return _epmfs_create(basepaths,fusepath,minfreespace,paths);
|
||||||
|
|
||||||
return _epmfs_other(basepaths,fusepath,paths);
|
return _epmfs_other(basepaths,fusepath,paths);
|
||||||
}
|
}
|
||||||
|
@ -131,7 +136,7 @@ namespace mergerfs
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
rv = _epmfs(type,basepaths,fusepath,paths);
|
rv = _epmfs(type,basepaths,fusepath,minfreespace,paths);
|
||||||
if(POLICY_FAILED(rv))
|
if(POLICY_FAILED(rv))
|
||||||
rv = Policy::Func::mfs(type,basepaths,fusepath,minfreespace,paths);
|
rv = Policy::Func::mfs(type,basepaths,fusepath,minfreespace,paths);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user