From 0fb2e655fdaa468d5188d6e87ef07cb383149b5b Mon Sep 17 00:00:00 2001 From: dds Date: Wed, 12 Oct 2005 06:56:00 +0000 Subject: Move execve's access time update functionality into a new vfs_mark_atime() function, and use the new function for performing efficient atime updates in mmap(). Reviewed by: bde MFC after: 2 weeks --- sys/kern/vfs_subr.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'sys/kern/vfs_subr.c') diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 26d5b9f..4e3d771 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3881,3 +3881,20 @@ vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off) return (0); } +/* + * Mark for update the access time of the file if the filesystem + * supports VA_MARK_ATIME. This functionality is used by execve + * and mmap, so we want to avoid the synchronous I/O implied by + * directly setting va_atime for the sake of efficiency. + */ +void +vfs_mark_atime(struct vnode *vp, struct thread *td) +{ + struct vattr atimeattr; + + if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0) { + VATTR_NULL(&atimeattr); + atimeattr.va_vaflags |= VA_MARK_ATIME; + (void)VOP_SETATTR(vp, &atimeattr, td->td_ucred, td); + } +} -- cgit v1.1