git: kernel - Improve tmpfs support

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Feb 13 12:33:16 PST 2020


commit 9cd86db5abc558b11db02b052ae4c6ae870f0414
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Wed Feb 12 19:39:12 2020 -0800

    kernel - Improve tmpfs support
    
    * When a file in tmpfs is truncated to a size that is not on a block
      boundary, or extended (but not written) to a size that is not on a
      block boundary, the nvextendbuf() and nvtruncbuf() functions must
      modify the contents of the straddling buffer and bdwrite().
    
      However, a bdwrite() for a tmpfs buffer will result in a dirty buffer
      cache buffer and likely force it to be cycled out to swap relatively
      soon under a modest load.  This is not desirable if there is no memory
      pressure present to force it out.
    
      Tmpfs almost always uses buwrite() in order to leave the buffer 'clean'
      (the underlying VM pages are dirtied instead), to prevent unecessary
      paging of tmpfs data to swap when the buffer gets recycled or the vnode
      cycles out.
    
    * Add support for calling buwrite() in these functions by changing the
      'trivial' boolean into a flags variable.
    
    * Tmpfs now passes the appropriate flag, preventing the undesirable
      behavior.

Summary of changes:
 sys/kern/vfs_vm.c             | 24 +++++++++++++---------
 sys/sys/vnode.h               | 10 ++++++++--
 sys/vfs/hammer/hammer_vnops.c |  2 +-
 sys/vfs/nfs/nfs.h             |  2 +-
 sys/vfs/nfs/nfs_bio.c         | 10 +++++-----
 sys/vfs/tmpfs/tmpfs.h         |  1 +
 sys/vfs/tmpfs/tmpfs_subr.c    | 46 ++++++++++++++++++++++++++++++++++++++-----
 sys/vfs/tmpfs/tmpfs_vfsops.c  |  5 ++++-
 sys/vfs/tmpfs/tmpfs_vnops.c   | 28 +++++++++++++++-----------
 sys/vfs/tmpfs/tmpfs_vnops.h   |  1 +
 10 files changed, 93 insertions(+), 36 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/9cd86db5abc558b11db02b052ae4c6ae870f0414


-- 
DragonFly BSD source repository



More information about the Commits mailing list