]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add tmpfs page cache read support.
authorKonstantin Belousov <kib@FreeBSD.org>
Tue, 15 Sep 2020 22:19:16 +0000 (22:19 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Tue, 15 Sep 2020 22:19:16 +0000 (22:19 +0000)
commit081e36e760cac7f8869d8bae1472373b1320df3f
tree798d1584fe690ed1fa95d4d442e79f16e41b67e3
parent4601f5f5ee10e6ea093c6c7289a7157ed527d9d8
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
sys/fs/tmpfs/tmpfs.h
sys/fs/tmpfs/tmpfs_subr.c
sys/fs/tmpfs/tmpfs_vfsops.c
sys/fs/tmpfs/tmpfs_vnops.c