mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04: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
4c5473d569
commit
a61b587aed
32 changed files with 1050 additions and 239 deletions
41
src/func_getattr_ff.cpp
Normal file
41
src/func_getattr_ff.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "func_getattr_ff.hpp"
|
||||
|
||||
#include "fs_stat.hpp"
|
||||
#include "fs_inode.hpp"
|
||||
#include "symlinkify.hpp"
|
||||
|
||||
|
||||
std::string_view
|
||||
Func2::GetAttrFF::name() const
|
||||
{
|
||||
return "ff";
|
||||
}
|
||||
|
||||
int
|
||||
Func2::GetAttrFF::operator()(const Branches &branches_,
|
||||
const fs::path &fusepath_,
|
||||
struct stat *st_,
|
||||
const FollowSymlinksEnum follow_symlinks_,
|
||||
const s64 symlinkify_timeout_)
|
||||
{
|
||||
int rv;
|
||||
fs::path fullpath;
|
||||
|
||||
for(const auto &branch : branches_)
|
||||
{
|
||||
fullpath = branch.path / fusepath_;
|
||||
rv = fs::stat(fullpath,st_,follow_symlinks_);
|
||||
if(rv < 0)
|
||||
continue;
|
||||
|
||||
symlinkify::convert_if_can_be_symlink(fullpath,
|
||||
st_,
|
||||
symlinkify_timeout_);
|
||||
|
||||
fs::inode::calc(branch.path,fusepath_,st_);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue