mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-21 07:26:28 -05:00
Use ReaddirCalc in all readdir implementations to avoid per-entry path construction
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8af7effa98
commit
afeaa60eb2
6 changed files with 18 additions and 36 deletions
|
|
@ -57,7 +57,6 @@ _readdir(const fs::path &branch_path_,
|
|||
mutex_t &mutex_)
|
||||
{
|
||||
DIR *dir;
|
||||
fs::path rel_filepath;
|
||||
fs::path abs_dirpath;
|
||||
|
||||
abs_dirpath = branch_path_ / rel_dirpath_;
|
||||
|
|
@ -68,7 +67,7 @@ _readdir(const fs::path &branch_path_,
|
|||
return -errno;
|
||||
DEFER{ fs::closedir(dir); };
|
||||
|
||||
rel_filepath = rel_dirpath_ / "dummy";
|
||||
fs::inode::ReaddirCalc inodecalc(branch_path_,rel_dirpath_);
|
||||
while(true)
|
||||
{
|
||||
LockGuard lk(mutex_);
|
||||
|
|
@ -89,10 +88,8 @@ _readdir(const fs::path &branch_path_,
|
|||
if(rv == 0)
|
||||
continue;
|
||||
|
||||
rel_filepath.replace_filename(de->d_name);
|
||||
|
||||
de->d_ino = fs::inode::calc(branch_path_,
|
||||
rel_filepath,
|
||||
de->d_ino = inodecalc.calc(de->d_name,
|
||||
namelen,
|
||||
DTTOIF(de->d_type),
|
||||
de->d_ino);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue