Source-Changes-HG archive

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

[src/trunk]: src/sys introduce a function to drain bufq and use it where appr...



details:   https://anonhg.NetBSD.org/src/rev/b0dfa159238b
branches:  trunk
changeset: 579905:b0dfa159238b
user:      yamt <yamt%NetBSD.org@localhost>
date:      Thu Mar 31 11:28:53 2005 +0000

description:
introduce a function to drain bufq and use it where appropriate.

diffstat:

 sys/dev/ata/wd.c     |  12 +++---------
 sys/dev/ccd.c        |  12 +++---------
 sys/dev/cgd.c        |  11 +++--------
 sys/dev/ld.c         |  15 +++++----------
 sys/dev/scsipi/cd.c  |  12 +++---------
 sys/dev/scsipi/sd.c  |  12 +++---------
 sys/dev/scsipi/ss.c  |  12 +++---------
 sys/dev/scsipi/st.c  |  12 +++---------
 sys/dev/vnd.c        |   9 +++++++--
 sys/kern/subr_disk.c |  20 ++++++++++++++++++--
 sys/sys/bufq.h       |   3 ++-
 11 files changed, 53 insertions(+), 77 deletions(-)

diffs (truncated from 411 to 300 lines):

diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/ata/wd.c  Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.298 2005/02/27 00:26:59 perry Exp $ */
+/*     $NetBSD: wd.c,v 1.299 2005/03/31 11:28:53 yamt Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.298 2005/02/27 00:26:59 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.299 2005/03/31 11:28:53 yamt Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -425,7 +425,6 @@
 wddetach(struct device *self, int flags)
 {
        struct wd_softc *sc = (struct wd_softc *)self;
-       struct buf *bp;
        int s, bmaj, cmaj, i, mn;
 
        /* locate the major number */
@@ -445,12 +444,7 @@
        s = splbio();
 
        /* Kill off any queued buffers. */
-       while ((bp = BUFQ_GET(&sc->sc_q)) != NULL) {
-               bp->b_error = EIO;
-               bp->b_flags |= B_ERROR;
-               bp->b_resid = bp->b_bcount;
-               biodone(bp);
-       }
+       bufq_drain(&sc->sc_q);
 
        bufq_free(&sc->sc_q);
        sc->atabus->ata_killpending(sc->drvp);
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/ccd.c
--- a/sys/dev/ccd.c     Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/ccd.c     Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.102 2005/02/27 00:26:58 perry Exp $  */
+/*     $NetBSD: ccd.c,v 1.103 2005/03/31 11:28:53 yamt Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.102 2005/02/27 00:26:58 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.103 2005/03/31 11:28:53 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -984,7 +984,6 @@
        int unit = ccdunit(dev);
        int s, i, j, lookedup = 0, error;
        int part, pmask;
-       struct buf *bp;
        struct ccd_softc *cs;
        struct ccd_ioctl *ccio = (struct ccd_ioctl *)data;
        struct ucred *uc;
@@ -1155,12 +1154,7 @@
 
                /* Kill off any queued buffers. */
                s = splbio();
-               while ((bp = BUFQ_GET(&cs->sc_bufq)) != NULL) {
-                       bp->b_error = EIO;
-                       bp->b_flags |= B_ERROR;
-                       bp->b_resid = bp->b_bcount;
-                       biodone(bp);
-               }
+               bufq_drain(&cs->sc_bufq);
                splx(s);
 
                bufq_free(&cs->sc_bufq);
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/cgd.c
--- a/sys/dev/cgd.c     Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/cgd.c     Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.22 2005/02/27 00:26:58 perry Exp $ */
+/* $NetBSD: cgd.c,v 1.23 2005/03/31 11:28:53 yamt Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.22 2005/02/27 00:26:58 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.23 2005/03/31 11:28:53 yamt Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -592,12 +592,7 @@
 
        /* Kill off any queued buffers. */
        s = splbio();
-       while ((bp = BUFQ_GET(&cs->sc_dksc.sc_bufq)) != NULL) {
-               bp->b_error = EIO;
-               bp->b_flags |= B_ERROR;
-               bp->b_resid = bp->b_bcount;
-               biodone(bp);
-       }
+       bufq_drain(&cs->sc_dksc.sc_bufq);
        splx(s);
        bufq_free(&cs->sc_dksc.sc_bufq);
 
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/ld.c
--- a/sys/dev/ld.c      Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/ld.c      Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.35 2005/02/27 00:26:58 perry Exp $    */
+/*     $NetBSD: ld.c,v 1.36 2005/03/31 11:28:53 yamt Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.35 2005/02/27 00:26:58 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.36 2005/03/31 11:28:53 yamt Exp $");
 
 #include "rnd.h"
 
@@ -201,7 +201,6 @@
 void
 ldenddetach(struct ld_softc *sc)
 {
-       struct buf *bp;
        int s, bmaj, cmaj, i, mn;
 
        if ((sc->sc_flags & LDF_ENABLED) == 0)
@@ -218,14 +217,10 @@
 
        /* Kill off any queued buffers. */
        s = splbio();
-       while ((bp = BUFQ_GET(&sc->sc_bufq)) != NULL) {
-               bp->b_error = EIO;
-               bp->b_flags |= B_ERROR;
-               bp->b_resid = bp->b_bcount;
-               biodone(bp);
-       }
+       bufq_drain(&sc->sc_bufq);
+       splx(s);
+
        bufq_free(&sc->sc_bufq);
-       splx(s);
 
        /* Nuke the vnodes for any open instances. */
        for (i = 0; i < MAXPARTITIONS; i++) {
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/scsipi/cd.c       Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.220 2005/02/27 00:27:48 perry Exp $   */
+/*     $NetBSD: cd.c,v 1.221 2005/03/31 11:28:53 yamt Exp $    */
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.220 2005/02/27 00:27:48 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.221 2005/03/31 11:28:53 yamt Exp $");
 
 #include "rnd.h"
 
@@ -290,7 +290,6 @@
 cddetach(struct device *self, int flags)
 {
        struct cd_softc *cd = (struct cd_softc *) self;
-       struct buf *bp;
        int s, bmaj, cmaj, i, mn;
 
        /* locate the major number */
@@ -310,12 +309,7 @@
        s = splbio();
 
        /* Kill off any queued buffers. */
-       while ((bp = BUFQ_GET(&cd->buf_queue)) != NULL) {
-               bp->b_error = EIO;
-               bp->b_flags |= B_ERROR;
-               bp->b_resid = bp->b_bcount;
-               biodone(bp);
-       }
+       bufq_drain(&cd->buf_queue);
 
        bufq_free(&cd->buf_queue);
 
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c       Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/scsipi/sd.c       Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.237 2005/02/27 00:27:48 perry Exp $   */
+/*     $NetBSD: sd.c,v 1.238 2005/03/31 11:28:53 yamt Exp $    */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.237 2005/02/27 00:27:48 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.238 2005/03/31 11:28:53 yamt Exp $");
 
 #include "opt_scsi.h"
 #include "rnd.h"
@@ -347,7 +347,6 @@
 sddetach(struct device *self, int flags)
 {
        struct sd_softc *sd = (struct sd_softc *) self;
-       struct buf *bp;
        int s, bmaj, cmaj, i, mn;
 
        /* locate the major number */
@@ -370,12 +369,7 @@
        s = splbio();
 
        /* Kill off any queued buffers. */
-       while ((bp = BUFQ_GET(&sd->buf_queue)) != NULL) {
-               bp->b_error = EIO;
-               bp->b_flags |= B_ERROR;
-               bp->b_resid = bp->b_bcount;
-               biodone(bp);
-       }
+       bufq_drain(&sd->buf_queue);
 
        bufq_free(&sd->buf_queue);
 
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/scsipi/ss.c
--- a/sys/dev/scsipi/ss.c       Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/scsipi/ss.c       Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ss.c,v 1.59 2005/02/01 00:19:34 reinoud Exp $  */
+/*     $NetBSD: ss.c,v 1.60 2005/03/31 11:28:53 yamt Exp $     */
 
 /*
  * Copyright (c) 1995 Kenneth Stailey.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.59 2005/02/01 00:19:34 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.60 2005/03/31 11:28:53 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -188,7 +188,6 @@
 ssdetach(struct device *self, int flags)
 {
        struct ss_softc *ss = (struct ss_softc *) self;
-       struct buf *bp;
        int s, cmaj, mn;
 
        /* locate the major number */
@@ -200,12 +199,7 @@
        s = splbio();
 
        /* Kill off any queued buffers. */
-       while ((bp = BUFQ_GET(&ss->buf_queue)) != NULL) {
-               bp->b_error = EIO;
-               bp->b_flags |= B_ERROR;
-               bp->b_resid = bp->b_bcount;
-               biodone(bp);
-       }
+       bufq_drain(&ss->buf_queue);
 
        bufq_free(&ss->buf_queue);
 
diff -r d3bd3dd3470d -r b0dfa159238b sys/dev/scsipi/st.c
--- a/sys/dev/scsipi/st.c       Thu Mar 31 08:52:49 2005 +0000
+++ b/sys/dev/scsipi/st.c       Thu Mar 31 11:28:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: st.c,v 1.178 2005/02/27 00:27:48 perry Exp $ */
+/*     $NetBSD: st.c,v 1.179 2005/03/31 11:28:53 yamt Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.178 2005/02/27 00:27:48 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.179 2005/03/31 11:28:53 yamt Exp $");
 
 #include "opt_scsi.h"
 
@@ -439,7 +439,6 @@
 stdetach(struct device *self, int flags)
 {
        struct st_softc *st = (struct st_softc *)self;
-       struct buf *bp;
        int s, bmaj, cmaj, mn;



Home | Main Index | Thread Index | Old Index