From f7bd3a011999d93143c1e82e485e5a9f5addeeab Mon Sep 17 00:00:00 2001 From: jonathan Date: Sat, 21 Feb 1998 20:20:55 +0000 Subject: [PATCH] Move existing contextsw-avoidance code in rzdump() earlier, since rzready() also calls biowait(). Some drives seek to modepage on every modepage geometry-sense in rzready() cache dev_t of last readied device in rzdump() to elide rzready() calls. 2x speedup of dumps on rz25 and 20x-30x speedup on some IBM OEM 4gig drives. --- sys/arch/pmax/dev/rz.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/sys/arch/pmax/dev/rz.c b/sys/arch/pmax/dev/rz.c index 911136d3ce8d..a6a1b60b5f3d 100644 --- a/sys/arch/pmax/dev/rz.c +++ b/sys/arch/pmax/dev/rz.c @@ -1,4 +1,4 @@ -/* $NetBSD: rz.c,v 1.34 1998/02/19 23:04:41 thorpej Exp $ */ +/* $NetBSD: rz.c,v 1.35 1998/02/21 20:20:55 jonathan Exp $ */ /* * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: rz.c,v 1.34 1998/02/19 23:04:41 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rz.c,v 1.35 1998/02/21 20:20:55 jonathan Exp $"); /* * SCSI CCS (Command Command Set) disk driver. @@ -1636,6 +1636,7 @@ rzdump(dev, blkno, va, size) size_t size; { static int rzdoingadump;/* mutex */ + static dev_t rzreadydev = NODEV; /* hint: device already rzready()ed */ int sectorsize; /* size of a disk sector */ int nsects; /* number of sectors in partition */ int sectoff; /* sector offset of partition */ @@ -1661,9 +1662,23 @@ rzdump(dev, blkno, va, size) if ((sc->sc_flags & RZF_ALIVE) == 0) return (ENXIO); - if (rzready(sc) == 0) { - /* Drive didn't reset. */ - return (ENXIO); + /* + * XXX Prevent the tsleep() calls in biowait() in rzready() + * XXX or later here from performing a switch. + */ + cold = 1; + + /* + * Ready drive. rzready() does geometry-sense. Cache dev_t of + * last rzready()ed device to avoid seeks to modepage. + */ + if (rzreadydev != dev) { + if (rzready(sc) == 0) { + /* Drive didn't reset. */ + rzreadydev = NODEV; + return (ENXIO); + } + rzreadydev = dev; } /* @@ -1686,12 +1701,6 @@ rzdump(dev, blkno, va, size) /* Offset block number to start of partition. */ blkno += sectoff; - /* - * XXX Prevent the tsleep() done in biowait() below - * XXX from performing a switch. - */ - cold = 1; - while (totwrt > 0) { nwrt = totwrt; /* XXX */ #ifndef RZ_DUMP_NOT_TRUSTED