git: kernel - KVABIO stabilization

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Oct 16 11:30:34 PDT 2017


commit b3f55d8892ebb4d588921f0e08b1774035fa5ffa
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Oct 3 20:06:04 2017 -0700

    kernel - KVABIO stabilization
    
    * bp->b_cpumask must be cleared in vfs_vmio_release().
    
    * Generally speaking, it is generally desireable for the kernel to set
      B_KVABIO when flushing or disposing of a buffer, as long as b_cpumask
      is also correct.  This avoids unnecessary synchronization when
      underlying device drivers support KVABIO, even if the filesystem does
      not.
    
    * In findblk() we cannot just gratuitously clear B_KVABIO.  We must issue
      a bkvasync_all() to clear the flag in order to ensure proper
      synchronization with the caller's desired B_KVABIO state.
    
    * It was intended that bkvasync_all() clear the B_KVABIO flag.  Make
      sure it does.
    
    * In contrast, B_KVABIO can always be set at any time, so long as the
      cpumask is cleared whenever the mappings are changed, and also as long
      as the caller's B_KVABIO state is respected if the buffer is later
      returned to the caller in a locked state.  If the buffer will simply
      be disposed of by the kernel instead, the flag can be set.  The
      wrapper (typically a vn_strategy() or dev_dstrategy() call) will clear
      the flag via bkvasync_all() if the target does not support KVABIO.
    
    * Kernel support code outside of filesystem and device drivers is
      expected to support KVABIO.
    
    * nvtruncbuf() and nvextendbuf() now use bread_kvabio() (i.e. they now
      properly support KVABIO).
    
    * The buf_countdeps(), buf_checkread(), and buf_checkwrite() callbacks
      call bkvasync_all() in situations where the vnode does not support
      KVABIO.  This is because the kernel might have set the flag for other
      incidental operations even if the filesystem did not.
    
    * As per above, devfs_spec_strategy() now sets B_KVABIO and properly
      calls bkvasync() when it needs to operate directly on buf->b_data.
    
    * Fix bug in tmpfs().  tmpfs() was using bread_kvabio() as intended,
      but failed to call bkvasync() prior to operating directly on
      buf->b_data (prior to calling uiomovebp()).
    
    * Any VFS function that calls BUF_LOCK*() itself may also have to
      call bkvasync_all() if it wishes to operate directly on buf->b_data,
      even if the VFS is not KVABIO aware.  This is because the VFS bypassed
      the normal buffer cache APIs to obtain a locked buffer.

Summary of changes:
 sys/kern/vfs_bio.c          | 13 +++++++++----
 sys/kern/vfs_vm.c           |  6 ++++--
 sys/sys/buf2.h              | 20 +++++++++++++++-----
 sys/vfs/devfs/devfs_vnops.c | 12 ++++++++----
 sys/vfs/tmpfs/tmpfs_vnops.c |  2 ++
 sys/vfs/ufs/ffs_softdep.c   |  5 +++++
 6 files changed, 43 insertions(+), 15 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/b3f55d8892ebb4d588921f0e08b1774035fa5ffa


-- 
DragonFly BSD source repository



More information about the Commits mailing list