RFC: Request for guidance on VFS statistics consolidation
Hi linux-fsdevel,
I'm a new contributor learning kernel development, and I would like some guidance before proceeding further.
Background
==========
I've been exploring VFS statistics collection. While doing so, I noticed that VFS statistics are currently exposed via several separate interfaces:
- /proc/sys/fs/dentry-state
- /proc/sys/fs/inode-state
- /proc/sys/fs/inode-nr
- /proc/sys/fs/file-nr
- /proc/sys/fs/file-max
My Questions
============
Before investing more time in implementation, I wanted to understand the rationale behind the current design and get some feedback:
1. Is the current multi-file approach intentional?
Are there specific benefits to keeping these statistics separate that I might not be aware of?
2. Would a consolidated interface be useful?
Would there be interest in a single file that aggregates common VFS metrics, or is the current approach preferred?
3. What's the recommended way to extend VFS observability? If there are gaps in the current monitoring capabilities, which of the following approaches is preferred:
- Extend existing interfaces?
- Add new specialized interfaces?
- Enhance debugfs entries?
- Something else?
4. Are there any existing efforts to improve this area?
I want to avoid duplicating work that might already be in progress.
Context
=======
I have written a small prototype that collects these stats into a single sysctl entry (/proc/sys/fs/vfsstats), mainly as a learning exercise. I understand this might duplicate existing functionality or not align with established design principles.
Before polishing the code or writing documentation, I wanted to understand:
- Whether this direction makes sense at all
- The right approach if there is room for improvement
- Common mistakes to avoid as a new contributor
Learning Goals
==============
I'm genuinely interested in:
- Understanding the design decisions behind the VFS
- Learning what constitutes a good kernel patch
- Contributing meaningfully, even if this specific idea is not viable
Any guidance, pointers to documentation, or suggestions for better approaches would be greatly appreciated. I'm also happy to work on smaller bug fixes or improvements if that would be more useful.
Thanks for your time and patience with a newcomer,
Abdulrahman Nader
[email protected]
P.S. If this is not the right venue for these questions, please advise where I should ask instead.
Quoted 3 lines · On Mon, Oct 20, 2025 at 06:52:28PM +0300, [email protected] wrote:
1. Is the current multi-file approach intentional?
Are there specific benefits to keeping these statistics separate that I might not be aware of?
sysfs files export one value per file. SeeDocumentation/filesystems/sysfs.rst
Jan Kara
reviewerHello!
Quoted 6 lines · On Mon 20-10-25 18:52:28, [email protected] wrote:
I'm a new contributor learning kernel development, and I would like some guidance before proceeding further.
Background
==========
Quoted 8 lines
I've been exploring VFS statistics collection. While doing so, I noticed that VFS statistics are currently exposed via several separate interfaces:
-
/proc/sys/fs/dentry-state
-/proc/sys/fs/inode-state
-/proc/sys/fs/inode-nr
-/proc/sys/fs/file-nr
-/proc/sys/fs/file-max
Correct.
Quoted 9 lines
My Questions
============Before investing more time in implementation, I wanted to understand the rationale behind the current design and get some feedback:
1. Is the current multi-file approach intentional?
Are there specific benefits to keeping these statistics separate that I might not be aware of?
Yes, it is pretty much intentional. Generally the file format can be simpler and is easier to extend in a backward compatible way by adding more entries when we have one sys file per object type. Also at this point we cannot ever get rid of the current sys files because a lot of userspace depends on them. So at this point the main benefit is probably that everybody is used to the way things are currently done :)
Quoted 3 lines
2. Would a consolidated interface be useful?
Would there be interest in a single file that aggregates common VFS metrics, or is the current approach preferred?
Well, it's your job to justify why a new aggregated interface would be useful. I personally don't see a benefit, just added maintenance cost.
Quoted 7 lines
3. What's the recommended way to extend VFS observability? If there are gaps in the current monitoring capabilities, which of the following approaches is preferred:
- Extend existing interfaces?
- Add new specialized interfaces?
- Enhance debugfs entries?
- Something else?
I think the most important is to find some practical problem users are facing and then try to solve it. Just extending interfaces for the sake of more generality isn't going to go too far. Each added interface bears a noticeable maintenance cost so there has to be appropriate benefit justifying that cost.
Quoted 2 lines
4. Are there any existing efforts to improve this area?
I want to avoid duplicating work that might already be in progress.
I'm not aware of anything.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR