mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-20 23:16:27 -05:00
Change getattr and statx to bespoke policies
* Provides: slight improvement in performance as it no longer will need to find and then act on the files. * It doesn't make sense to support all original policy types. Most people used 'newest' or 'ff' and 'combine' is a better default which has same runtime as 'newest' but with better output.
This commit is contained in:
parent
965e26989c
commit
b3b8e793f9
145 changed files with 3803 additions and 1192 deletions
|
|
@ -15,27 +15,34 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
operator int()
|
||||
operator int() const
|
||||
{
|
||||
return (_err.has_value() ? _err.value() : -ENOENT);
|
||||
return (_err.has_value() ? _err.value() : 0);
|
||||
}
|
||||
|
||||
// A rough heuristic for prioritizing errors. Success always
|
||||
// overrides failures. ENOENT is lowest errno priority, then EROFS
|
||||
// (which can be set due to branch mode = RO) then any other error.
|
||||
Err&
|
||||
operator=(int v_)
|
||||
operator=(int new_err_)
|
||||
{
|
||||
if(!_err.has_value())
|
||||
_err = ((v_ >= 0) ? 0 : v_);
|
||||
else if(v_ >= 0)
|
||||
_err = ((new_err_ >= 0) ? 0 : new_err_);
|
||||
else if(new_err_ >= 0)
|
||||
_err = 0;
|
||||
else if(_err == -ENOENT)
|
||||
_err = new_err_;
|
||||
else if((_err == -EROFS) && (new_err_ != -ENOENT))
|
||||
_err = new_err_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
operator==(int v_)
|
||||
operator==(int other_)
|
||||
{
|
||||
if(_err.has_value())
|
||||
return (_err.value() == v_);
|
||||
return (_err.value() == other_);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue