Browse Source

Merge pull request #247 from trapexit/epmfs

re-add minfreespace check to epmfs policy
pull/249/head 2.12.1
Antonio SJ Musumeci 9 years ago
parent
commit
6957cf39d1
  1. 11
      src/policy_epmfs.cpp

11
src/policy_epmfs.cpp

@ -16,6 +16,7 @@
#include <errno.h>
#include <limits>
#include <string>
#include <vector>
@ -32,13 +33,14 @@ static
int
_epmfs_create(const vector<string> &basepaths,
const char *fusepath,
const size_t minfreespace,
vector<const string*> &paths)
{
string fullpath;
size_t epmfs;
const string *epmfsbasepath;
epmfs = 0;
epmfs = std::numeric_limits<size_t>::min();
epmfsbasepath = NULL;
for(size_t i = 0, ei = basepaths.size(); i != ei; i++)
{
@ -54,6 +56,8 @@ _epmfs_create(const vector<string> &basepaths,
continue;
if(readonly)
continue;
if(spaceavail < minfreespace)
continue;
if(spaceavail < epmfs)
continue;
@ -112,10 +116,11 @@ int
_epmfs(const Category::Enum::Type type,
const vector<string> &basepaths,
const char *fusepath,
const size_t minfreespace,
vector<const string*> &paths)
{
if(type == Category::Enum::create)
return _epmfs_create(basepaths,fusepath,paths);
return _epmfs_create(basepaths,fusepath,minfreespace,paths);
return _epmfs_other(basepaths,fusepath,paths);
}
@ -131,7 +136,7 @@ namespace mergerfs
{
int rv;
rv = _epmfs(type,basepaths,fusepath,paths);
rv = _epmfs(type,basepaths,fusepath,minfreespace,paths);
if(POLICY_FAILED(rv))
rv = Policy::Func::mfs(type,basepaths,fusepath,minfreespace,paths);

Loading…
Cancel
Save