Source-Changes-HG archive

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

[src/trunk]: src/sys Update for sys/buf.h/disksort_*() changes.



details:   https://anonhg.NetBSD.org/src/rev/4e6aef203ee0
branches:  trunk
changeset: 480862:4e6aef203ee0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Jan 21 23:43:10 2000 +0000

description:
Update for sys/buf.h/disksort_*() changes.

diffstat:

 sys/dev/vme/xy.c         |  16 +++++++---------
 sys/dev/vme/xyvar.h      |   4 ++--
 sys/sys/disklabel.h      |   8 ++++++--
 sys/ufs/mfs/mfs_vfsops.c |  14 +++++++-------
 sys/ufs/mfs/mfs_vnops.c  |  18 +++++++++---------
 sys/ufs/mfs/mfsnode.h    |   4 ++--
 sys/uvm/uvm_swap.c       |  19 ++++++++++---------
 7 files changed, 43 insertions(+), 40 deletions(-)

diffs (297 lines):

diff -r 3ac460645c99 -r 4e6aef203ee0 sys/dev/vme/xy.c
--- a/sys/dev/vme/xy.c  Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/dev/vme/xy.c  Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xy.c,v 1.14 1999/07/28 10:03:02 drochner Exp $ */
+/*     $NetBSD: xy.c,v 1.15 2000/01/21 23:43:10 thorpej Exp $  */
 
 /*
  *
@@ -553,9 +553,7 @@
 
                /* init queue of waiting bufs */
 
-               xy->xyq.b_active = 0;
-               xy->xyq.b_actf = 0;
-               xy->xyq.b_actb = &xy->xyq.b_actf; /* XXX b_actb: not used? */
+               BUFQ_INIT(&xy->xyq);
 
                xy->xyrq = &xyc->reqs[xa->driveno];
 
@@ -1095,7 +1093,7 @@
         */
        s = splbio();           /* protect the queues */
 
-       disksort(&xy->xyq, bp);
+       disksort_blkno(&xy->xyq, bp);   /* XXX disksort_cylinder */
 
        /* start 'em up */
 
@@ -1716,7 +1714,7 @@
                 
                            bus_dmamap_unload(xycsc->dmatag, iorq->dmamap);
 
-                           iorq->xy->xyq.b_actf = iorq->buf->b_actf;
+                           BUFQ_REMOVE(&iorq->xy->xyq, iorq->buf);
                            disk_unbusy(&xycsc->reqs[lcv].xy->sc_dk,
                                (xycsc->reqs[lcv].buf->b_bcount -
                                xycsc->reqs[lcv].buf->b_resid));
@@ -1762,9 +1760,9 @@
        if (iorq == NULL) {
                for (lcv = 0; lcv < XYC_MAXDEV ; lcv++) {
                        if ((xy = xycsc->sc_drives[lcv]) == NULL) continue;
-                       if (xy->xyq.b_actf == NULL) continue;
+                       if (BUFQ_FIRST(&xy->xyq) == NULL) continue;
                        if (xy->xyrq->mode != XY_SUB_FREE) continue;
-                       xyc_startbuf(xycsc, xy, xy->xyq.b_actf);
+                       xyc_startbuf(xycsc, xy, BUFQ_FIRST(&xy->xyq));
                }
        }
        xyc_submit_iorq(xycsc, iorq, XY_SUB_NOQ);
@@ -1899,7 +1897,7 @@
                 
                        bus_dmamap_unload(xycsc->dmatag, iorq->dmamap);
 
-                       iorq->xy->xyq.b_actf = bp->b_actf;
+                       BUFQ_REMOVE(&iorq->xy->xyq, bp);
                        disk_unbusy(&iorq->xy->sc_dk,
                            (bp->b_bcount - bp->b_resid));
                        iorq->mode = XY_SUB_FREE;
diff -r 3ac460645c99 -r 4e6aef203ee0 sys/dev/vme/xyvar.h
--- a/sys/dev/vme/xyvar.h       Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/dev/vme/xyvar.h       Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xyvar.h,v 1.4 1999/06/30 15:07:45 drochner Exp $       */
+/*     $NetBSD: xyvar.h,v 1.5 2000/01/21 23:43:10 thorpej Exp $        */
 
 /*
  *
@@ -111,7 +111,7 @@
        u_char nsect;           /* number of sectors per track */
        u_char hw_spt;          /* as above, but includes spare sectors */
        struct xy_iorq *xyrq;   /* this disk's ioreq structure */
-       struct buf xyq;         /* queue'd I/O requests */
+       struct buf_queue xyq;   /* queued I/O requests */
        struct dkbad dkb;       /* bad144 sectors */
 };
 
diff -r 3ac460645c99 -r 4e6aef203ee0 sys/sys/disklabel.h
--- a/sys/sys/disklabel.h       Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/sys/disklabel.h       Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.h,v 1.53 1999/09/21 03:08:18 enami Exp $     */
+/*     $NetBSD: disklabel.h,v 1.54 2000/01/21 23:43:10 thorpej Exp $   */
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -347,9 +347,13 @@
 };
 
 #ifdef _KERNEL
+struct buf_queue;
+
 void    diskerr
            __P((struct buf *, char *, char *, int, int, struct disklabel *));
-void    disksort __P((struct buf *, struct buf *));
+void    disksort_cylinder __P((struct buf_queue *, struct buf *));
+void    disksort_blkno __P((struct buf_queue *, struct buf *));
+void    disksort_tail __P((struct buf_queue *, struct buf *));
 u_int   dkcksum __P((struct disklabel *));
 int     setdisklabel __P((struct disklabel *, struct disklabel *, u_long,
            struct cpu_disklabel *));
diff -r 3ac460645c99 -r 4e6aef203ee0 sys/ufs/mfs/mfs_vfsops.c
--- a/sys/ufs/mfs/mfs_vfsops.c  Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/ufs/mfs/mfs_vfsops.c  Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mfs_vfsops.c,v 1.21 1999/07/17 01:08:30 wrstuden Exp $ */
+/*     $NetBSD: mfs_vfsops.c,v 1.22 2000/01/21 23:43:10 thorpej Exp $  */
 
 /*
  * Copyright (c) 1989, 1990, 1993, 1994
@@ -143,7 +143,7 @@
        mfsp->mfs_size = mfs_rootsize;
        mfsp->mfs_vnode = rootvp;
        mfsp->mfs_pid = p->p_pid;
-       mfsp->mfs_buflist = (struct buf *)0;
+       BUFQ_INIT(&mfsp->mfs_buflist);
        if ((error = ffs_mountfs(rootvp, mp, p)) != 0) {
                mp->mnt_op->vfs_refcount--;
                vfs_unbusy(mp);
@@ -246,9 +246,9 @@
        mfsp->mfs_size = args.size;
        mfsp->mfs_vnode = devvp;
        mfsp->mfs_pid = p->p_pid;
-       mfsp->mfs_buflist = (struct buf *)0;
+       BUFQ_INIT(&mfsp->mfs_buflist);
        if ((error = ffs_mountfs(devvp, mp, p)) != 0) {
-               mfsp->mfs_buflist = (struct buf *)-1;
+               BUFQ_FIRST(&mfsp->mfs_buflist) = (struct buf *) -1;
                vrele(devvp);
                return (error);
        }
@@ -287,7 +287,7 @@
        int sleepreturn = 0;
 
        base = mfsp->mfs_baseoff;
-       while (mfsp->mfs_buflist != (struct buf *)-1) {
+       while (BUFQ_FIRST(&mfsp->mfs_buflist) != (struct buf *) -1) {
                /*
                 * If a non-ignored signal is received, try to unmount.
                 * If that fails, or the filesystem is already in the
@@ -303,8 +303,8 @@
                        continue;
                }
 
-               while ((bp = mfsp->mfs_buflist) != NULL) {
-                       mfsp->mfs_buflist = bp->b_actf;
+               while ((bp = BUFQ_FIRST(&mfsp->mfs_buflist)) != NULL) {
+                       BUFQ_REMOVE(&mfsp->mfs_buflist, bp);
                        mfs_doio(bp, base);
                        wakeup((caddr_t)bp);
                }
diff -r 3ac460645c99 -r 4e6aef203ee0 sys/ufs/mfs/mfs_vnops.c
--- a/sys/ufs/mfs/mfs_vnops.c   Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/ufs/mfs/mfs_vnops.c   Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mfs_vnops.c,v 1.18 1999/10/01 22:12:02 mycroft Exp $   */
+/*     $NetBSD: mfs_vnops.c,v 1.19 2000/01/21 23:43:10 thorpej Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -162,8 +162,7 @@
        } else if (mfsp->mfs_pid == p->p_pid) {
                mfs_doio(bp, mfsp->mfs_baseoff);
        } else {
-               bp->b_actf = mfsp->mfs_buflist;
-               mfsp->mfs_buflist = bp;
+               BUFQ_INSERT_TAIL(&mfsp->mfs_buflist, bp);
                wakeup((caddr_t)vp);
        }
        return (0);
@@ -237,8 +236,8 @@
        /*
         * Finish any pending I/O requests.
         */
-       while ((bp = mfsp->mfs_buflist) != NULL) {
-               mfsp->mfs_buflist = bp->b_actf;
+       while ((bp = BUFQ_FIRST(&mfsp->mfs_buflist)) != NULL) {
+               BUFQ_REMOVE(&mfsp->mfs_buflist, bp);
                mfs_doio(bp, mfsp->mfs_baseoff);
                wakeup((caddr_t)bp);
        }
@@ -255,12 +254,12 @@
         */
        if (vp->v_usecount > 1)
                printf("mfs_close: ref count %ld > 1\n", vp->v_usecount);
-       if (vp->v_usecount > 1 || mfsp->mfs_buflist)
+       if (vp->v_usecount > 1 || BUFQ_FIRST(&mfsp->mfs_buflist) != NULL)
                panic("mfs_close");
        /*
         * Send a request to the filesystem server to exit.
         */
-       mfsp->mfs_buflist = (struct buf *)(-1);
+       BUFQ_FIRST(&mfsp->mfs_buflist) = (struct buf *) -1;
        wakeup((caddr_t)vp);
        return (0);
 }
@@ -280,9 +279,10 @@
        struct vnode *vp = ap->a_vp;
        struct mfsnode *mfsp = VTOMFS(vp);
 
-       if (mfsp->mfs_buflist && mfsp->mfs_buflist != (struct buf *)(-1))
+       if (BUFQ_FIRST(&mfsp->mfs_buflist) != NULL &&
+           BUFQ_FIRST(&mfsp->mfs_buflist) != (struct buf *) -1)
                panic("mfs_inactive: not inactive (mfs_buflist %p)",
-                       mfsp->mfs_buflist);
+                       BUFQ_FIRST(&mfsp->mfs_buflist));
        VOP_UNLOCK(vp, 0);
        return (0);
 }
diff -r 3ac460645c99 -r 4e6aef203ee0 sys/ufs/mfs/mfsnode.h
--- a/sys/ufs/mfs/mfsnode.h     Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/ufs/mfs/mfsnode.h     Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mfsnode.h,v 1.6 1998/03/01 02:23:30 fvdl Exp $ */
+/*     $NetBSD: mfsnode.h,v 1.7 2000/01/21 23:43:10 thorpej Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@
        caddr_t mfs_baseoff;            /* base of file system in memory */
        long    mfs_size;               /* size of memory file system */
        pid_t   mfs_pid;                /* supporting process pid */
-       struct  buf *mfs_buflist;       /* list of I/O requests */
+       struct  buf_queue mfs_buflist;  /* list of I/O requests */
        long    mfs_spare[4];
 };
 
diff -r 3ac460645c99 -r 4e6aef203ee0 sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Fri Jan 21 23:41:45 2000 +0000
+++ b/sys/uvm/uvm_swap.c        Fri Jan 21 23:43:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_swap.c,v 1.32 2000/01/11 06:57:51 chs Exp $        */
+/*     $NetBSD: uvm_swap.c,v 1.33 2000/01/21 23:43:10 thorpej Exp $    */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -144,7 +144,8 @@
 
        int                     swd_bsize;      /* blocksize (bytes) */
        int                     swd_maxactive;  /* max active i/o reqs */
-       struct buf              swd_tab;        /* buffer list */
+       struct buf_queue        swd_tab;        /* buffer list */
+       int                     swd_active;     /* number of active buffers */
        struct ucred            *swd_cred;      /* cred for file access */
 };
 
@@ -691,6 +692,7 @@
                sdp->swd_flags = SWF_FAKE;      /* placeholder only */
                sdp->swd_vp = vp;
                sdp->swd_dev = (vp->v_type == VBLK) ? vp->v_rdev : NODEV;
+               BUFQ_INIT(&sdp->swd_tab);
 
                /*
                 * XXX Is NFS elaboration necessary?
@@ -1332,7 +1334,6 @@
                /*
                 * Just sort by block number
                 */
-               nbp->vb_buf.b_cylinder = nbp->vb_buf.b_blkno;
                s = splbio();
                if (vnx->vx_error != 0) {
                        putvndbuf(nbp);
@@ -1344,7 +1345,7 @@
                bgetvp(vp, &nbp->vb_buf);       
 
                /* sort it in and start I/O if we are not over our limit */
-               disksort(&sdp->swd_tab, &nbp->vb_buf);
+               disksort_blkno(&sdp->swd_tab, &nbp->vb_buf);
                sw_reg_start(sdp);
                splx(s);
 
@@ -1388,12 +1389,12 @@
 
        sdp->swd_flags |= SWF_BUSY;
 
-       while (sdp->swd_tab.b_active < sdp->swd_maxactive) {
-               bp = sdp->swd_tab.b_actf;
+       while (sdp->swd_active < sdp->swd_maxactive) {
+               bp = BUFQ_FIRST(&sdp->swd_tab);
                if (bp == NULL)
                        break;
-               sdp->swd_tab.b_actf = bp->b_actf;
-               sdp->swd_tab.b_active++;
+               BUFQ_REMOVE(&sdp->swd_tab, bp);
+               sdp->swd_active++;
 
                UVMHIST_LOG(pdhist,
                    "sw_reg_start:  bp %p vp %p blkno %p cnt %lx",
@@ -1477,7 +1478,7 @@
        /*
         * done!   start next swapdev I/O if one is pending
         */
-       sdp->swd_tab.b_active--;
+       sdp->swd_active--;
        sw_reg_start(sdp);
        splx(s);
 }



Home | Main Index | Thread Index | Old Index