update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.
This commit is contained in:
parent
24b202fa43
commit
b7bfe82866
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: denode.h,v 1.4 2003/09/07 22:09:11 itojun Exp $ */
|
||||
/* $NetBSD: denode.h,v 1.5 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -307,4 +307,5 @@ int removede __P((struct denode *, struct denode *));
|
|||
int uniqdosname __P((struct denode *, struct componentname *, u_char *));
|
||||
int findwin95 __P((struct denode *));
|
||||
int msdosfs_gop_alloc __P((struct vnode *, off_t, off_t, int, struct ucred *));
|
||||
void msdosfs_gop_markupdate __P((struct vnode *, int));
|
||||
#endif /* _KERNEL */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_denode.c,v 1.8 2005/06/28 09:30:37 yamt Exp $ */
|
||||
/* $NetBSD: msdosfs_denode.c,v 1.9 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.8 2005/06/28 09:30:37 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.9 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -86,6 +86,7 @@ static const struct genfs_ops msdosfs_genfsops = {
|
|||
.gop_size = genfs_size,
|
||||
.gop_alloc = msdosfs_gop_alloc,
|
||||
.gop_write = genfs_gop_write,
|
||||
.gop_markupdate = msdosfs_gop_markupdate,
|
||||
};
|
||||
|
||||
static struct denode *msdosfs_hashget __P((dev_t, u_long, u_long));
|
||||
|
@ -693,3 +694,21 @@ msdosfs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
msdosfs_gop_markupdate(struct vnode *vp, int flags)
|
||||
{
|
||||
u_long mask = 0;
|
||||
|
||||
if ((flags & GOP_UPDATE_ACCESSED) != 0) {
|
||||
mask = DE_ACCESS;
|
||||
}
|
||||
if ((flags & GOP_UPDATE_MODIFIED) != 0) {
|
||||
mask |= DE_UPDATE;
|
||||
}
|
||||
if (mask) {
|
||||
struct denode *dep = VTODE(vp);
|
||||
|
||||
dep->de_flag |= mask;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_subr.c,v 1.251 2005/07/10 22:10:00 thorpej Exp $ */
|
||||
/* $NetBSD: vfs_subr.c,v 1.252 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2004, 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -80,7 +80,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.251 2005/07/10 22:10:00 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.252 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -960,7 +960,7 @@ brelvp(struct buf *bp)
|
|||
|
||||
if (TAILQ_EMPTY(&vp->v_uobj.memq) && (vp->v_flag & VONWORKLST) &&
|
||||
LIST_FIRST(&vp->v_dirtyblkhd) == NULL) {
|
||||
vp->v_flag &= ~VONWORKLST;
|
||||
vp->v_flag &= ~(VWRITEMAPDIRTY|VONWORKLST);
|
||||
LIST_REMOVE(vp, v_synclist);
|
||||
}
|
||||
|
||||
|
@ -996,7 +996,7 @@ reassignbuf(struct buf *bp, struct vnode *newvp)
|
|||
if (TAILQ_EMPTY(&newvp->v_uobj.memq) &&
|
||||
(newvp->v_flag & VONWORKLST) &&
|
||||
LIST_FIRST(&newvp->v_dirtyblkhd) == NULL) {
|
||||
newvp->v_flag &= ~VONWORKLST;
|
||||
newvp->v_flag &= ~(VWRITEMAPDIRTY|VONWORKLST);
|
||||
LIST_REMOVE(newvp, v_synclist);
|
||||
}
|
||||
} else {
|
||||
|
@ -1284,7 +1284,7 @@ vput(struct vnode *vp)
|
|||
uvmexp.execpages -= vp->v_uobj.uo_npages;
|
||||
uvmexp.filepages += vp->v_uobj.uo_npages;
|
||||
}
|
||||
vp->v_flag &= ~(VTEXT|VEXECMAP);
|
||||
vp->v_flag &= ~(VTEXT|VEXECMAP|VWRITEMAP);
|
||||
simple_unlock(&vp->v_interlock);
|
||||
VOP_INACTIVE(vp, p);
|
||||
}
|
||||
|
@ -1327,7 +1327,7 @@ vrele(struct vnode *vp)
|
|||
uvmexp.execpages -= vp->v_uobj.uo_npages;
|
||||
uvmexp.filepages += vp->v_uobj.uo_npages;
|
||||
}
|
||||
vp->v_flag &= ~(VTEXT|VEXECMAP);
|
||||
vp->v_flag &= ~(VTEXT|VEXECMAP|VWRITEMAP);
|
||||
if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK) == 0)
|
||||
VOP_INACTIVE(vp, p);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: genfs_node.h,v 1.7 2005/07/17 12:27:47 yamt Exp $ */
|
||||
/* $NetBSD: genfs_node.h,v 1.8 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Chuck Silvers.
|
||||
|
@ -39,6 +39,7 @@ struct genfs_ops {
|
|||
void (*gop_size)(struct vnode *, off_t, off_t *, int);
|
||||
int (*gop_alloc)(struct vnode *, off_t, off_t, int, struct ucred *);
|
||||
int (*gop_write)(struct vnode *, struct vm_page **, int, int);
|
||||
void (*gop_markupdate)(struct vnode *, int);
|
||||
};
|
||||
|
||||
#define GOP_SIZE(vp, size, eobp, flags) \
|
||||
|
@ -48,11 +49,27 @@ struct genfs_ops {
|
|||
#define GOP_WRITE(vp, pgs, npages, flags) \
|
||||
(*VTOG(vp)->g_op->gop_write)((vp), (pgs), (npages), (flags))
|
||||
|
||||
/*
|
||||
* GOP_MARKUPDATE: mark vnode's timestamps for update.
|
||||
*
|
||||
* => called with v_interlock (and possibly other locks) held.
|
||||
* => used for accesses via mmap.
|
||||
*/
|
||||
|
||||
#define GOP_MARKUPDATE(vp, flags) \
|
||||
(VTOG(vp)->g_op->gop_markupdate) ? \
|
||||
(*VTOG(vp)->g_op->gop_markupdate)((vp), (flags)) : \
|
||||
(void)0;
|
||||
|
||||
/* Flags to GOP_SIZE */
|
||||
#define GOP_SIZE_READ 0x1 /* Advise how many pages to read */
|
||||
#define GOP_SIZE_WRITE 0x2 /* Tell how many pages to write */
|
||||
#define GOP_SIZE_MEM 0x4 /* in-memory size */
|
||||
|
||||
/* Flags to GOP_MARKUPDATE */
|
||||
#define GOP_UPDATE_ACCESSED 1
|
||||
#define GOP_UPDATE_MODIFIED 2
|
||||
|
||||
struct genfs_node {
|
||||
const struct genfs_ops *g_op; /* ops vector */
|
||||
struct lock g_glock; /* getpages lock */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: genfs_vnops.c,v 1.102 2005/07/17 16:07:19 yamt Exp $ */
|
||||
/* $NetBSD: genfs_vnops.c,v 1.103 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.102 2005/07/17 16:07:19 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.103 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_nfsserver.h"
|
||||
|
@ -537,11 +537,30 @@ genfs_getpages(void *v)
|
|||
|
||||
/* uobj is locked */
|
||||
|
||||
if ((flags & PGO_NOTIMESTAMP) == 0 &&
|
||||
(vp->v_type == VREG ||
|
||||
(vp->v_mount->mnt_flag & MNT_NODEVMTIME) == 0)) {
|
||||
int updflags = 0;
|
||||
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0) {
|
||||
updflags = GOP_UPDATE_ACCESSED;
|
||||
}
|
||||
if (write) {
|
||||
updflags |= GOP_UPDATE_MODIFIED;
|
||||
}
|
||||
if (updflags != 0) {
|
||||
GOP_MARKUPDATE(vp, updflags);
|
||||
}
|
||||
}
|
||||
|
||||
if (write) {
|
||||
gp->g_dirtygen++;
|
||||
if ((vp->v_flag & VONWORKLST) == 0) {
|
||||
vn_syncer_add_to_worklist(vp, filedelay);
|
||||
}
|
||||
if ((vp->v_flag & (VWRITEMAP|VWRITEMAPDIRTY)) == VWRITEMAP) {
|
||||
vp->v_flag |= VWRITEMAPDIRTY;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -931,7 +950,7 @@ raout:
|
|||
break;
|
||||
|
||||
err = VOP_GETPAGES(vp, raoffset, NULL, &rapages, 0,
|
||||
VM_PROT_READ, 0, 0);
|
||||
VM_PROT_READ, 0, PGO_NOTIMESTAMP);
|
||||
simple_lock(&uobj->vmobjlock);
|
||||
if (err) {
|
||||
if (err != EBUSY ||
|
||||
|
@ -1094,6 +1113,7 @@ genfs_putpages(void *v)
|
|||
struct lwp *l = curlwp ? curlwp : &lwp0;
|
||||
struct genfs_node *gp = VTOG(vp);
|
||||
int dirtygen;
|
||||
boolean_t modified = FALSE;
|
||||
|
||||
UVMHIST_FUNC("genfs_putpages"); UVMHIST_CALLED(ubchist);
|
||||
|
||||
|
@ -1103,12 +1123,17 @@ genfs_putpages(void *v)
|
|||
|
||||
UVMHIST_LOG(ubchist, "vp %p pages %d off 0x%x len 0x%x",
|
||||
vp, uobj->uo_npages, startoff, endoff - startoff);
|
||||
|
||||
KASSERT((vp->v_flag & VONWORKLST) != 0 ||
|
||||
(vp->v_flag & VWRITEMAPDIRTY) == 0);
|
||||
if (uobj->uo_npages == 0) {
|
||||
s = splbio();
|
||||
if (LIST_FIRST(&vp->v_dirtyblkhd) == NULL &&
|
||||
(vp->v_flag & VONWORKLST)) {
|
||||
vp->v_flag &= ~VONWORKLST;
|
||||
LIST_REMOVE(vp, v_synclist);
|
||||
if (vp->v_flag & VONWORKLST) {
|
||||
vp->v_flag &= ~VWRITEMAPDIRTY;
|
||||
if (LIST_FIRST(&vp->v_dirtyblkhd) == NULL) {
|
||||
vp->v_flag &= ~VONWORKLST;
|
||||
LIST_REMOVE(vp, v_synclist);
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
simple_unlock(slock);
|
||||
|
@ -1373,6 +1398,7 @@ genfs_putpages(void *v)
|
|||
uvm_unlock_pageq();
|
||||
}
|
||||
if (needs_clean) {
|
||||
modified = TRUE;
|
||||
|
||||
/*
|
||||
* start the i/o. if we're traversing by list,
|
||||
|
@ -1421,6 +1447,12 @@ genfs_putpages(void *v)
|
|||
PRELE(l);
|
||||
}
|
||||
|
||||
if (modified && (vp->v_flag & VWRITEMAPDIRTY) != 0 &&
|
||||
(vp->v_type == VREG ||
|
||||
(vp->v_mount->mnt_flag & MNT_NODEVMTIME) == 0)) {
|
||||
GOP_MARKUPDATE(vp, GOP_UPDATE_MODIFIED);
|
||||
}
|
||||
|
||||
/*
|
||||
* if we're cleaning and there was nothing to clean,
|
||||
* take us off the syncer list. if we started any i/o
|
||||
|
@ -1430,10 +1462,12 @@ genfs_putpages(void *v)
|
|||
s = splbio();
|
||||
if ((flags & PGO_CLEANIT) && wasclean && gp->g_dirtygen == dirtygen &&
|
||||
startoff == 0 && endoff == trunc_page(LLONG_MAX) &&
|
||||
LIST_FIRST(&vp->v_dirtyblkhd) == NULL &&
|
||||
(vp->v_flag & VONWORKLST)) {
|
||||
vp->v_flag &= ~VONWORKLST;
|
||||
LIST_REMOVE(vp, v_synclist);
|
||||
vp->v_flag &= ~VWRITEMAPDIRTY;
|
||||
if (LIST_FIRST(&vp->v_dirtyblkhd) == NULL) {
|
||||
vp->v_flag &= ~VONWORKLST;
|
||||
LIST_REMOVE(vp, v_synclist);
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vnode.h,v 1.140 2005/06/19 18:22:37 elad Exp $ */
|
||||
/* $NetBSD: vnode.h,v 1.141 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -150,6 +150,8 @@ struct vnode {
|
|||
/* VISTTY used when reading dead vnodes */
|
||||
#define VISTTY 0x0008 /* vnode represents a tty */
|
||||
#define VEXECMAP 0x0010 /* vnode has PROT_EXEC mappings */
|
||||
#define VWRITEMAP 0x0020 /* might have PROT_WRITE user mappings */
|
||||
#define VWRITEMAPDIRTY 0x0040 /* might have dirty pages due to VWRITEMAP */
|
||||
#define VLOCKSWORK 0x0080 /* FS supports locking discipline */
|
||||
#define VXLOCK 0x0100 /* vnode is locked to change underlying type */
|
||||
#define VXWANT 0x0200 /* process is waiting for vnode */
|
||||
|
@ -160,7 +162,7 @@ struct vnode {
|
|||
#define VONWORKLST 0x4000 /* On syncer work-list */
|
||||
|
||||
#define VNODE_FLAGBITS \
|
||||
"\20\1ROOT\2TEXT\3SYSTEM\4ISTTY\5EXECMAP" \
|
||||
"\20\1ROOT\2TEXT\3SYSTEM\4ISTTY\5EXECMAP\6WRITEMAP\7WRITEMAPDIRTY" \
|
||||
"\10VLOCKSWORK\11XLOCK\12XWANT\13BWAIT\14ALIASED" \
|
||||
"\15DIROP\16LAYER\17ONWORKLIST\20DIRTY"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_vfsops.c,v 1.86 2005/06/28 09:30:38 yamt Exp $ */
|
||||
/* $NetBSD: ext2fs_vfsops.c,v 1.87 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.86 2005/06/28 09:30:38 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.87 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -147,6 +147,7 @@ static const struct genfs_ops ext2fs_genfsops = {
|
|||
.gop_size = genfs_size,
|
||||
.gop_alloc = ext2fs_gop_alloc,
|
||||
.gop_write = genfs_gop_write,
|
||||
.gop_markupdate = ufs_gop_markupdate,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_vfsops.c,v 1.166 2005/07/15 05:01:16 thorpej Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.167 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.166 2005/07/15 05:01:16 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.167 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -117,6 +117,7 @@ static const struct genfs_ops ffs_genfsops = {
|
|||
.gop_size = ffs_gop_size,
|
||||
.gop_alloc = ufs_gop_alloc,
|
||||
.gop_write = genfs_gop_write,
|
||||
.gop_markupdate = ufs_gop_markupdate,
|
||||
};
|
||||
|
||||
POOL_INIT(ffs_inode_pool, sizeof(struct inode), 0, 0, 0, "ffsinopl",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_vfsops.c,v 1.183 2005/06/28 09:30:38 yamt Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.184 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.183 2005/06/28 09:30:38 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.184 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -166,6 +166,7 @@ const struct genfs_ops lfs_genfsops = {
|
|||
.gop_size = lfs_gop_size,
|
||||
.gop_alloc = ufs_gop_alloc,
|
||||
.gop_write = lfs_gop_write,
|
||||
.gop_markupdate = ufs_gop_markupdate,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_extern.h,v 1.44 2005/07/10 00:18:52 thorpej Exp $ */
|
||||
/* $NetBSD: ufs_extern.h,v 1.45 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
|
@ -166,6 +166,7 @@ void ufs_vinit(struct mount *, int (**)(void *),
|
|||
int ufs_makeinode(int, struct vnode *, struct vnode **,
|
||||
struct componentname *);
|
||||
int ufs_gop_alloc(struct vnode *, off_t, off_t, int, struct ucred *);
|
||||
void ufs_gop_markupdate(struct vnode *, int);
|
||||
|
||||
/*
|
||||
* Snapshot function prototypes.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_inode.c,v 1.50 2005/07/17 09:13:35 yamt Exp $ */
|
||||
/* $NetBSD: ufs_inode.c,v 1.51 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.50 2005/07/17 09:13:35 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.51 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -235,7 +235,8 @@ ufs_balloc_range(struct vnode *vp, off_t off, off_t len, struct ucred *cred,
|
|||
memset(pgs, 0, npages * sizeof(struct vm_page *));
|
||||
simple_lock(&uobj->vmobjlock);
|
||||
error = VOP_GETPAGES(vp, pagestart, pgs, &npages, 0,
|
||||
VM_PROT_WRITE, 0, PGO_SYNCIO|PGO_PASTEOF|PGO_NOBLOCKALLOC);
|
||||
VM_PROT_WRITE, 0,
|
||||
PGO_SYNCIO|PGO_PASTEOF|PGO_NOBLOCKALLOC|PGO_NOTIMESTAMP);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs_vnops.c,v 1.128 2005/07/10 01:08:52 thorpej Exp $ */
|
||||
/* $NetBSD: ufs_vnops.c,v 1.129 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993, 1995
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.128 2005/07/10 01:08:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.129 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -2196,3 +2196,25 @@ ufs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,
|
|||
out:
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
ufs_gop_markupdate(struct vnode *vp, int flags)
|
||||
{
|
||||
u_int32_t mask = 0;
|
||||
|
||||
if ((flags & GOP_UPDATE_ACCESSED) != 0) {
|
||||
mask = IN_ACCESS;
|
||||
}
|
||||
if ((flags & GOP_UPDATE_MODIFIED) != 0) {
|
||||
if (vp->v_type == VREG) {
|
||||
mask |= IN_CHANGE | IN_UPDATE;
|
||||
} else {
|
||||
mask |= IN_MODIFY;
|
||||
}
|
||||
}
|
||||
if (mask) {
|
||||
struct inode *ip = VTOI(vp);
|
||||
|
||||
ip->i_flag |= mask;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_bio.c,v 1.40 2005/07/17 09:13:35 yamt Exp $ */
|
||||
/* $NetBSD: uvm_bio.c,v 1.41 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Chuck Silvers.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.40 2005/07/17 09:13:35 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.41 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#include "opt_uvmhist.h"
|
||||
|
||||
|
@ -276,7 +276,8 @@ again:
|
|||
uobj, umap->offset + slot_offset, npages, 0);
|
||||
|
||||
error = (*uobj->pgops->pgo_get)(uobj, umap->offset + slot_offset, pgs,
|
||||
&npages, 0, access_type, 0, flags | PGO_NOBLOCKALLOC);
|
||||
&npages, 0, access_type, 0, flags | PGO_NOBLOCKALLOC |
|
||||
PGO_NOTIMESTAMP);
|
||||
UVMHIST_LOG(ubchist, "getpages error %d npages %d", error, npages, 0,
|
||||
0);
|
||||
|
||||
|
@ -469,7 +470,8 @@ again:
|
|||
int npages = (*lenp + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||
struct vm_page *pgs[npages];
|
||||
int gpflags =
|
||||
PGO_SYNCIO|PGO_OVERWRITE|PGO_PASTEOF|PGO_NOBLOCKALLOC;
|
||||
PGO_SYNCIO|PGO_OVERWRITE|PGO_PASTEOF|PGO_NOBLOCKALLOC|
|
||||
PGO_NOTIMESTAMP;
|
||||
int i;
|
||||
KDASSERT(flags & UBC_WRITE);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_fault.c,v 1.97 2005/07/22 14:57:39 yamt Exp $ */
|
||||
/* $NetBSD: uvm_fault.c,v 1.98 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.97 2005/07/22 14:57:39 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.98 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#include "opt_uvmhist.h"
|
||||
|
||||
|
@ -966,7 +966,7 @@ ReFault:
|
|||
(curpg->flags & PG_CLEAN) != 0);
|
||||
readonly = (curpg->flags & PG_RDONLY)
|
||||
|| (curpg->loan_count > 0)
|
||||
|| UVM_OBJ_IS_CLEAN(curpg->uobject);
|
||||
|| UVM_OBJ_NEEDS_WRITEFAULT(curpg->uobject);
|
||||
|
||||
(void) pmap_enter(ufi.orig_map->pmap, currva,
|
||||
VM_PAGE_TO_PHYS(curpg),
|
||||
|
@ -1460,7 +1460,7 @@ Case2:
|
|||
|
||||
uvmexp.flt_obj++;
|
||||
if (UVM_ET_ISCOPYONWRITE(ufi.entry) ||
|
||||
UVM_OBJ_IS_CLEAN(uobjpage->uobject))
|
||||
UVM_OBJ_NEEDS_WRITEFAULT(uobjpage->uobject))
|
||||
enter_prot &= ~VM_PROT_WRITE;
|
||||
pg = uobjpage; /* map in the actual object */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_mmap.c,v 1.91 2005/05/11 13:02:25 yamt Exp $ */
|
||||
/* $NetBSD: uvm_mmap.c,v 1.92 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -51,7 +51,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.91 2005/05/11 13:02:25 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.92 2005/07/23 12:18:41 yamt Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
|
@ -1152,8 +1152,13 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit)
|
|||
}
|
||||
if (uobj == NULL)
|
||||
return((vp->v_type == VREG) ? ENOMEM : EINVAL);
|
||||
if ((flags & MAP_SHARED) == 0)
|
||||
if ((flags & MAP_SHARED) == 0) {
|
||||
uvmflag |= UVM_FLAG_COPYONW;
|
||||
} else if ((maxprot & VM_PROT_WRITE) != 0) {
|
||||
simple_lock(&vp->v_interlock);
|
||||
vp->v_flag |= VWRITEMAP;
|
||||
simple_unlock(&vp->v_interlock);
|
||||
}
|
||||
}
|
||||
|
||||
uvmflag = UVM_MAPFLAG(prot, maxprot,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_object.h,v 1.19 2005/07/17 12:27:47 yamt Exp $ */
|
||||
/* $NetBSD: uvm_object.h,v 1.20 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -91,6 +91,19 @@ extern struct uvm_pagerops aobj_pager;
|
|||
(UVM_OBJ_IS_VNODE(uobj) && \
|
||||
(((struct vnode *)uobj)->v_flag & VONWORKLST) == 0)
|
||||
|
||||
/*
|
||||
* UVM_OBJ_NEEDS_WRITEFAULT: true if the uobj needs to detect modification.
|
||||
* (ie. wants to avoid writable user mappings.)
|
||||
*
|
||||
* XXX bad name
|
||||
*/
|
||||
|
||||
#define UVM_OBJ_NEEDS_WRITEFAULT(uobj) \
|
||||
(UVM_OBJ_IS_VNODE(uobj) && \
|
||||
((((struct vnode *)uobj)->v_flag & VONWORKLST) == 0 || \
|
||||
(((struct vnode *)uobj)->v_flag & (VWRITEMAP|VWRITEMAPDIRTY)) \
|
||||
== VWRITEMAP))
|
||||
|
||||
#define UVM_OBJ_IS_AOBJ(uobj) \
|
||||
((uobj)->pgops == &aobj_pager)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_pager.h,v 1.29 2005/07/17 09:13:35 yamt Exp $ */
|
||||
/* $NetBSD: uvm_pager.h,v 1.30 2005/07/23 12:18:41 yamt Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -161,6 +161,7 @@ struct uvm_pagerops {
|
|||
#define PGO_OVERWRITE 0x200 /* pages will be overwritten before unlocked */
|
||||
#define PGO_PASTEOF 0x400 /* allow allocation of pages past EOF */
|
||||
#define PGO_NOBLOCKALLOC 0x800 /* backing block allocation is not needed */
|
||||
#define PGO_NOTIMESTAMP 0x1000 /* don't mark object accessed/modified */
|
||||
|
||||
/* page we are not interested in getting */
|
||||
#define PGO_DONTCARE ((struct vm_page *) -1L) /* [get only] */
|
||||
|
|
Loading…
Reference in New Issue