git: 14e8b328e324 - stable/13 - tmpfs: add a knob to enable pgcache read for mount
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Aug 2023 09:17:33 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=14e8b328e3245d9260212ec9e108f7fe23158cd8 commit 14e8b328e3245d9260212ec9e108f7fe23158cd8 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-08-06 01:35:36 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-16 09:16:09 +0000 tmpfs: add a knob to enable pgcache read for mount (cherry picked from commit 0f613ab85e5a5274704d179f39fb15163d46e7c4) --- sys/fs/tmpfs/tmpfs.h | 3 +++ sys/fs/tmpfs/tmpfs_subr.c | 2 +- sys/fs/tmpfs/tmpfs_vfsops.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 8d2ec4354d3e..a56fdfa6c408 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -405,6 +405,9 @@ struct tmpfs_mount { bool tm_nonc; /* Do not update mtime on writes through mmaped areas. */ bool tm_nomtime; + + /* Read from page cache directly. */ + bool tm_pgread; }; #define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock) #define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 49c1b729d753..98f28ead23e6 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1069,7 +1069,7 @@ loop: VI_LOCK(vp); KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs")); vp->v_object = object; - vn_irflag_set_locked(vp, VIRF_PGREAD); + vn_irflag_set_locked(vp, (tm->tm_pgread ? VIRF_PGREAD : 0)); VI_UNLOCK(vp); VM_OBJECT_WUNLOCK(object); break; diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 32c26823efc1..9a9c3f4570de 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -329,7 +329,7 @@ tmpfs_mount(struct mount *mp) struct tmpfs_mount *tmp; struct tmpfs_node *root; int error; - bool nomtime, nonc; + bool nomtime, nonc, pgread; /* Size counters. */ u_quad_t pages; off_t nodes_max, size_max, maxfilesize; @@ -407,6 +407,7 @@ tmpfs_mount(struct mount *mp) maxfilesize = 0; nonc = vfs_getopt(mp->mnt_optnew, "nonc", NULL, NULL) == 0; nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL, NULL) == 0; + pgread = vfs_getopt(mp->mnt_optnew, "pgread", NULL, NULL) == 0; /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */ @@ -454,6 +455,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; tmp->tm_nonc = nonc; tmp->tm_nomtime = nomtime; + tmp->tm_pgread = pgread; /* Allocate the root node. */ error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid,