Matthew Dillon dillon at apollo.backplane.com
Mon May 19 16:44:36 UTC 2008

:> BTW, Remko has kindly notified me that Reinoud Zandijk has completed his
:> long work on UDF write support in NetBSD. I think that porting his work
:> is our best chance to get write support in FreeBSD too.
:I think you'll find that implementing VOPs and filling in UDF data
:structures will be easy, while interacting with the VM will be many
:orders of magnitude harder.  Still it should be a fun challenge for
:someone to do.
    One avenue that can be persued would be to finish the UIO_NOCOPY support
    in the vm/vnode_pager.c.  You have UIO_NOCOPY support for the putpages
    code but not the getpages code.

    If that were done the VFS can simply use VMIO-backed buffer cache buffers
    (they have to be VMIO-backed for UIO_NOCOPY to work properly)...  and
    not have to deal with getpages or putpages at all.  The vnode pager
    would convert them to a UIO_NOCOPY VOP_READ or VOP_WRITE as appropriate.
    The entire VM coding burden winds up being in the kernel proper and
    not in the VFS at all.

    IMHO implementing per-VFS getpages/putpages is an exercise in frustration,
    to be avoided at all costs.  Plus once you have a generic getpages/putpages
    layer in vm/vnode_pager.c the VFS code no longer has to mess with VM pages
    anywhere and winds up being far more portable.  I did the necessary work
    in DragonFly in order to avoid having to mess with VM pages in HAMMER.

    Primary work:

    * It is a good idea to require that all vnode-based buffer cache buffers
      be B_VMIO backed (aka have a VM object).  It ensures a clean interface
      and avoids confusion, and also cleans up numerous special cases that
      are simply not needed in this day and age.

    * Add support for UIO_NOCOPY in generic getpages.  Get rid of all the
      special cases for small-block filesystems in getpages.  Make it
      completely generic and simply issue the UIO_NOCOPY VOP_READ/VOP_WRITE.

    * Make minor adjustments to existing VFSs (but nothing prevents them from
      still rolling their own getpages/putpages so no major changes are 

    And then enjoy the greatly simplified VFS interactions that result.

    I would also recommend removing the VOP_BMAP() from the generic
    getpages/putpages code and simply letting the VFS's VOP_READ/VOP_WRITE
    deal with it.  The BMAP calls were being made from getpages/putpages to
    check for discontiguous blocks, to avoid unnecessary disk seeks.  Those
    checks are virtually worthless on today's modern hardware particularly
    since filesystems already localize most data accesses.  In other words,
    if your filesystem is fragmented you are going to be doing the seeks
    anyway, probably.

					Matthew Dillon 
					<dillon at backplane.com>

More information about the freebsd-stable mailing list