Convert to new device buffer queue interface.

This commit is contained in:
hannken 2002-07-20 16:30:18 +00:00
parent c455730141
commit 856bd17f66
4 changed files with 15 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ed_mca.c,v 1.11 2002/03/29 20:10:46 jdolecek Exp $ */
/* $NetBSD: ed_mca.c,v 1.12 2002/07/20 16:30:18 hannken Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.11 2002/03/29 20:10:46 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.12 2002/07/20 16:30:18 hannken Exp $");
#include "rnd.h"
#include "locators.h"
@ -150,7 +150,7 @@ ed_mca_attach(parent, self, aux)
ed->sc_devno = eda->edc_drive;
edc_add_disk(sc, ed);
BUFQ_INIT(&ed->sc_q);
bufq_init(&ed->sc_q, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
simple_lock_init(&ed->sc_q_lock);
snprintf(lckname, sizeof(lckname), "%slck", ed->sc_dev.dv_xname);
lockinit(&ed->sc_lock, PRIBIO | PCATCH, lckname, 0, 0);
@ -248,7 +248,7 @@ edmcastrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
simple_lock(&ed->sc_q_lock);
disksort_blkno(&ed->sc_q, bp);
BUFQ_PUT(&ed->sc_q, bp);
simple_unlock(&ed->sc_q_lock);
/* Ring the worker thread */

View File

@ -1,4 +1,4 @@
/* $NetBSD: edc_mca.c,v 1.16 2002/03/31 10:01:26 jdolecek Exp $ */
/* $NetBSD: edc_mca.c,v 1.17 2002/07/20 16:30:19 hannken Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.16 2002/03/31 10:01:26 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.17 2002/07/20 16:30:19 hannken Exp $");
#include "rnd.h"
@ -855,12 +855,11 @@ edcworker(arg)
/* Is there a buf for us ? */
simple_lock(&ed->sc_q_lock);
if ((bp = BUFQ_FIRST(&ed->sc_q)) == NULL) {
if ((bp = BUFQ_GET(&ed->sc_q)) == NULL) {
simple_unlock(&ed->sc_q_lock);
i++;
continue;
}
BUFQ_REMOVE(&ed->sc_q, bp);
simple_unlock(&ed->sc_q_lock);
/* Instrumentation. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: edvar.h,v 1.6 2001/11/24 12:46:15 jdolecek Exp $ */
/* $NetBSD: edvar.h,v 1.7 2002/07/20 16:30:19 hannken Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@ struct ed_softc {
/* General disk infos */
struct disk sc_dk;
struct buf_queue sc_q;
struct bufq_state sc_q;
struct simplelock sc_q_lock;
struct edc_mca_softc *edc_softc; /* pointer to our controller */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.124 2002/07/13 17:47:44 oster Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.125 2002/07/20 16:34:15 hannken Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -114,7 +114,7 @@
***********************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.124 2002/07/13 17:47:44 oster Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.125 2002/07/20 16:34:15 hannken Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -219,7 +219,7 @@ struct raid_softc {
size_t sc_size; /* size of the raid device */
char sc_xname[20]; /* XXX external name */
struct disk sc_dkdev; /* generic disk device info */
struct buf_queue buf_queue; /* used for the device queue */
struct bufq_state buf_queue; /* used for the device queue */
};
/* sc_flags */
#define RAIDF_INITED 0x01 /* unit has been initialized */
@ -366,7 +366,7 @@ raidattach(num)
}
for (raidID = 0; raidID < num; raidID++) {
BUFQ_INIT(&raid_softc[raidID].buf_queue);
bufq_init(&raid_softc[raidID].buf_queue, BUFQ_FCFS);
raidrootdev[raidID].dv_class = DV_DISK;
raidrootdev[raidID].dv_cfdata = NULL;
@ -715,7 +715,7 @@ raidstrategy(bp)
bp->b_resid = 0;
/* stuff it onto our queue */
BUFQ_INSERT_TAIL(&rs->buf_queue, bp);
BUFQ_PUT(&rs->buf_queue, bp);
raidstart(raidPtrs[raidID]);
@ -1664,11 +1664,10 @@ raidstart(raidPtr)
RF_UNLOCK_MUTEX(raidPtr->mutex);
/* get the next item, if any, from the queue */
if ((bp = BUFQ_FIRST(&rs->buf_queue)) == NULL) {
if ((bp = BUFQ_GET(&rs->buf_queue)) == NULL) {
/* nothing more to do */
return;
}
BUFQ_REMOVE(&rs->buf_queue, bp);
/* Ok, for the bp we have here, bp->b_blkno is relative to the
* partition.. Need to make it absolute to the underlying