tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] GOP_ALLOC and fallocate for PUFFS



On 30 Sep 2014, at 18:24, Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:

> On Tue, Sep 30, 2014 at 03:30:05PM +0000, Antti Kantee wrote:
>> Is it really better to sync fallocate, put stuff in the page cache and flush
>> the page cache some day instead of just having a write-through (or
>> write-first) page cache on the write() path?  You also get rid of the
>> fallocate-not-implemented problem that way.
> 
> GOP_ALLOC calls puffs_gop_alloc for chunks bigger than pages 
> (I observed 1 MB for now).  If we have fallocate implemented in the
> filesystem, this is really efficient, since fallocate saves us from
> sending any data to write. Hence IMO fallocate should be the preferred
> way if available.
> 
> But if it is not there, indeed, doing a write on first attemps should
> do the trick.
> 
>> Writing zeroes might be a bad emulation for distributed file systems, though
>> I guess you're the expert in that field and can evaluate the risks better
>> than me.
> 
> I understand that areas fallocate'd should return zeroes, so it should be
> fine. The real problem is performances. I am not sure what approach is best.
> 
> I first though about a puffs_gop_alloc like below, but that will not work, 
> as VOP_PUTPAGES goes to genfs_putpages, which calls 
> GOP_WRITE (genfs_gop_write), which calls VOP_STRATEGY without checking
> for failure.

genfs_gop_write calls genfs_do_io which does "error = biowait(mbp);"
near the end.  This will catch errors from VOP_STRATEGY.

But why do you need GOP_ALLOC?  Is there a consumer beside genfs_getpages
filling holes?  Puffs doesn't return holes as its VOP_BMAP always
returns valid ( != -1 ) block addrs.

> Should I directly call VOP_STRATEGY?
> 
> int
> puffs_gop_alloc(struct vnode *vp, off_t off, off_t len,
>                int flags, kauth_cred_t cred)
> {      
> 	int error;
> 	
> 	if (EXISTSOP(pmp, FALLOCATE))
> 		return _puffs_vnop_fallocate(vp, off, len);
> 	else
> 		return VOP_PUTPAGES(vp, off, off + len,
> 				    PGO_CLEANIT|PGO_SYNCIO);
> }     
> 
> -- 
> Emmanuel Dreyfus
> manu%netbsd.org@localhost

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)



Home | Main Index | Thread Index | Old Index