Correct use of MAXBSIZE where MAXPHYS was intended. This is a necessary

first step towards per-device MAXPHYS, and has the beneficial side effect
of allowing clustering to MAXPHYS even on systems that need to run with
a reduced MAXBSIZE to get more metadata buffers.
This commit is contained in:
tls 2003-04-23 00:55:17 +00:00
parent 7064ed78f9
commit 85c8cfb533
7 changed files with 27 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic7xxx.c,v 1.102 2003/04/21 22:00:42 fvdl Exp $ */ /* $NetBSD: aic7xxx.c,v 1.103 2003/04/23 00:55:17 tls Exp $ */
/* /*
* Core routines and tables shareable across OS platforms. * Core routines and tables shareable across OS platforms.
@ -39,7 +39,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: aic7xxx.c,v 1.102 2003/04/21 22:00:42 fvdl Exp $ * $Id: aic7xxx.c,v 1.103 2003/04/23 00:55:17 tls Exp $
* *
* //depot/aic7xxx/aic7xxx/aic7xxx.c#112 $ * //depot/aic7xxx/aic7xxx/aic7xxx.c#112 $
* *
@ -4359,7 +4359,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc)
next_scb->flags = SCB_FREE; next_scb->flags = SCB_FREE;
error = bus_dmamap_create(ahc->parent_dmat, error = bus_dmamap_create(ahc->parent_dmat,
AHC_MAXTRANSFER_SIZE, AHC_NSEG, MAXBSIZE, 0, AHC_MAXTRANSFER_SIZE, AHC_NSEG, MAXPHYS, 0,
BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW,
&next_scb->dmamap); &next_scb->dmamap);
if (error != 0) if (error != 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpt_netbsd.c,v 1.4 2003/04/16 23:17:30 thorpej Exp $ */ /* $NetBSD: mpt_netbsd.c,v 1.5 2003/04/23 00:55:19 tls Exp $ */
/* /*
* Copyright (c) 2003 Wasabi Systems, Inc. * Copyright (c) 2003 Wasabi Systems, Inc.
@ -246,8 +246,8 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
req->sense_pbuf = (pptr - MPT_SENSE_SIZE); req->sense_pbuf = (pptr - MPT_SENSE_SIZE);
req->sense_vbuf = (vptr - MPT_SENSE_SIZE); req->sense_vbuf = (vptr - MPT_SENSE_SIZE);
error = bus_dmamap_create(mpt->sc_dmat, MAXBSIZE, error = bus_dmamap_create(mpt->sc_dmat, MAXPHYS,
MPT_SGL_MAX, MAXBSIZE, 0, 0, &req->dmap); MPT_SGL_MAX, MAXPHYS, 0, 0, &req->dmap);
if (error) { if (error) {
aprint_error("%s: unable to create req %d DMA map, " aprint_error("%s: unable to create req %d DMA map, "
"error = %d\n", mpt->sc_dev.dv_xname, i, error); "error = %d\n", mpt->sc_dev.dv_xname, i, error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfs_vnops.c,v 1.75 2003/04/10 21:53:33 jdolecek Exp $ */ /* $NetBSD: genfs_vnops.c,v 1.76 2003/04/23 00:55:19 tls Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1993 * Copyright (c) 1982, 1986, 1989, 1993
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.75 2003/04/10 21:53:33 jdolecek Exp $"); __KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.76 2003/04/23 00:55:19 tls Exp $");
#include "opt_nfsserver.h" #include "opt_nfsserver.h"
@ -1035,7 +1035,8 @@ genfs_putpages(void *v)
off_t endoff = ap->a_offhi; off_t endoff = ap->a_offhi;
off_t off; off_t off;
int flags = ap->a_flags; int flags = ap->a_flags;
const int maxpages = MAXBSIZE >> PAGE_SHIFT; /* Even for strange MAXPHYS, the shift rounds down to a page */
const int maxpages = MAXPHYS >> PAGE_SHIFT;
int i, s, error, npages, nback; int i, s, error, npages, nback;
int freeflag; int freeflag;
struct vm_page *pgs[maxpages], *pg, *nextpg, *tpg, curmp, endmp; struct vm_page *pgs[maxpages], *pg, *nextpg, *tpg, curmp, endmp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_bmap.c,v 1.21 2003/04/02 10:39:44 fvdl Exp $ */ /* $NetBSD: ufs_bmap.c,v 1.22 2003/04/23 00:55:21 tls Exp $ */
/* /*
* Copyright (c) 1989, 1991, 1993 * Copyright (c) 1989, 1991, 1993
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.21 2003/04/02 10:39:44 fvdl Exp $"); __KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.22 2003/04/23 00:55:21 tls Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -136,7 +136,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
* don't create a block larger than the device can handle. * don't create a block larger than the device can handle.
*/ */
*runp = 0; *runp = 0;
maxrun = MAXBSIZE / mp->mnt_stat.f_iosize - 1; maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1;
} }
if (bn >= 0 && bn < NDADDR) { if (bn >= 0 && bn < NDADDR) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_io.c,v 1.17 2001/11/10 07:37:00 lukem Exp $ */ /* $NetBSD: uvm_io.c,v 1.18 2003/04/23 00:55:21 tls Exp $ */
/* /*
* *
@ -39,7 +39,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.17 2001/11/10 07:37:00 lukem Exp $"); __KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.18 2003/04/23 00:55:21 tls Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -94,7 +94,7 @@ uvm_io(map, uio)
togo = togo - (endva - VM_MAXUSER_ADDRESS + 1); togo = togo - (endva - VM_MAXUSER_ADDRESS + 1);
pageoffset = baseva & PAGE_MASK; pageoffset = baseva & PAGE_MASK;
baseva = trunc_page(baseva); baseva = trunc_page(baseva);
chunksz = MIN(round_page(togo + pageoffset), MAXBSIZE); chunksz = MIN(round_page(togo + pageoffset), trunc_page(MAXPHYS));
error = 0; error = 0;
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pager.c,v 1.59 2002/11/09 20:09:52 thorpej Exp $ */ /* $NetBSD: uvm_pager.c,v 1.60 2003/04/23 00:55:22 tls Exp $ */
/* /*
* *
@ -39,7 +39,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.59 2002/11/09 20:09:52 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.60 2003/04/23 00:55:22 tls Exp $");
#include "opt_uvmhist.h" #include "opt_uvmhist.h"
@ -95,7 +95,7 @@ uvm_pager_init()
FALSE, NULL); FALSE, NULL);
simple_lock_init(&pager_map_wanted_lock); simple_lock_init(&pager_map_wanted_lock);
pager_map_wanted = FALSE; pager_map_wanted = FALSE;
emergva = uvm_km_valloc(kernel_map, MAXBSIZE); emergva = uvm_km_valloc(kernel_map, round_page(MAXPHYS));
emerginuse = FALSE; emerginuse = FALSE;
/* /*
@ -162,7 +162,8 @@ ReStart:
emerginuse = TRUE; emerginuse = TRUE;
simple_unlock(&pager_map_wanted_lock); simple_unlock(&pager_map_wanted_lock);
kva = emergva; kva = emergva;
KASSERT(npages <= MAXBSIZE >> PAGE_SHIFT); /* The shift implicitly truncates to PAGE_SIZE */
KASSERT(npages <= (MAXPHYS >> PAGE_SHIFT));
goto enter; goto enter;
} }
if ((flags & UVMPAGER_MAPIN_WAITOK) == 0) { if ((flags & UVMPAGER_MAPIN_WAITOK) == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pdaemon.c,v 1.50 2003/02/25 00:22:20 simonb Exp $ */ /* $NetBSD: uvm_pdaemon.c,v 1.51 2003/04/23 00:55:22 tls Exp $ */
/* /*
* Copyright (c) 1997 Charles D. Cranor and Washington University. * Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.50 2003/02/25 00:22:20 simonb Exp $"); __KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.51 2003/04/23 00:55:22 tls Exp $");
#include "opt_uvmhist.h" #include "opt_uvmhist.h"
@ -362,7 +362,7 @@ uvmpd_scan_inactive(pglst)
struct vm_page *p, *nextpg = NULL; /* Quell compiler warning */ struct vm_page *p, *nextpg = NULL; /* Quell compiler warning */
struct uvm_object *uobj; struct uvm_object *uobj;
struct vm_anon *anon; struct vm_anon *anon;
struct vm_page *swpps[MAXBSIZE >> PAGE_SHIFT]; struct vm_page *swpps[round_page(MAXPHYS) >> PAGE_SHIFT];
struct simplelock *slock; struct simplelock *slock;
int swnpages, swcpages; int swnpages, swcpages;
int swslot; int swslot;
@ -621,7 +621,9 @@ uvmpd_scan_inactive(pglst)
*/ */
if (swslot == 0) { if (swslot == 0) {
swnpages = MAXBSIZE >> PAGE_SHIFT; /* Even with strange MAXPHYS, the shift
implicitly rounds down to a page. */
swnpages = MAXPHYS >> PAGE_SHIFT;
swslot = uvm_swap_alloc(&swnpages, TRUE); swslot = uvm_swap_alloc(&swnpages, TRUE);
if (swslot == 0) { if (swslot == 0) {
simple_unlock(slock); simple_unlock(slock);