tmpfs: add a knob to enable pgcache read for mount
Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41334
This commit is contained in:
@@ -428,6 +428,9 @@ struct tmpfs_mount {
|
|||||||
bool tm_nonc;
|
bool tm_nonc;
|
||||||
/* Do not update mtime on writes through mmaped areas. */
|
/* Do not update mtime on writes through mmaped areas. */
|
||||||
bool tm_nomtime;
|
bool tm_nomtime;
|
||||||
|
|
||||||
|
/* Read from page cache directly. */
|
||||||
|
bool tm_pgread;
|
||||||
};
|
};
|
||||||
#define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock)
|
#define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock)
|
||||||
#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock)
|
#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock)
|
||||||
|
|||||||
@@ -1061,7 +1061,8 @@ tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, int lkflag,
|
|||||||
VI_LOCK(vp);
|
VI_LOCK(vp);
|
||||||
KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs"));
|
KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs"));
|
||||||
vp->v_object = object;
|
vp->v_object = object;
|
||||||
vn_irflag_set_locked(vp, VIRF_PGREAD | VIRF_TEXT_REF);
|
vn_irflag_set_locked(vp, (tm->tm_pgread ? VIRF_PGREAD : 0) |
|
||||||
|
VIRF_TEXT_REF);
|
||||||
VI_UNLOCK(vp);
|
VI_UNLOCK(vp);
|
||||||
VM_OBJECT_WUNLOCK(object);
|
VM_OBJECT_WUNLOCK(object);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ tmpfs_mount(struct mount *mp)
|
|||||||
struct tmpfs_mount *tmp;
|
struct tmpfs_mount *tmp;
|
||||||
struct tmpfs_node *root;
|
struct tmpfs_node *root;
|
||||||
int error;
|
int error;
|
||||||
bool nomtime, nonc;
|
bool nomtime, nonc, pgread;
|
||||||
/* Size counters. */
|
/* Size counters. */
|
||||||
u_quad_t pages;
|
u_quad_t pages;
|
||||||
off_t nodes_max, size_max, maxfilesize, ea_max_size;
|
off_t nodes_max, size_max, maxfilesize, ea_max_size;
|
||||||
@@ -412,6 +412,7 @@ tmpfs_mount(struct mount *mp)
|
|||||||
ea_max_size = 0;
|
ea_max_size = 0;
|
||||||
nonc = vfs_getopt(mp->mnt_optnew, "nonc", NULL, NULL) == 0;
|
nonc = vfs_getopt(mp->mnt_optnew, "nonc", NULL, NULL) == 0;
|
||||||
nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", 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
|
/* Do not allow mounts if we do not have enough memory to preserve
|
||||||
* the minimum reserved pages. */
|
* the minimum reserved pages. */
|
||||||
@@ -462,6 +463,7 @@ tmpfs_mount(struct mount *mp)
|
|||||||
tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
|
tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
|
||||||
tmp->tm_nonc = nonc;
|
tmp->tm_nonc = nonc;
|
||||||
tmp->tm_nomtime = nomtime;
|
tmp->tm_nomtime = nomtime;
|
||||||
|
tmp->tm_pgread = pgread;
|
||||||
|
|
||||||
/* Allocate the root node. */
|
/* Allocate the root node. */
|
||||||
error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid,
|
error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid,
|
||||||
|
|||||||
Reference in New Issue
Block a user