aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2019-08-28 20:35:23 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2019-08-28 20:35:23 +0000
commita89cd2a4bd751f9fd832c47aeb0d48ed093ab95f (patch)
tree68892e9acba71a38c596e9b57b9b6b0fea30df7c
parent1e2f0ceb2f7687ff54778ca25ac203b8ee279dd9 (diff)
downloadsrc-a89cd2a4bd751f9fd832c47aeb0d48ed093ab95f.tar.gz
src-a89cd2a4bd751f9fd832c47aeb0d48ed093ab95f.zip
tmpfs: use VOP_NEED_INACTIVE
Reviewed by: kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21371
Notes
Notes: svn path=/head/; revision=351585
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 4bbf3485909f..1b3aa6d2db92 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -1283,6 +1283,27 @@ tmpfs_inactive(struct vop_inactive_args *v)
return (0);
}
+static int
+tmpfs_need_inactive(struct vop_need_inactive_args *ap)
+{
+ struct vnode *vp;
+ struct tmpfs_node *node;
+ struct vm_object *obj;
+
+ vp = ap->a_vp;
+ node = VP_TO_TMPFS_NODE(vp);
+ if (node->tn_links == 0)
+ goto need;
+ if (vp->v_type == VREG) {
+ obj = vp->v_object;
+ if ((obj->flags & OBJ_TMPFS_DIRTY) != 0)
+ goto need;
+ }
+ return (0);
+need:
+ return (1);
+}
+
int
tmpfs_reclaim(struct vop_reclaim_args *v)
{
@@ -1584,6 +1605,7 @@ struct vop_vector tmpfs_vnodeop_entries = {
.vop_readdir = tmpfs_readdir,
.vop_readlink = tmpfs_readlink,
.vop_inactive = tmpfs_inactive,
+ .vop_need_inactive = tmpfs_need_inactive,
.vop_reclaim = tmpfs_reclaim,
.vop_print = tmpfs_print,
.vop_pathconf = tmpfs_pathconf,