freebsd-dev/sys/fs/tmpfs
Konstantin Belousov 081e36e760 Add tmpfs page cache read support.
Or it could be explained as lockless (for vnode lock) reads.  Reads
are performed from the node tn_obj object.  Tmpfs regular vnode object
lifecycle is significantly different from the normal OBJT_VNODE: it is
alive as far as ref_count > 0.

Ensure liveness of the tmpfs VREG node and consequently v_object
inside VOP_READ_PGCACHE by referencing tmpfs node in tmpfs_open().
Provide custom tmpfs fo_close() method on file, to ensure that close
is paired with open.

Add tmpfs VOP_READ_PGCACHE that takes advantage of all tmpfs quirks.
It is quite cheap in code size sense to support page-ins for read for
tmpfs even if we do not own tmpfs vnode lock.  Also, we can handle
holes in tmpfs node without additional efforts, and do not have
limitation of the transfer size.

Reviewed by:	markj
Discussed with and benchmarked by:	mjg (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D26346
2020-09-15 22:19:16 +00:00
..
tmpfs_fifoops.c vfs: flatten vop vectors 2019-12-16 00:06:22 +00:00
tmpfs_fifoops.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
tmpfs_subr.c Add tmpfs page cache read support. 2020-09-15 22:19:16 +00:00
tmpfs_vfsops.c Add tmpfs page cache read support. 2020-09-15 22:19:16 +00:00
tmpfs_vnops.c Add tmpfs page cache read support. 2020-09-15 22:19:16 +00:00
tmpfs_vnops.h tmpfs: add VOP_STAT handler 2020-08-07 23:07:47 +00:00
tmpfs.h Add tmpfs page cache read support. 2020-09-15 22:19:16 +00:00