kernel - Support bdwrite() on tmpfs buffer cache buffers
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 8 Dec 2011 06:32:33 +0000 (22:32 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 8 Dec 2011 06:32:33 +0000 (22:32 -0800)
commit8f9ba07bf8fc82b831f5600141b0b039548764ee
tree4eec7f2213ce321be666cf3f911226d5642b1653
parent8b0272b97de4fe9a1460bf12740a14d9692b9a37
kernel - Support bdwrite() on tmpfs buffer cache buffers

* tmpfs itself does not call bdwrite() when no swap space has been
  allocated but certain system side effects such as nvtruncbuf()
  when a file is truncated CAN cause bdwrite() to be called.

  This eventually causes the buffer to run through tmpfs's strategy
  function.

* Adjust the strategy function to handle the no-swap case by marking
  the underlying pages dirty and valid and completing the I/O.

* Also handle the case when swap exists but fills up.  If the
  swap_strategy() function fails with ENOMEM fall-back to again
  marking the pages dirty andvalid and completing the I/O.

  This allows tmpfs to fill up to the system's total memory+swap instead
  of just the system's swap.
sys/vfs/tmpfs/tmpfs_vnops.c