tmpfs - Fix data loss issues
* Fix a data loss issue that can occur when vnodes are cycled. This
can be replicated by setting kern.maxvnodes to a fairly low value.
Vnode recycling does not necessarily issue a vinvalbuf() when clean
pages are present, which tmpfs needs to retain.
* Fix a data loss issue when swap becomes full or when the system has
no swap configured. When tmpfs tries to flush to swap and fails,
pages can remain associated with the vnode after the vinvalbuf()
call, and then lost when the vnode is recycled.
* The above fixes are accomplished by call vinvalbuf() on vnode deactivation
to make sure that all buffers have been flushed, and then moving any
pages that remain to tn_aobj.
The pages are moved back when the vnode is reinstantiated and an open(),
read(), write(), or setattr (i.e. truncation or extension) is called.
We try to avoid moving the pages back if the vnode is merely *stat()d
or deleted.
* Use cluster_read() by default to try to improve read throughput when
pages are swap-backed.
Reported-by: zrj, marino