no swplo
authorBill Joy <bill@ucbvax.Berkeley.EDU>
Wed, 25 Jun 1980 10:29:23 +0000 (02:29 -0800)
committerBill Joy <bill@ucbvax.Berkeley.EDU>
Wed, 25 Jun 1980 10:29:23 +0000 (02:29 -0800)
SCCS-vsn: sys/kern/kern_physio.c 3.8
SCCS-vsn: sys/kern/vfs_bio.c 3.8
SCCS-vsn: sys/kern/vfs_cluster.c 3.8
SCCS-vsn: sys/kern/kern_clock.c 3.12
SCCS-vsn: sys/vax/mba/hp.c 3.5
SCCS-vsn: sys/kern/init_main.c 3.6
SCCS-vsn: sys/kern/subr_rmap.c 3.3
SCCS-vsn: sys/kern/subr_rmap.c.sav 3.3
SCCS-vsn: sys/kern/kern_synch.c 3.12
SCCS-vsn: sys/kern/kern_proc.c 3.12
SCCS-vsn: sys/vax/uba/up.c 3.14

usr/src/sys/kern/init_main.c
usr/src/sys/kern/kern_clock.c
usr/src/sys/kern/kern_physio.c
usr/src/sys/kern/kern_proc.c
usr/src/sys/kern/kern_synch.c
usr/src/sys/kern/subr_rmap.c
usr/src/sys/kern/subr_rmap.c.sav
usr/src/sys/kern/vfs_bio.c
usr/src/sys/kern/vfs_cluster.c
usr/src/sys/vax/mba/hp.c
usr/src/sys/vax/uba/up.c

index 570b58a..78338a3 100644 (file)
@@ -1,4 +1,4 @@
-/*     init_main.c     3.5     %G%     */
+/*     init_main.c     3.6     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -179,6 +179,7 @@ binit()
        register struct buf *dp;
        register int i;
        struct bdevsw *bdp;
        register struct buf *dp;
        register int i;
        struct bdevsw *bdp;
+       struct swdevt *swp;
 
        bfreelist.b_forw = bfreelist.b_back =
            bfreelist.av_forw = bfreelist.av_back = &bfreelist;
 
        bfreelist.b_forw = bfreelist.b_back =
            bfreelist.av_forw = bfreelist.av_back = &bfreelist;
@@ -201,6 +202,19 @@ binit()
                }
                nblkdev++;
        }
                }
                nblkdev++;
        }
+       /*
+        * Count swap devices, and adjust total swap space available.
+        * Some of this space will not be available until a vswapon()
+        * system is issued, usually when the system goes multi-user.
+        */
+       nswdev = 0;
+       for (swp = swdevt; swp->sw_dev; swp++)
+               nswdev++;
+       if (nswdev == 0)
+               panic("binit");
+       nswap *= nswdev;
+       maxpgio *= nswdev;
+       swfree(0);
 }
 
 /*
 }
 
 /*
index 823b6df..158a9a8 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_clock.c    3.11    %G%     */
+/*     %H%     3.12    kern_clock.c    */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -46,7 +46,7 @@ caddr_t pc;
        register struct callo *p1, *p2;
        register struct proc *pp;
        register int s;
        register struct callo *p1, *p2;
        register struct proc *pp;
        register int s;
-       int a;
+       int a, cpstate;
 
        /*
         * reprime clock
 
        /*
         * reprime clock
@@ -125,19 +125,20 @@ out:
                if (s > u.u_vm.vm_maxrss)
                        u.u_vm.vm_maxrss = s;
        }
                if (s > u.u_vm.vm_maxrss)
                        u.u_vm.vm_maxrss = s;
        }
-       a = dk_busy&07;
        if (USERMODE(ps)) {
                u.u_vm.vm_utime++;
                if(u.u_procp->p_nice > NZERO)
        if (USERMODE(ps)) {
                u.u_vm.vm_utime++;
                if(u.u_procp->p_nice > NZERO)
-                       a += 8;
+                       cpstate = CP_NICE;
+               else
+                       cpstate = CP_USER;
        } else {
        } else {
-               a += 16;
+               cpstate = CP_SYS;
                if (noproc)
                if (noproc)
-                       a += 8;
+                       cpstate = CP_IDLE;
                else
                        u.u_vm.vm_stime++;
        }
                else
                        u.u_vm.vm_stime++;
        }
-       dk_time[a]++;
+       dk_time[cpstate][dk_busy&(DK_NSTATES-1)]++;
        if (!noproc) {
                pp = u.u_procp;
                if(++pp->p_cpu == 0)
        if (!noproc) {
                pp = u.u_procp;
                if(++pp->p_cpu == 0)
index 7c6a73d..83f411a 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_physio.c   3.7     %G%     */
+/*     kern_physio.c   3.8     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -584,8 +584,6 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
-               if (dev == swapdev)
-                       bp->b_blkno += swplo;
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
index 22a7a27..156351a 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_proc.c     3.11    %G%     */
+/*     kern_proc.c     3.12    %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -61,7 +61,7 @@ exece()
        ne = 0;
        nc = 0;
        uap = (struct execa *)u.u_ap;
        ne = 0;
        nc = 0;
        uap = (struct execa *)u.u_ap;
-       if ((bno = malloc(swapmap, ctod(clrnd((int) btoc(NCARGS))))) == 0) {
+       if ((bno = malloc(argmap, ctod(clrnd((int) btoc(NCARGS))))) == 0) {
                swkill(u.u_procp, "exece");
                goto bad;
        }
                swkill(u.u_procp, "exece");
                goto bad;
        }
@@ -99,8 +99,8 @@ exece()
                        if ((nc&BMASK) == 0) {
                                if (bp)
                                        bdwrite(bp);
                        if ((nc&BMASK) == 0) {
                                if (bp)
                                        bdwrite(bp);
-                               bp = getblk(swapdev,
-                                   (daddr_t)(dbtofsb(swplo+bno)+(nc>>BSHIFT)));
+                               bp = getblk(argdev,
+                                   (daddr_t)(dbtofsb(bno)+(nc>>BSHIFT)));
                                cp = bp->b_un.b_addr;
                        }
                        nc++;
                                cp = bp->b_un.b_addr;
                        }
                        nc++;
@@ -114,7 +114,7 @@ exece()
        if (getxfile(ip, nc) || u.u_error) {
 badarg:
                for (c = 0; c < nc; c += BSIZE)
        if (getxfile(ip, nc) || u.u_error) {
 badarg:
                for (c = 0; c < nc; c += BSIZE)
-                       if (bp = baddr(swapdev, dbtofsb(swplo+bno)+(c>>BSHIFT))) {
+                       if (bp = baddr(argdev, dbtofsb(bno)+(c>>BSHIFT))) {
                                bp->b_flags |= B_AGE;           /* throw away */
                                bp->b_flags &= ~B_DELWRI;       /* cancel io */
                                brelse(bp);
                                bp->b_flags |= B_AGE;           /* throw away */
                                bp->b_flags &= ~B_DELWRI;       /* cancel io */
                                brelse(bp);
@@ -145,8 +145,8 @@ badarg:
                        if ((nc&BMASK) == 0) {
                                if (bp)
                                        brelse(bp);
                        if ((nc&BMASK) == 0) {
                                if (bp)
                                        brelse(bp);
-                               bp = bread(swapdev,
-                                   (daddr_t)(dbtofsb(swplo+bno)+(nc>>BSHIFT)));
+                               bp = bread(argdev,
+                                   (daddr_t)(dbtofsb(bno)+(nc>>BSHIFT)));
                                bp->b_flags |= B_AGE;           /* throw away */
                                bp->b_flags &= ~B_DELWRI;       /* cancel io */
                                cp = bp->b_un.b_addr;
                                bp->b_flags |= B_AGE;           /* throw away */
                                bp->b_flags &= ~B_DELWRI;       /* cancel io */
                                cp = bp->b_un.b_addr;
@@ -162,7 +162,7 @@ bad:
        if (bp)
                brelse(bp);
        if (bno)
        if (bp)
                brelse(bp);
        if (bno)
-               mfree(swapmap, ctod(clrnd((int) btoc(NCARGS))), bno);
+               mfree(argmap, ctod(clrnd((int) btoc(NCARGS))), bno);
        iput(ip);
 }
 
        iput(ip);
 }
 
@@ -439,7 +439,6 @@ exit(rv)
        else
                p->p_siga1 = 0;
        (void) spl0();
        else
                p->p_siga1 = 0;
        (void) spl0();
-       rate.v_pgin -= p->p_aveflt;
        p->p_aveflt = 0;
        for(i=0; i<NSIG; i++)
                u.u_signal[i] = SIG_IGN;
        p->p_aveflt = 0;
        for(i=0; i<NSIG; i++)
                u.u_signal[i] = SIG_IGN;
@@ -472,7 +471,8 @@ exit(rv)
        vrelpt(u.u_procp);
        vrelu(u.u_procp, 0);
        multprog--;
        vrelpt(u.u_procp);
        vrelu(u.u_procp, 0);
        multprog--;
-       spl7();                 /* clock will get mad because of overlaying */
+/*     spl7();                 /* clock will get mad because of overlaying */
+       noproc = 1;
        p->p_stat = SZOMB;
        i = PIDHASH(p->p_pid);
        x = p - proc;
        p->p_stat = SZOMB;
        i = PIDHASH(p->p_pid);
        x = p - proc;
@@ -514,9 +514,7 @@ done:
                         * Protect this process from future
                         * tty signals, and clear TSTP/TTIN/TTOU if pending.
                         */
                         * Protect this process from future
                         * tty signals, and clear TSTP/TTIN/TTOU if pending.
                         */
-                       q->p_pgrp = q->p_pid;
-#define        bit(a)  (1<<(a-1))
-                       q->p_sig &= ~(bit(SIGTSTP)|bit(SIGTTIN)|bit(SIGTTOU));
+                       spgrp(q, -1);
                }
        wakeup((caddr_t)p->p_pptr);
        psignal(p->p_pptr, SIGCHLD);
                }
        wakeup((caddr_t)p->p_pptr);
        psignal(p->p_pptr, SIGCHLD);
index 83d5df3..99fd57f 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_synch.c    3.11    %G%     */
+/*     kern_synch.c    3.12    %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -343,7 +343,6 @@ retry:
        rpp->p_wchan = 0;
        rpp->p_slptime = 0;
        rpp->p_aveflt = rip->p_aveflt;
        rpp->p_wchan = 0;
        rpp->p_slptime = 0;
        rpp->p_aveflt = rip->p_aveflt;
-       rate.v_pgin += rip->p_aveflt;
        rpp->p_faults = 0;
        n = PIDHASH(rpp->p_pid);
        p->p_idhash = pidhash[n];
        rpp->p_faults = 0;
        n = PIDHASH(rpp->p_pid);
        p->p_idhash = pidhash[n];
index ce05a93..213149b 100644 (file)
@@ -1,4 +1,4 @@
-/*     subr_rmap.c     3.2     %G%     */
+/*     subr_rmap.c     3.3     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -23,11 +23,23 @@ struct map *mp;
 {
        register int a;
        register struct map *bp;
 {
        register int a;
        register struct map *bp;
+       swblk_t first, rest;
 
 
-       if (size <= 0)
+       if (size <= 0 || mp == swapmap && size > DMMAX)
                panic("malloc");
        for (bp=mp; bp->m_size; bp++) {
                if (bp->m_size >= size) {
                panic("malloc");
        for (bp=mp; bp->m_size; bp++) {
                if (bp->m_size >= size) {
+                       if (mp == swapmap &&
+                           (first = DMMAX - bp->m_addr%DMMAX) < bp->m_size) {
+                               if (bp->m_size - first < size)
+                                       continue;
+                               a = bp->m_addr + first;
+                               rest = bp->m_size - first - size;
+                               bp->m_size = first;
+                               if (rest)
+                                       mfree(swapmap, rest, a+size);
+                               return (a);
+                       }
                        a = bp->m_addr;
                        bp->m_addr += size;
                        if ((bp->m_size -= size) == 0) {
                        a = bp->m_addr;
                        bp->m_addr += size;
                        if ((bp->m_size -= size) == 0) {
index a849373..52e646a 100644 (file)
@@ -1,4 +1,4 @@
-/*     subr_rmap.c.sav 3.2     %G%     */
+/*     subr_rmap.c.sav 3.3     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -23,11 +23,23 @@ struct map *mp;
 {
        register int a;
        register struct map *bp;
 {
        register int a;
        register struct map *bp;
+       swblk_t first, rest;
 
 
-       if (size <= 0)
+       if (size <= 0 || mp == swapmap && size > DMMAX)
                panic("malloc");
        for (bp=mp; bp->m_size; bp++) {
                if (bp->m_size >= size) {
                panic("malloc");
        for (bp=mp; bp->m_size; bp++) {
                if (bp->m_size >= size) {
+                       if (mp == swapmap &&
+                           (first = DMMAX - bp->m_addr%DMMAX) < bp->m_size) {
+                               if (bp->m_size - first < size)
+                                       continue;
+                               a = bp->m_addr + first;
+                               rest = bp->m_size - first - size;
+                               bp->m_size = first;
+                               if (rest)
+                                       mfree(swapmap, rest, a+size);
+                               return (a);
+                       }
                        a = bp->m_addr;
                        bp->m_addr += size;
                        if ((bp->m_size -= size) == 0) {
                        a = bp->m_addr;
                        bp->m_addr += size;
                        if ((bp->m_size -= size) == 0) {
index 7e8b951..19b0961 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_bio.c       3.7     %G%     */
+/*     vfs_bio.c       3.8     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -584,8 +584,6 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
-               if (dev == swapdev)
-                       bp->b_blkno += swplo;
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
index 005cbec..91a2463 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_cluster.c   3.7     %G%     */
+/*     vfs_cluster.c   3.8     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -584,8 +584,6 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
                bp->b_bcount = c;
                bp->b_blkno = dblkno;
                bp->b_dev = dev;
-               if (dev == swapdev)
-                       bp->b_blkno += swplo;
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
                (*bdevsw[major(dev)].d_strategy)(bp);
                if (flag & B_DIRTY) {
                        if (c < nbytes)
index ece66f8..8e999b8 100644 (file)
@@ -1,4 +1,4 @@
-/*     hp.c    3.4     %G%     */
+/*     hp.c    3.5     %G%     */
 
 /*
  * RP04/RP06/RM03 disk driver
 
 /*
  * RP04/RP06/RM03 disk driver
@@ -6,6 +6,7 @@
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
+#include "../h/dk.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
@@ -45,8 +46,13 @@ struct       device
 #define        NTRAC   19
 #define        NRMSECT 32
 #define        NRMTRAC 5
 #define        NTRAC   19
 #define        NRMSECT 32
 #define        NRMTRAC 5
-#define        SDIST   2
-#define        RDIST   6
+
+#define        _hpSDIST        3
+#define        _hpRDIST        6
+
+int    hpSDIST = _hpSDIST;
+int    hpRDIST = _hpRDIST;
+int    hpseek;
 
 struct size
 {
 
 struct size
 {
@@ -104,6 +110,7 @@ char        hp_type[NHP];   /* drive type */
 #define        PRESET  020
 #define        RTC     016
 #define        OFFSET  014
 #define        PRESET  020
 #define        RTC     016
 #define        OFFSET  014
+#define        SEEK    04
 #define        SEARCH  030
 #define        RECAL   06
 #define        DCLR    010
 #define        SEARCH  030
 #define        RECAL   06
 #define        DCLR    010
@@ -208,24 +215,30 @@ register unit;
        cn = bp->b_cylin;
        if(hp_type[unit] == RM) {
                sn = bn%(NRMSECT*NRMTRAC);
        cn = bp->b_cylin;
        if(hp_type[unit] == RM) {
                sn = bn%(NRMSECT*NRMTRAC);
-               sn = (sn+NRMSECT-SDIST)%NRMSECT;
+               sn = (sn+NRMSECT-hpSDIST)%NRMSECT;
        } else {
                sn = bn%(NSECT*NTRAC);
        } else {
                sn = bn%(NSECT*NTRAC);
-               sn = (sn+NSECT-SDIST)%NSECT;
+               sn = (sn+NSECT-hpSDIST)%NSECT;
        }
 
        if(cn - (hpaddr->hpdc & 0xffff))
                goto search;
        }
 
        if(cn - (hpaddr->hpdc & 0xffff))
                goto search;
-       csn = ((hpaddr->hpla & 0xffff)>>6) - sn + SDIST - 1;
+       else if (hpseek)
+               goto done;
+       csn = ((hpaddr->hpla & 0xffff)>>6) - sn + 1;
        if(csn < 0)
                csn += NSECT;
        if(csn < 0)
                csn += NSECT;
-       if(csn > NSECT-RDIST)
+       if(csn > NSECT-hpRDIST)
                goto done;
 
 search:
        hpaddr->hpdc = cn;
                goto done;
 
 search:
        hpaddr->hpdc = cn;
-       hpaddr->hpda = sn;
-       hpaddr->hpcs1 = SEARCH|GO;
+       if (hpseek)
+               hpaddr->hpcs1 = SEEK|GO;
+       else {
+               hpaddr->hpda = sn;
+               hpaddr->hpcs1 = SEARCH|GO;
+       }
 /*
        unit += DK_N;
        dk_busy |= 1<<unit;
 /*
        unit += DK_N;
        dk_busy |= 1<<unit;
index e51c212..53bf735 100644 (file)
@@ -1,6 +1,6 @@
-/*     %H%     3.13    %G%     */
+/*     %H%     3.14    %G%     */
 
 
-#define        spl5    spl6
+#define        spl5    spl6            /* block clock, for delay loop's sake */
 /*
  * Emulex UNIBUS disk driver with overlapped seeks and ECC recovery.
  *
 /*
  * Emulex UNIBUS disk driver with overlapped seeks and ECC recovery.
  *
  * but we have previously experienced problems with it set this way.
  * We intend to try this again in the near future.
  *
  * but we have previously experienced problems with it set this way.
  * We intend to try this again in the near future.
  *
- *     wnj     June 14, 1980
+ * NB: OUR SYSTEM CURRENTLY GETS UBA ERRORS WHEN RUNNING THIS DRIVER
+ *     AND THE BUS OCCASIONALLY HANGS, NECESSITATING THE DEVIE RESET
+ *     CODE WHICH RE-INITS THE UNIBUS.  YECHHH.
  */
 
 #include "../h/param.h"
 #include "../h/systm.h"
  */
 
 #include "../h/param.h"
 #include "../h/systm.h"
+#include "../h/dk.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
@@ -54,8 +57,8 @@
  * If DK_N+NUP > DK_NMAX, then transfer stats are divided per drive.
  * If DK_NMAX is yet smaller, some drives are not monitored.
  */
  * If DK_N+NUP > DK_NMAX, then transfer stats are divided per drive.
  * If DK_NMAX is yet smaller, some drives are not monitored.
  */
-#define        DK_N    1
-#define        DK_NMAX 2
+#define        DK_N    2
+#define        DK_NMAX 3
 
 #define        ushort  unsigned short
 
 
 #define        ushort  unsigned short
 
@@ -106,21 +109,18 @@ int       upseek;
 /*
  * Constants controlling on-cylinder SEARCH usage.
  *
 /*
  * Constants controlling on-cylinder SEARCH usage.
  *
- *     SDIST/2 msec            time needed to start transfer
- *     IDIST/2 msec            slop for interrupt latency
- *     RDIST/2 msec            tolerable rotational latency when on-cylinder
+ *     upSDIST/2 msec          time needed to start transfer
+ *     upRDIST/2 msec          tolerable rotational latency when on-cylinder
  *
  *
- * If we are no closer than SDIST sectors and no further than SDIST+RDIST
+ * If we are no closer than upSDIST sectors and no further than upSDIST+upRDIST
  * and in the driver then we take it as it is.  Otherwise we do a SEARCH
  * and in the driver then we take it as it is.  Otherwise we do a SEARCH
- * requesting an interrupt SDIST+IDIST sectors in advance.
+ * requesting an interrupt upSDIST sectors in advance.
  */
  */
-#define        _SDIST  6               /* 3.0 msec */
-#define        _RDIST  6               /* 2.5 msec */
-#define        _IDIST  1               /* 0.5 msec */
+#define        _upSDIST        6               /* 3.0 msec */
+#define        _upRDIST        6               /* 3.0 msec */
 
 
-int    SDIST = _SDIST;
-int    RDIST = _RDIST;
-int    IDIST = _IDIST;
+int    upSDIST = _upSDIST;
+int    upRDIST = _upRDIST;
 
 /*
  * To fill a 300M drive:
 
 /*
  * To fill a 300M drive:
@@ -363,14 +363,14 @@ register unit;
         * Do enough of the disk address decoding to determine
         * which cylinder and sector the request is on.
         * If we are on the correct cylinder and the desired sector
         * Do enough of the disk address decoding to determine
         * which cylinder and sector the request is on.
         * If we are on the correct cylinder and the desired sector
-        * lies between SDIST and SDIST+RDIST sectors ahead of us, then
+        * lies between upSDIST and upSDIST+upRDIST sectors ahead of us, then
         * we don't bother to SEARCH but just begin the transfer asap.
         * we don't bother to SEARCH but just begin the transfer asap.
-        * Otherwise ask for a interrupt SDIST+IDIST sectors ahead.
+        * Otherwise ask for a interrupt upSDIST sectors ahead.
         */
        bn = dkblock(bp);
        cn = bp->b_cylin;
        sn = bn%(NSECT*NTRAC);
         */
        bn = dkblock(bp);
        cn = bp->b_cylin;
        sn = bn%(NSECT*NTRAC);
-       sn = (sn+NSECT-SDIST)%NSECT;
+       sn = (sn+NSECT-upSDIST)%NSECT;
 
        if (cn - upaddr->updc)
                goto search;            /* Not on-cylinder */
 
        if (cn - upaddr->updc)
                goto search;            /* Not on-cylinder */
@@ -379,7 +379,7 @@ register unit;
        csn = (upaddr->upla>>6) - sn - 1;
        if (csn < 0)
                csn += NSECT;
        csn = (upaddr->upla>>6) - sn - 1;
        if (csn < 0)
                csn += NSECT;
-       if (csn > NSECT-RDIST)
+       if (csn > NSECT-upRDIST)
                goto done;
 
 search:
                goto done;
 
 search: