diff options
author | kib <kib@FreeBSD.org> | 2015-02-11 09:02:21 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-02-11 09:02:21 +0000 |
commit | 7ca5c317aee117a4f147780b44663907203afc11 (patch) | |
tree | 544d9b4141cc31e9d2012916d768135800fbd2ca /sys/fs/tmpfs/tmpfs_subr.c | |
parent | f5a4512544e1004f761b474f350ae4ebd61bb09c (diff) | |
download | FreeBSD-src-7ca5c317aee117a4f147780b44663907203afc11.zip FreeBSD-src-7ca5c317aee117a4f147780b44663907203afc11.tar.gz |
MFC r277828:
Update mtime for tmpfs files modified through memory mapping.
MFC r277969:
Update both ctime and mtime for writes to tmpfs files.
MFC r277972:
Remove single-use boolean.
MFC r278151:
Remove duplicated assignment.
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_subr.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index fed5792..383b478 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1417,6 +1417,31 @@ retry: return (0); } +void +tmpfs_check_mtime(struct vnode *vp) +{ + struct tmpfs_node *node; + struct vm_object *obj; + + ASSERT_VOP_ELOCKED(vp, "check_mtime"); + if (vp->v_type != VREG) + return; + obj = vp->v_object; + KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) == + (OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj")); + /* unlocked read */ + if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) { + VM_OBJECT_WLOCK(obj); + if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) { + obj->flags &= ~OBJ_TMPFS_DIRTY; + node = VP_TO_TMPFS_NODE(vp); + node->tn_status |= TMPFS_NODE_MODIFIED | + TMPFS_NODE_CHANGED; + } + VM_OBJECT_WUNLOCK(obj); + } +} + /* * Change flags of the given vnode. * Caller should execute tmpfs_update on vp after a successful execution. |