Reputation: 167
"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?
Upvotes: 3
Views: 1050
Reputation: 1
i_count is a kernel struct, represent how many function is using this "stuct inode".
It has no relationship with anything in user space.
I am a newbie in kernel, that's my understand.
Upvotes: 0
Reputation: 180060
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.
Upvotes: 3