Add EnableAutoReaddirplus flag to MountConfig #180
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change introduces a new EnableAutoReaddirplus flag to decouple the adaptive ReadDirPlus kernel behavior from the main EnableReaddirplus flag.
Problem:
Previously, enabling EnableReaddirplus would also enable the InitReaddirplusAuto kernel capability. The issue is that for a ls command, the adaptive mode results in the directory listing being performed twice:
The kernel first issues a ReadDirPlus request, optimistically fetching file attributes along with names.
When it sees that the user-space application (ls) does not use the attributes, it falls back and issues ReadDir requests which leads to listing the whole directory again.
This sequence leads to redundant work and unnecessary overhead.
The Solution
This pull request introduces a separate EnableAutoReaddirplus flag in the MountConfig. This decouples the adaptive behavior from the main feature, allowing for more precise control.
The logic is now as follows:
To force ReadDirPlus always: Set EnableReaddirplus: true and EnableAutoReaddirplus: false. This is ideal for workloads like ls -l where attributes are always needed.
To enable adaptive ReadDirPlus: Set both EnableReaddirplus: true and EnableAutoReaddirplus: true.
This change is implemented by making the setting of the fusekernel.InitReaddirplusAuto flag conditional on the new EnableAutoReaddirplus configuration