Re: i_count 2.0.36 vs 2.2.0

Magnus Ahltorp (map@stacken.kth.se)
01 Jan 1999 05:56:38 +0100


> 2.0.36 I see the following counts in my open routine:
>
> 1st open: f_count=1 i_count=1
> 2nd open: f_count=1 i_count=2
>
> Under 2.2.0 I see the following counts:
>
> 1st open: f_count=1 i_count=1 d_count=1
> 2nd open: f_count=1 i_count=1 d_count=2

The i_count == 1 that you see in 2.2.0 is the dentry referencing the
inode. Since open uses dentries, it gets a new copy of the dentry when
opening it again, and thus the refcount of 2 on the dentry.

> Is this intentional? If my driver close routine pays attention to
> i_count == 1 in 2.0.36 is it intended that it should use d_count == 1 in
> 2.2 instead? Or is this just a bug?

If you for some reason wants to know when the file is "opened" only
once, you have to look at all the dentries of the inode, and then sum
their refcounts. This will include all references to the inode's
dentries, not only open calls. It is however, as far as I know,
coceptually the same thing as the i_count in 2.0 kernels.

/Magnus
map@stacken.kth.se

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/