vfs: replace VOP_MARKATIME with VOP_MMAPPED

The routine is only provided by ufs and is only used on mmap and exec.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D23422
This commit is contained in:
Mateusz Guzik 2020-02-01 06:46:55 +00:00
parent 0a09292188
commit 643656cfaf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357361
6 changed files with 17 additions and 32 deletions

View file

@ -870,7 +870,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
/* Set values passed into the program in registers. */
(*p->p_sysent->sv_setregs)(td, imgp, stack_base);
vfs_mark_atime(imgp->vp, td->td_ucred);
VOP_MMAPPED(imgp->vp);
SDT_PROBE1(proc, , , exec__success, args->fname);

View file

@ -5955,23 +5955,6 @@ 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 VOP_MARKATIME. This functionality is used by execve and
* mmap, so we want to avoid the I/O implied by directly setting
* va_atime for the sake of efficiency.
*/
void
vfs_mark_atime(struct vnode *vp, struct ucred *cred)
{
struct mount *mp;
mp = vp->v_mount;
ASSERT_VOP_LOCKED(vp, "vfs_mark_atime");
if (mp != NULL && (mp->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
(void)VOP_MARKATIME(vp);
}
/*
* The purpose of this routine is to remove granularity from accmode_t,
* reducing it into standard unix access bits - VEXEC, VREAD, VWRITE,

View file

@ -181,9 +181,9 @@ vop_setattr {
};
%% markatime vp L L L
%% mmapped vp L L L
vop_markatime {
vop_mmapped {
IN struct vnode *vp;
};

View file

@ -937,7 +937,6 @@ void vfs_hash_rehash(struct vnode *vp, u_int hash);
void vfs_hash_remove(struct vnode *vp);
int vfs_kqfilter(struct vop_kqfilter_args *);
void vfs_mark_atime(struct vnode *vp, struct ucred *cred);
struct dirent;
int vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off);
int vfs_emptydir(struct vnode *vp);

View file

@ -108,7 +108,7 @@ static vop_getattr_t ufs_getattr;
static vop_ioctl_t ufs_ioctl;
static vop_link_t ufs_link;
static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *, const char *);
static vop_markatime_t ufs_markatime;
static vop_mmapped_t ufs_mmapped;
static vop_mkdir_t ufs_mkdir;
static vop_mknod_t ufs_mknod;
static vop_open_t ufs_open;
@ -676,19 +676,22 @@ ufs_update_nfs4_acl_after_mode_change(struct vnode *vp, int mode,
}
#endif /* UFS_ACL */
/*
* Mark this file's access time for update for vfs_mark_atime(). This
* is called from execve() and mmap().
*/
static int
ufs_markatime(ap)
struct vop_markatime_args /* {
ufs_mmapped(ap)
struct vop_mmapped_args /* {
struct vnode *a_vp;
} */ *ap;
{
struct inode *ip = VTOI(ap->a_vp);
struct vnode *vp;
struct inode *ip;
struct mount *mp;
UFS_INODE_SET_FLAG_SHARED(ip, IN_ACCESS);
vp = ap->a_vp;
ip = VTOI(vp);
mp = vp->v_mount;
if ((mp->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
UFS_INODE_SET_FLAG_SHARED(ip, IN_ACCESS);
/*
* XXXKIB No UFS_UPDATE(ap->a_vp, 0) there.
*/
@ -2741,7 +2744,7 @@ struct vop_vector ufs_vnodeops = {
.vop_ioctl = ufs_ioctl,
.vop_link = ufs_link,
.vop_lookup = vfs_cache_lookup,
.vop_markatime = ufs_markatime,
.vop_mmapped = ufs_mmapped,
.vop_mkdir = ufs_mkdir,
.vop_mknod = ufs_mknod,
.vop_need_inactive = ufs_need_inactive,

View file

@ -1354,7 +1354,7 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
*objp = obj;
*flagsp = flags;
vfs_mark_atime(vp, cred);
VOP_MMAPPED(vp);
done:
if (error != 0 && *writecounted) {