When reading or writing the backing store us POSIX_FADV_NOREUSE access hint

to prevent read ahead.
This commit is contained in:
hannken 2011-06-21 12:41:24 +00:00
parent 19e20982bb
commit f33030999c
1 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fss.c,v 1.75 2011/06/12 03:35:51 rmind Exp $ */
/* $NetBSD: fss.c,v 1.76 2011/06/21 12:41:24 hannken Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.75 2011/06/12 03:35:51 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.76 2011/06/21 12:41:24 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -978,12 +978,13 @@ fss_bs_io(struct fss_softc *sc, fss_io_type rw,
vn_lock(sc->sc_bs_vp, LK_EXCLUSIVE|LK_RETRY);
error = vn_rdwr((rw == FSS_READ ? UIO_READ : UIO_WRITE), sc->sc_bs_vp,
data, len, off, UIO_SYSSPACE, IO_UNIT|IO_NODELOCKED,
data, len, off, UIO_SYSSPACE,
IO_ADV_ENCODE(POSIX_FADV_NOREUSE) | IO_NODELOCKED,
sc->sc_bs_lwp->l_cred, NULL, NULL);
if (error == 0) {
mutex_enter(sc->sc_bs_vp->v_interlock);
error = VOP_PUTPAGES(sc->sc_bs_vp, trunc_page(off),
round_page(off+len), PGO_CLEANIT|PGO_SYNCIO|PGO_FREE);
round_page(off+len), PGO_CLEANIT | PGO_FREE | PGO_SYNCIO);
}
VOP_UNLOCK(sc->sc_bs_vp);