Subject: Re: ubc block allocation on write(2) (was: Re: kern/25279: NFS read doesn't update atime)
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 07/11/2005 10:20:32
On Sat, Jul 09, 2005 at 06:12:24PM +0900, YAMAMOTO Takashi wrote:
> hi,
> 
> > > > I meant that it makes a bit more sense for ufs_balloc_range() to call
> > > > VOP_GETPAGES() with VM_PROT_WRITE instead of VM_PROT_READ.
> > > 
> > > do you mean, letting VOP_GETPAGES allocate blocks rather than doing it in
> > > ufs_balloc_range?
> > 
> > no, though the change I was talking about would have had that unintended
> > side-effect.  I'll drop this idea for now.
> 
> btw, when filling holes, i think that
> sys_write -> ... -> ubc_fault -> VOP_GETPAGES(.. VM_PROT_WRITE ..)
> ends up to allocate more blocks than ufs_balloc_range does, if
> page size is larger than block size.
> is this intended behaviour?

nope, VOP_GETPAGES() should never need to allocate blocks at all
when it's called in the context of write().  the caller should do that
before starting to transfer the data.


> if it isn't, i guess the easiest fix would be
> an explicit PGO_NOBLOCKALLOC in ubc_fault.

that sounds fine, yea.

-Chuck