diff --git a/sys/kern/bufq_priocscan.c b/sys/kern/bufq_priocscan.c index 4bb75f26a7f0..6909404ba76f 100644 --- a/sys/kern/bufq_priocscan.c +++ b/sys/kern/bufq_priocscan.c @@ -1,7 +1,7 @@ -/* $NetBSD: bufq_priocscan.c,v 1.12 2008/05/03 05:18:36 yamt Exp $ */ +/* $NetBSD: bufq_priocscan.c,v 1.13 2009/01/16 01:44:27 yamt Exp $ */ /*- - * Copyright (c)2004 YAMAMOTO Takashi, + * Copyright (c)2004,2005,2006,2008,2009 YAMAMOTO Takashi, * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bufq_priocscan.c,v 1.12 2008/05/03 05:18:36 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bufq_priocscan.c,v 1.13 2009/01/16 01:44:27 yamt Exp $"); #include #include @@ -284,22 +284,23 @@ bufq_priocscan_get(struct bufq_state *bufq, int remove) } static struct buf * -bufq_priocscan_cancel(struct bufq_state *bufq, struct buf *buf) +bufq_priocscan_cancel(struct bufq_state *bufq, struct buf *bp) { - struct cscan_queue *q = bufq->bq_private; - struct bqhead *bqh; - struct buf *bq; - int idx; + struct bufq_priocscan * const q = bufq->bq_private; + int i, j; - for (idx = 0; idx < 2; idx++) { - bqh = &q->cq_head[idx]; - bq = TAILQ_FIRST(bqh); - while (bq) { - if (bq == buf) { - TAILQ_REMOVE(bqh, bq, b_actq); - return buf; + for (i = 0; i < PRIOCSCAN_NQUEUE; i++) { + struct cscan_queue * const cq = &q->bq_queue[i].q_queue; + for (j = 0; j < 2; j++) { + struct bqhead * const bqh = &cq->cq_head[j]; + struct buf *bq; + + TAILQ_FOREACH(bq, bqh, b_actq) { + if (bq == bp) { + TAILQ_REMOVE(bqh, bp, b_actq); + return bp; + } } - bq = TAILQ_NEXT(bq, b_actq); } } return NULL;