diff options
author | dds <dds@FreeBSD.org> | 2005-10-12 06:56:00 +0000 |
---|---|---|
committer | dds <dds@FreeBSD.org> | 2005-10-12 06:56:00 +0000 |
commit | 0fb2e655fdaa468d5188d6e87ef07cb383149b5b (patch) | |
tree | b831f3d94b8f98284035c19c12732a3f1465d75b /sys/kern/vfs_subr.c | |
parent | 66b195cfae1820593765c34e4917eb3a71d0204f (diff) | |
download | FreeBSD-src-0fb2e655fdaa468d5188d6e87ef07cb383149b5b.zip FreeBSD-src-0fb2e655fdaa468d5188d6e87ef07cb383149b5b.tar.gz |
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
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 17 |
1 files changed, 17 insertions, 0 deletions
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); + } +} |