Wednesday, November 17, 2021

[SOLVED] About the member "i_count" of structure "inode"

Issue

"i_count" of structure "inode" is the reference to "inode".
When a process open a file and reads it, the value of "i_count" is 1.
When another process open the same file and reads it, the value of "i_count" is still 1, not 2.

Then what does the "i_count" of structure "inode" really mean?


Solution

i_count is increased by code that is about to do something to the inode and needs to prevent it from being freed from the cache. (See the callers of ihold().)

This additional reference is held only for a short time during such operations, so it is unlikely that you actually observe it.



Answered By - CL.