Per-open file private data for the cdevs

John Baldwin jhb at FreeBSD.org
Mon May 19 21:28:38 UTC 2008


On Monday 19 May 2008 11:38:11 am Kostik Belousov wrote:
> On Mon, May 19, 2008 at 10:15:34AM -0400, John Baldwin wrote:
> > On Thursday 15 May 2008 08:30:55 am Kostik Belousov wrote:
> > > On Thu, May 15, 2008 at 07:30:07AM -0400, John Baldwin wrote:
> > > > On Wednesday 14 May 2008 05:32:23 am Kostik Belousov wrote:
> > > > > So, I cannot implement overlay of the cdevpriv over the seqaccess 
data
> > > > > without some additional flag. On the other hand, use of 2 bytes for 
the
> > > > > f_type is overkill when the range of the types is [1,8]. I divided 
it
> > > > > to two one-byte fields, and new field is used for filetype-specific
> > > > > flags.
> > > > >
> > > > > http://people.freebsd.org/~kib/misc/fdpriv.4.patch
> > > > > shall give the same size of the struct file while not causing
> > > > > unconditional acquire of the cdevpriv_mtx on the last file close.
> > > > >
> > > > > Jeff, do you agree with the proposed vivisection of the f_type ? I 
will
> > > > > ask Peter to retest the patch then.
> > > >
> > > > I would rather add the new pointer to struct file and avoid breaking 
the
> > > > ABI of fstat.  That is, I would like this patch to be MFCable, but you
> > > > can't MFC this w/o breaking the ABI of struct file since fstat(1) will 
be
> > > > reading the full short to get the DTYPE.
> > >
> > > Oh, I thought that fstat uses struct xfile, at least for live systems.
> > >
> > > I considered to introduce new f_type value for devfs files; the
> > > DTYPE_VNODE is not a complete truth due to custom f_ops. But DTYPE_VNODE
> > > is special-cased in enough locations to make this much less preferrable
> > > then another pointer.
> > 
> > fstat always uses libkvm and direct access unfortunately.  Also, I greatly 
> > care about fstat on crash dumps as well. :)
> 
> So, what is the conclusion ? Does anybody have any further objections
> against committing
> http://people.freebsd.org/~kib/misc/fdpriv.3.patch
> 
> I plan to do it this week.

I think the current patch is good.

-- 
John Baldwin


More information about the freebsd-arch mailing list