[PR #2351] [MERGED] s3fs: add option free_space_ratio to control cache size #2494

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

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/2351
Author: @adamqqqplay
Created: 10/18/2023
Status: Merged
Merged: 10/20/2023
Merged by: @ggtakec

Base: masterHead: enhance-cache


📝 Commits (2)

  • 4f1a87b Try to cleanup cache directory when initing without enough disk space
  • 189f957 s3fs: add option free_space_ratio to control cache size

📊 Changes

5 files changed (+117 additions, -11 deletions)

View changed files

📝 doc/man/s3fs.1.in (+6 -0)
📝 src/fdcache.cpp (+44 -5)
📝 src/fdcache.h (+4 -0)
📝 src/s3fs.cpp (+54 -6)
📝 src/s3fs_help.cpp (+9 -0)

📄 Description

Relevant Issue (if applicable)

Many users complain that s3fs cannot effectively manage cache space growth. Users can usually use ensure_diskfree to reserve a certain amount of remaining space. But with this option, s3fs sometimes fails to start due to insufficient space, so we need an easier-to-use option.

This PR is a small enhancement to #280 to alleviate the issue.

Details

  1. s3fs: add option free_space_ratio to control cache size

Since the ensure_diskfree option is not convenient enough, we have added a new option "-o free_space_ratio" to control the space used by the s3fs cache based on the current disk size.

The value of this option can be between 0 and 100. It will control the size of the cache according to this ratio to ensure that the idle ratio of the disk is greater than this value.

For example, when the value is 10 and the disk space is 50GB, it will ensure that the disk will reserve at least 50GB * 10% = 5GB of remaining space.

  1. Try to cleanup cache directory when initing without enough disk space

Also optimize log messages to print detailed errors to the user.


I'm not sure if some behavior modifications are appropriate, please give me some suggestions, thanks in advance!


🔄 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/2351 **Author:** [@adamqqqplay](https://github.com/adamqqqplay) **Created:** 10/18/2023 **Status:** ✅ Merged **Merged:** 10/20/2023 **Merged by:** [@ggtakec](https://github.com/ggtakec) **Base:** `master` ← **Head:** `enhance-cache` --- ### 📝 Commits (2) - [`4f1a87b`](https://github.com/s3fs-fuse/s3fs-fuse/commit/4f1a87bd052958be780198546628063a2f3f37b1) Try to cleanup cache directory when initing without enough disk space - [`189f957`](https://github.com/s3fs-fuse/s3fs-fuse/commit/189f95718f6eef272eb526c77441e7921f68dadf) s3fs: add option free_space_ratio to control cache size ### 📊 Changes **5 files changed** (+117 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `doc/man/s3fs.1.in` (+6 -0) 📝 `src/fdcache.cpp` (+44 -5) 📝 `src/fdcache.h` (+4 -0) 📝 `src/s3fs.cpp` (+54 -6) 📝 `src/s3fs_help.cpp` (+9 -0) </details> ### 📄 Description ### Relevant Issue (if applicable) Many users complain that s3fs cannot effectively manage cache space growth. Users can usually use ensure_diskfree to reserve a certain amount of remaining space. But with this option, s3fs sometimes fails to start due to insufficient space, so we need an easier-to-use option. This PR is a small enhancement to #280 to alleviate the issue. ### Details 1. s3fs: add option free_space_ratio to control cache size Since the ensure_diskfree option is not convenient enough, we have added a new option "-o free_space_ratio" to control the space used by the s3fs cache based on the current disk size. The value of this option can be between 0 and 100. It will control the size of the cache according to this ratio to ensure that the idle ratio of the disk is greater than this value. For example, when the value is 10 and the disk space is 50GB, it will ensure that the disk will reserve at least 50GB * 10% = 5GB of remaining space. 2. Try to cleanup cache directory when initing without enough disk space Also optimize log messages to print detailed errors to the user. --- I'm not sure if some behavior modifications are appropriate, please give me some suggestions, thanks in advance! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:05:50 +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#2494
No description provided.