open cookies

Alfred Perlstein bright at
Mon Nov 17 11:31:05 PST 2003

* Robert Watson <rwatson at> [031117 10:13] wrote:
> On Sun, 16 Nov 2003, Alfred Perlstein wrote:
> > I'm starting to do the gruntwork of getting us per-open cookies for file
> > operations.  If someone can explain what needs to be done that would
> > speed things up. :) 
> I implemented about 90% of this previously and did not commit it.  In
> general, the notion of "session" corresponds well to the notion of "file
> descriptor"; I found that this meant only VOPs that could be performed on
> a vnode pulled out of a file descriptor were relevant.  When a VOP is
> dual-purpose: i.e., can be called using both "by name" and "with a
> session", or even just "without a session", I used NULL for the cookie
> argument to the VOP.  Since we nominally support file system stacking, I
> found that, much as you concluded, we needed a cookie rather than passing
> struct file into each VOP, which works with the top layer but not for
> lower layers.  As we stuff a lower layer vnode reference into the
> per-vnode state, we now have to stuff per-open state material into each
> layer's per-open state.
> My general conclusion was that this over-complicated our VFS
> substantially, and that the struct file state in Linux was generally used
> only for multiply instantiated devices.  With devfs cloning, all the cases
> I was interested in (things like /dev vmware nodes) are addressed.  Since
> none of our non-specfs nodes required any notion of state, I found I was
> touching a lot of code to minimal benefit.  What's your motivation for
> adding this support, and can it be added in a way that doesn't introduce
> new arguments to most VOPs, and introduce a host of potential bugs?  I
> don't doubt it can be done right, but it's a fairly complex solution that
> has to be motivated by complex requirements... 

I just wanted to support the way that Linux does stuff.  Are you saying
that it's taken care of?

- Alfred Perlstein
- Research Engineering Development Inc.
- email: bright at cell: 408-480-4684

More information about the freebsd-fs mailing list