[PR #1209] [MERGED] In memory cache for softlinks with cache out - #1168 #1873

Closed
opened 2026-03-04 02:02:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1209
Author: @ggtakec
Created: 11/26/2019
Status: Merged
Merged: 1/13/2020
Merged by: @gaul

Base: masterHead: symlink_cache


📝 Commits (1)

  • 6a85e27 In memory cache for softlinks with cache out

📊 Changes

5 files changed (+282 additions, -51 deletions)

View changed files

📝 doc/man/s3fs.1 (+3 -3)
📝 src/cache.cpp (+181 -3)
📝 src/cache.h (+42 -9)
📝 src/s3fs.cpp (+48 -30)
📝 src/s3fs_util.cpp (+8 -6)

📄 Description

Relevant Issue (if applicable)

#1168

Details

This PR is #1164 suggested by @AgrawalAmey.
It incorporates a symbolic link cache, and this PR is added the cash out mechanism.

The symlink caching method is the same as suggested by @AgrawalAmey.
The contents including cash out are shown below.

Cache contents

Cache the link destination path using the file path of the symbolic link as a key.
The cache time and reference count are also stored as cache data.
These additional elements are just like the Stats cache.

Cache size, expiration date, cash out

I decided to use Stats cache options for this cache size, expiration date, and cashout.
In other words, the symbolic link cache coexists with Stats cache and exists in the class that implements the Stats cache.

This is because s3fs implements symbolic links as S3 objects(files), but it does not exist as a file system.
Therefore, it is easier to implement a simple cache than to modify fdcache (or prepare an equivalent).
Also, when considering the mechanism of cashout, the same implementation as Stats cache makes it easier to implement and show to users.

The Stats cache settings max_stat_cache_size, stat_cache_expire, and stat_cache_interval_expire are shared with this symbolic link cache.
(The maximum number of Stats caches and symbolic links is the number specified by max_stat_cache_size, respectively)

Cash in, out

A symbolic link cache is created when a symbolic link is created. (At this time, the Stats cache is cached out)
The Stats cache for symbolic link files is not synchronized with the creation and access of symbolic link files. (Same as before)
When deleting a symbolic link, both the symbolic link and the Stats cache are deleted.

Thanks to @AgrawalAmey for great suggestions and PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/1209 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 11/26/2019 **Status:** ✅ Merged **Merged:** 1/13/2020 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `symlink_cache` --- ### 📝 Commits (1) - [`6a85e27`](https://github.com/s3fs-fuse/s3fs-fuse/commit/6a85e27a9830e7379d7d080fc8d6acab5dceab59) In memory cache for softlinks with cache out ### 📊 Changes **5 files changed** (+282 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `doc/man/s3fs.1` (+3 -3) 📝 `src/cache.cpp` (+181 -3) 📝 `src/cache.h` (+42 -9) 📝 `src/s3fs.cpp` (+48 -30) 📝 `src/s3fs_util.cpp` (+8 -6) </details> ### 📄 Description ### Relevant Issue (if applicable) #1168 ### Details This PR is #1164 suggested by @AgrawalAmey. It incorporates a symbolic link cache, and this PR is added the cash out mechanism. The symlink caching method is the same as suggested by @AgrawalAmey. The contents including cash out are shown below. #### Cache contents Cache the link destination path using the file path of the symbolic link as a key. The cache time and reference count are also stored as cache data. These additional elements are just like the Stats cache. #### Cache size, expiration date, cash out I decided to use Stats cache options for this cache size, expiration date, and cashout. In other words, the symbolic link cache coexists with Stats cache and exists in the class that implements the Stats cache. This is because s3fs implements symbolic links as S3 objects(files), but it does not exist as a file system. Therefore, it is easier to implement a simple cache than to modify fdcache (or prepare an equivalent). Also, when considering the mechanism of cashout, the same implementation as Stats cache makes it easier to implement and show to users. The Stats cache settings max_stat_cache_size, stat_cache_expire, and stat_cache_interval_expire are shared with this symbolic link cache. (The maximum number of Stats caches and symbolic links is the number specified by max_stat_cache_size, respectively) #### Cash in, out A symbolic link cache is created when a symbolic link is created. (At this time, the Stats cache is cached out) The Stats cache for symbolic link files is not synchronized with the creation and access of symbolic link files. (Same as before) When deleting a symbolic link, both the symbolic link and the Stats cache are deleted. Thanks to @AgrawalAmey for great suggestions and PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:02:34 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#1873
No description provided.