mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 05:16:00 +03:00
[PR #2681] [MERGED] Refactor to change StatCache class and add StatCacheNode classes #2705
Labels
No labels
bug
bug
dataloss
duplicate
enhancement
feature request
help wanted
invalid
need info
performance
pull-request
question
question
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/s3fs-fuse#2705
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/2681
Author: @ggtakec
Created: 6/6/2025
Status: ✅ Merged
Merged: 7/24/2025
Merged by: @gaul
Base:
master← Head:stat/04_statnode📝 Commits (1)
3383fd7Refactor to change StatCache class and add StatCacheNode classes📊 Changes
16 files changed (+3012 additions, -1394 deletions)
View changed files
📝
src/Makefile.am(+1 -0)📝
src/cache.cpp(+210 -615)📝
src/cache.h(+31 -103)➕
src/cache_node.cpp(+1354 -0)➕
src/cache_node.h(+330 -0)📝
src/fdcache_entity.cpp(+9 -0)📝
src/fdcache_entity.h(+2 -0)📝
src/metaheader.cpp(+76 -24)📝
src/metaheader.h(+4 -1)📝
src/s3fs.cpp(+781 -572)📝
src/s3fs_help.cpp(+2 -4)📝
src/s3fs_threadreqs.cpp(+44 -42)📝
src/s3fs_threadreqs.h(+4 -1)📝
src/s3objlist.cpp(+52 -28)📝
src/s3objlist.h(+9 -4)📝
src/types.h(+103 -0)📄 Description
Relevant Issue (if applicable)
#2674 #2675 #2676
Advance information
This PR is Phase 3 of fixes to refactor and improve StatCache.
(Draft until #2676 is merged. Subsequent PRs will follow based on this PR codes.)
This is the main purpose of refactorings for StatCache.
Reviewing this refactoring may take some time, so thank you in advance for your help.
(The basic idea is that the cache map in
StatCachehas been changed to a dedicated tree class(StatCacheNode).)Background
Stat information/Meta headers are managed by the
StatCacheclass, but it has become complicated due to past modifications.Since it is difficult to implement further modifications in the current
StatCacheclass, I decided to review theStatCacheclass.Summary
Currently,
StatCachecaches and manages stat information and meta headers.The cache is complicated, with regular file and directory caches, symbolic link caches, negative caches, and maps to prevent cache deletion.
So, these are implemented by new
StaCacheNodebase class and its derived classes, and the currentStatCachehas been changed to manage theStaCacheNodemap.There are no changes to the specifications in terms of functionality (support for files, directories, and symbolic links, expiration date, cache out block, negative cache, etc.).
Major changes
StatCache class
As before, this is a singleton cache management object and serves as an accessor to cached data.
Previous cache types(file, directory, symbolic link, negative cache) are managed and implemented by new
StatCacheNodeclasses.StatCacheNode base class and derived classes
The
StatCacheNodeclass is the base class for each cache type.The derived classes are
FileStatCache,DirStatCache,SymlinkStatCache, andNegativeStatCache.The Truncate(cache out) and expiration Handling for each cache are also implemented in these classes.
The blocking cache out function is managed by a flag in thess classes.
As described above, the cache data operations that were previously implemented in the
StatCacheclass are now implemented in these classes.Structure of Cache data
Currently, the structure of cache data was
path<->cache dataas a simple mapping.(These maps are
stat_cache_t,symlink_cache_t,notruncate_dir_map_t, etc.)In the new structure, the cache data is a directory tree structure with the mount point at the top.
Cache type definition
Currently, the cache type was defined in a complicated way using
dirtype(enum) for mainly type, and flags using the type of directory.(This dues to historical reasons due to the modification.)
The new type can now be expressed only with
objtype_t(enum).This
objtype_tcorresponds to the eachStatCacheNodederived class.In addition, directory types (
dir/,dir,dir_$folder$,<no directory entity>) are all expressed with thisobjtype_t.Utility functions such as determining
objtype_tvariables have also been unified.Others
The above changes to the
StatCacheclass and the addition of theStatCacheNodeclass have resulted in changes to the implementation of each file. (This was mainly done in the s3fs.cpp file.)Notes
The data managed by the
StatCacheNodeclass (including derived classes) includesstatandmetaheaders.Previously
StatCacheclass, this data was registered in themetaheader, andstatdata was created and registered through internal processing.In the new code, it can register with
statandmeta, or registerstatonly. (metaonly registration is not possible.)Registering
statonly will be used when implementing future performance tuning.(Currently, we are not using it yet)About s3proxy
@gaul
Due to the s3proxy specifications, some code changes were required.
As commented in the code, s3proxy responds as success to Head requests by
dirpath when the onlydir/object exists.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.