git: DragonFly_RELEASE_5_8 kernel - Improve tmpfs support

Matthew Dillon dillon at
Thu Apr 23 19:03:55 PDT 2020

commit 33930dfcf0aab8a1475a9e8edcfcea28e6a2dfbb
Author: Matthew Dillon <dillon at>
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

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(-)

DragonFly BSD source repository

More information about the Commits mailing list