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:
Antonio S. Musumeci 2026-04-10 22:05:07 -04:00
parent 8af7effa98
commit afeaa60eb2
6 changed files with 18 additions and 36 deletions

View file

@ -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);