Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Fix a bug in disksort_*() which caused non-optimal order...



details:   https://anonhg.NetBSD.org/src/rev/f2c3bc07e23b
branches:  trunk
changeset: 481847:f2c3bc07e23b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Feb 07 20:16:47 2000 +0000

description:
Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle.  Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.

diffstat:

 sys/arch/alpha/isa/fd.c       |   3 +-
 sys/arch/amiga/dev/fd.c       |   4 ++-
 sys/arch/arc/dev/fd.c         |   3 +-
 sys/arch/arm32/mainbus/fd.c   |   3 +-
 sys/arch/atari/dev/fd.c       |   5 +++-
 sys/arch/atari/dev/hdfd.c     |   3 +-
 sys/arch/bebox/isa/fd.c       |   3 +-
 sys/arch/hp300/dev/rd.c       |   8 +++---
 sys/arch/hp300/dev/sd.c       |  12 +++++-----
 sys/arch/i386/isa/fd.c        |   3 +-
 sys/arch/mac68k/obio/iwm_fd.c |   3 +-
 sys/arch/pmax/dev/rz.c        |  12 +++++-----
 sys/arch/sparc/dev/fd.c       |   3 +-
 sys/arch/sparc64/dev/fd.c     |   3 +-
 sys/arch/sun3/dev/fd.c        |   3 +-
 sys/arch/sun3/dev/xy.c        |  24 +++++++++++++++-----
 sys/arch/vax/mba/hp.c         |  15 +++++++++---
 sys/arch/vax/vax/ctu.c        |   3 +-
 sys/arch/x68k/dev/fd.c        |   3 +-
 sys/dev/ata/wd.c              |  34 +++++++++++++++++++---------
 sys/dev/isa/mcd.c             |  25 +++++++++++++-------
 sys/dev/scsipi/cd.c           |  43 +++++++++++++++++++++---------------
 sys/dev/scsipi/sd.c           |  50 ++++++++++++++++++++++++------------------
 sys/dev/vme/xy.c              |  26 ++++++++++++++++------
 sys/dev/vnd.c                 |   4 +-
 sys/kern/subr_disk.c          |  21 +++++++++--------
 sys/kern/vfs_bio.c            |   6 ++--
 sys/sys/buf.h                 |   7 ++++-
 sys/uvm/uvm_swap.c            |   3 +-
 29 files changed, 211 insertions(+), 124 deletions(-)

diffs (truncated from 1086 to 300 lines):

diff -r 5672107632ce -r f2c3bc07e23b sys/arch/alpha/isa/fd.c
--- a/sys/arch/alpha/isa/fd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/alpha/isa/fd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.6 2000/01/21 23:28:59 thorpej Exp $   */
+/*     $NetBSD: fd.c,v 1.7 2000/02/07 20:16:47 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -626,6 +626,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
+       bp->b_rawblkno = bp->b_blkno;
        bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/amiga/dev/fd.c
--- a/sys/arch/amiga/dev/fd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/amiga/dev/fd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.42 2000/01/21 23:29:00 thorpej Exp $  */
+/*     $NetBSD: fd.c,v 1.43 2000/02/07 20:16:48 thorpej Exp $  */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -689,6 +689,8 @@
        if (bp->b_bcount == 0)
                goto done;
 
+       bp->b_rawblkno = bp->b_blkno;
+
        /*
         * queue the buf and kick the low level code
         */
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/arc/dev/fd.c
--- a/sys/arch/arc/dev/fd.c     Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/arc/dev/fd.c     Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.15 2000/01/23 21:01:54 soda Exp $     */
+/*     $NetBSD: fd.c,v 1.16 2000/02/07 20:16:49 thorpej Exp $  */
 /*     $OpenBSD: fd.c,v 1.5 1997/04/19 17:19:52 pefo Exp $     */
 /*     NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp     */
 
@@ -495,6 +495,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
+       bp->b_rawblkno = bp->b_blkno;
        bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/arm32/mainbus/fd.c
--- a/sys/arch/arm32/mainbus/fd.c       Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/arm32/mainbus/fd.c       Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.26 2000/01/21 23:29:01 thorpej Exp $  */
+/*     $NetBSD: fd.c,v 1.27 2000/02/07 20:16:49 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -621,6 +621,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
+       bp->b_rawblkno = bp->b_blkno;
        bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/atari/dev/fd.c
--- a/sys/arch/atari/dev/fd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/atari/dev/fd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.31 2000/01/21 23:29:01 thorpej Exp $  */
+/*     $NetBSD: fd.c,v 1.32 2000/02/07 20:16:50 thorpej Exp $  */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -613,6 +613,9 @@
                else bp->b_bcount = sz * lp->d_secsize;
        }
 
+       /* No partition translation. */
+       bp->b_rawblkno = bp->b_blkno;
+
        /*
         * queue the buf and kick the low level code
         */
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/atari/dev/hdfd.c
--- a/sys/arch/atari/dev/hdfd.c Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/atari/dev/hdfd.c Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hdfd.c,v 1.18 2000/01/21 23:29:01 thorpej Exp $        */
+/*     $NetBSD: hdfd.c,v 1.19 2000/02/07 20:16:50 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1996 Leo Weppelman
@@ -583,6 +583,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
+       bp->b_rawblkno = bp->b_blkno;
        bp->b_cylinder = bp->b_blkno / (FDC_BSIZE/DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/bebox/isa/fd.c
--- a/sys/arch/bebox/isa/fd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/bebox/isa/fd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.9 2000/01/21 23:29:02 thorpej Exp $   */
+/*     $NetBSD: fd.c,v 1.10 2000/02/07 20:16:50 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -681,6 +681,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
+       bp->b_rawblkno = bp->b_blkno;
        bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/hp300/dev/rd.c
--- a/sys/arch/hp300/dev/rd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/hp300/dev/rd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rd.c,v 1.38 2000/01/31 19:04:52 kleink Exp $   */
+/*     $NetBSD: rd.c,v 1.39 2000/02/07 20:16:50 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -702,9 +702,9 @@
                        goto bad;
                }
        }
-       bp->b_cylinder = bn + offset;           /* XXX */
+       bp->b_rawblkno = bn + offset;
        s = splbio();
-       disksort_cylinder(&rs->sc_tab, bp);     /* XXX */
+       disksort_blkno(&rs->sc_tab, bp);
        if (rs->sc_active == 0) {
                rs->sc_active = 1;
                rdustart(rs);
@@ -786,7 +786,7 @@
        rs->sc_ioc.c_volume = C_SVOL(0);
        rs->sc_ioc.c_saddr = C_SADDR;
        rs->sc_ioc.c_hiaddr = 0;
-       rs->sc_ioc.c_addr = RDBTOS(bp->b_cylinder);     /* XXX */
+       rs->sc_ioc.c_addr = RDBTOS(bp->b_rawblkno);
        rs->sc_ioc.c_nop2 = C_NOP;
        rs->sc_ioc.c_slen = C_SLEN;
        rs->sc_ioc.c_len = rs->sc_resid;
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/hp300/dev/sd.c
--- a/sys/arch/hp300/dev/sd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/hp300/dev/sd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.38 2000/01/31 19:04:53 kleink Exp $   */
+/*     $NetBSD: sd.c,v 1.39 2000/02/07 20:16:51 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -716,7 +716,7 @@
                        bp->b_error = EPERM;
                        goto bad;
                }
-               bp->b_cylinder = 0;
+               bp->b_rawblkno = 0;
        } else {
                if (sc->sc_flags & SDF_ERROR) {
                        bp->b_error = EIO;
@@ -768,10 +768,10 @@
                        sdlblkstrat(bp, sc->sc_blksize);
                        goto done;
                }
-               bp->b_cylinder = (bn + offset) >> sc->sc_bshift; /* XXX */
+               bp->b_rawblkno = (bn + offset) >> sc->sc_bshift;
        }
        s = splbio();
-       disksort_cylinder(&sc->sc_tab, bp);     /* XXX */
+       disksort_blkno(&sc->sc_tab, bp);
        if (sc->sc_active == 0) {
                sc->sc_active = 1;
                sdustart(unit);
@@ -935,7 +935,7 @@
                        return;
                }
                cmd = bp->b_flags & B_READ? &sd_read_cmd : &sd_write_cmd;
-               *(int *)(&cmd->cdb[2]) = bp->b_cylinder;        /* XXX */
+               *(int *)(&cmd->cdb[2]) = bp->b_rawblkno;
                pad = howmany(bp->b_bcount, sc->sc_blksize);
                *(u_short *)(&cmd->cdb[7]) = pad;
                pad = (bp->b_bcount & (sc->sc_blksize - 1)) != 0;
@@ -961,7 +961,7 @@
                printf("%s: sdstart: %s adr %p blk %ld len %ld ecnt %ld\n",
                       sc->sc_dev.dv_xname,
                       bp->b_flags & B_READ? "read" : "write",
-                      bp->b_un.b_addr, bp->b_cylinder, bp->b_bcount,
+                      bp->b_un.b_addr, bp->b_rawblkno, bp->b_bcount,
                       sc->sc_errcnt);
 #endif
        bp->b_flags |= B_ERROR;
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/i386/isa/fd.c
--- a/sys/arch/i386/isa/fd.c    Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/i386/isa/fd.c    Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.129 2000/01/21 23:29:05 thorpej Exp $ */
+/*     $NetBSD: fd.c,v 1.130 2000/02/07 20:16:51 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -669,6 +669,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 
+       bp->b_rawblkno = bp->b_blkno;
        bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
 
 #ifdef FD_DEBUG
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/mac68k/obio/iwm_fd.c
--- a/sys/arch/mac68k/obio/iwm_fd.c     Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/mac68k/obio/iwm_fd.c     Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iwm_fd.c,v 1.5 2000/01/27 02:26:17 ender Exp $ */
+/*     $NetBSD: iwm_fd.c,v 1.6 2000/02/07 20:16:52 thorpej Exp $       */
 
 /*
  * Copyright (c) 1997, 1998 Hauke Fath.  All rights reserved.
@@ -1118,6 +1118,7 @@
                 */
                remap_geometry(bp->b_blkno, fd->currentType->heads,
                    &physDiskLoc);
+               bp->b_rawblkno = bp->b_blkno;
                bp->b_cylinder = physDiskLoc.track;
 
                if (TRACE_STRAT) {
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/pmax/dev/rz.c
--- a/sys/arch/pmax/dev/rz.c    Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/pmax/dev/rz.c    Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rz.c,v 1.55 2000/01/21 23:29:06 thorpej Exp $  */
+/*     $NetBSD: rz.c,v 1.56 2000/02/07 20:16:52 thorpej Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: rz.c,v 1.55 2000/01/21 23:29:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rz.c,v 1.56 2000/02/07 20:16:52 thorpej Exp $");
 
 /*
  * SCSI CCS (Command Command Set) disk driver.
@@ -671,7 +671,7 @@
                        bp->b_error = EPERM;
                        goto bad;
                }
-               bp->b_cylinder = 0;
+               bp->b_rawblkno = 0;
        } else {
                bn = bp->b_blkno;
                sz = howmany(bp->b_bcount, DEV_BSIZE);
@@ -711,13 +711,13 @@
                        rzlblkstrat(bp, sc->sc_blksize);
                        goto done;
                }
-               bp->b_cylinder = (bn + pp->p_offset) >> sc->sc_bshift; /* XXX */
+               bp->b_rawblkno = (bn + pp->p_offset) >> sc->sc_bshift;
        }
        /* don't let disksort() see sc_errbuf */
        while (sc->sc_flags & RZF_SENSEINPROGRESS)
                printf("SENSE\n"); /* XXX */
        s = splbio();
-       disksort_cylinder(&sc->sc_tab, bp);     /* XXX */
+       disksort_blkno(&sc->sc_tab, bp);
        if (sc->sc_active == 0) {
                sc->sc_active = 1;
                rzstart(unit);
@@ -757,7 +757,7 @@
                }
                sc->sc_cmd.cmd = (u_char *)&sc->sc_rwcmd;
                sc->sc_cmd.cmdlen = sizeof(sc->sc_rwcmd);
-               n = bp->b_cylinder;
+               n = bp->b_rawblkno;
                sc->sc_rwcmd.highAddr = n >> 24;
                sc->sc_rwcmd.midHighAddr = n >> 16;
                sc->sc_rwcmd.midLowAddr = n >> 8;
diff -r 5672107632ce -r f2c3bc07e23b sys/arch/sparc/dev/fd.c
--- a/sys/arch/sparc/dev/fd.c   Mon Feb 07 20:05:21 2000 +0000
+++ b/sys/arch/sparc/dev/fd.c   Mon Feb 07 20:16:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.76 2000/02/07 11:44:15 pk Exp $       */
+/*     $NetBSD: fd.c,v 1.77 2000/02/07 20:16:53 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -846,6 +846,7 @@
                bp->b_bcount = sz << DEV_BSHIFT;
        }
 



Home | Main Index | Thread Index | Old Index