mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 11:02:35 +08:00
only return 1 branch for rand/eprand policies
This commit is contained in:
parent
6b3f703ba9
commit
0fffabfbe3
|
@ -253,14 +253,14 @@ If all branches are filtered an error will be returned. Typically **EROFS** or *
|
|||
| eplfs (existing path, least free space) | Of all the branches on which the relative path exists choose the drive with the least free space. |
|
||||
| eplus (existing path, least used space) | Of all the branches on which the relative path exists choose the drive with the least used space. |
|
||||
| epmfs (existing path, most free space) | Of all the branches on which the relative path exists choose the drive with the most free space. |
|
||||
| eprand (existing path, random) | Calls **epall** and then randomizes. |
|
||||
| eprand (existing path, random) | Calls **epall** and then randomizes. Returns 1. |
|
||||
| erofs | Exclusively return **-1** with **errno** set to **EROFS** (read-only filesystem). |
|
||||
| ff (first found) | Search category: same as **epff**. Action category: same as **epff**. Create category: Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found. |
|
||||
| lfs (least free space) | Search category: same as **eplfs**. Action category: same as **eplfs**. Create category: Pick the drive with the least available free space. |
|
||||
| lus (least used space) | Search category: same as **eplus**. Action category: same as **eplus**. Create category: Pick the drive with the least used space. |
|
||||
| mfs (most free space) | Search category: same as **epmfs**. Action category: same as **epmfs**. Create category: Pick the drive with the most available free space. |
|
||||
| newest | Pick the file / directory with the largest mtime. |
|
||||
| rand (random) | Calls **all** and then randomizes. |
|
||||
| rand (random) | Calls **all** and then randomizes. Returns 1. |
|
||||
|
||||
|
||||
#### Defaults ####
|
||||
|
|
|
@ -622,6 +622,7 @@ T{
|
|||
eprand (existing path, random)
|
||||
T}@T{
|
||||
Calls \f[B]epall\f[] and then randomizes.
|
||||
Returns 1.
|
||||
T}
|
||||
T{
|
||||
erofs
|
||||
|
@ -667,6 +668,7 @@ T{
|
|||
rand (random)
|
||||
T}@T{
|
||||
Calls \f[B]all\f[] and then randomizes.
|
||||
Returns 1.
|
||||
T}
|
||||
.TE
|
||||
.SS Defaults
|
||||
|
|
|
@ -25,17 +25,20 @@ using std::string;
|
|||
using std::vector;
|
||||
|
||||
int
|
||||
Policy::Func::eprand(const Category::Enum::Type type,
|
||||
Policy::Func::eprand(const Category::Enum::Type type_,
|
||||
const Branches &branches_,
|
||||
const char *fusepath,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
const char *fusepath_,
|
||||
const uint64_t minfreespace_,
|
||||
vector<const string*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = Policy::Func::epall(type,branches_,fusepath,minfreespace,paths);
|
||||
rv = Policy::Func::epall(type_,branches_,fusepath_,minfreespace_,paths_);
|
||||
if(rv == 0)
|
||||
std::random_shuffle(paths.begin(),paths.end());
|
||||
{
|
||||
std::random_shuffle(paths_.begin(),paths_.end());
|
||||
paths_.resize(1);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -25,17 +25,20 @@ using std::string;
|
|||
using std::vector;
|
||||
|
||||
int
|
||||
Policy::Func::rand(const Category::Enum::Type type,
|
||||
Policy::Func::rand(const Category::Enum::Type type_,
|
||||
const Branches &branches_,
|
||||
const char *fusepath,
|
||||
const uint64_t minfreespace,
|
||||
vector<const string*> &paths)
|
||||
const char *fusepath_,
|
||||
const uint64_t minfreespace_,
|
||||
vector<const string*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = Policy::Func::all(type,branches_,fusepath,minfreespace,paths);
|
||||
rv = Policy::Func::all(type_,branches_,fusepath_,minfreespace_,paths_);
|
||||
if(rv == 0)
|
||||
std::random_shuffle(paths.begin(),paths.end());
|
||||
{
|
||||
std::random_shuffle(paths_.begin(),paths_.end());
|
||||
paths_.resize(1);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user