branches: add per branch minfreespace w/ original value as default

example: /mnt/disk0=RW,1G:/mnt/disk1=RW,2G
This commit is contained in:
Antonio SJ Musumeci 2020-08-20 18:47:04 -04:00
parent 98c49b8001
commit fc3453932a
68 changed files with 3005 additions and 813 deletions

View file

@ -32,12 +32,9 @@ namespace all
{
static
int
create(const Branches &branches_,
const uint64_t minfreespace_,
vector<string> *paths_)
create(const BranchVec &branches_,
vector<string> *paths_)
{
rwlock::ReadGuard guard(&branches_.lock);
int rv;
int error;
fs::info_t info;
@ -55,7 +52,7 @@ namespace all
error_and_continue(error,ENOENT);
if(info.readonly)
error_and_continue(error,EROFS);
if(info.spaceavail < minfreespace_)
if(info.spaceavail < branch->minfreespace())
error_and_continue(error,ENOSPC);
paths_->push_back(branch->path);
@ -66,17 +63,26 @@ namespace all
return 0;
}
static
int
create(const Branches &branches_,
vector<string> *paths_)
{
rwlock::ReadGuard guard(branches_.lock);
return all::create(branches_.vec,paths_);
}
}
int
Policy::Func::all(const Category type_,
const Branches &branches_,
const char *fusepath_,
const uint64_t minfreespace_,
vector<string> *paths_)
{
if(type_ == Category::CREATE)
return all::create(branches_,minfreespace_,paths_);
return all::create(branches_,paths_);
return Policy::Func::epall(type_,branches_,fusepath_,minfreespace_,paths_);
return Policy::Func::epall(type_,branches_,fusepath_,paths_);
}