Subject: Re: Rewrite of buffer queue interface
To: None <tech-kern@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 07/13/2002 09:54:21
On Sat, Jul 13, 2002 at 03:19:26PM +0200, Juergen Hannken-Illjes wrote:
> A buf_queue gets initialised with `bufq_init', here the
> put/get functions are initialized, the method private
> part gets MALLOCed and initialized.
>
> `BUFQ_PUT' puts a buffer into the queue.
>
> `BUFQ_GET' gets (and removes) the next buffer from the queue.
>
> `BUFQ_PEEK' gets (without removal) the next buffer from the queue.
Looks good.
> Any functionality missing? Comments?
You might consider getting rid of B_ORDERED. It's not really used for
anything, and it's probably easier to enforce barriers in the callers
(as is currently done). B_ORDERED really just complicates what ought
to be a simple thing. In hindsight, I probably should have never added
it in the first place.
> /*
> * Device driver buffer queue.
> */
> struct bufq_state {
> struct buf *(*bq_get)(struct buf_queue *, int);
> void (*bq_put)(struct buf_queue *, struct buf *);
> int bq_flags; /* flags from bufq_init() */
> void *bq_private;
I'd swap the order of bq_flags and bq_private.
Otherwise, this looks fine to me. Thanks for looking into this problem!
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>