Subject: Re: Eliminating BQ_AGE -- with broken patch
To: Thor Lancelot Simon <tls@rek.tjls.com>
From: enami tsugutomo <enami@but-b.or.jp>
List: tech-kern
Date: 01/31/2004 08:58:53
> @@ -886,8 +880,13 @@
> has_deps = (*bioops.io_countdeps)(bp, 0);
> else
> has_deps = 0;
> - bufq = has_deps ? &bufqueues[BQ_LRU] :
> - &bufqueues[BQ_AGE];
> +
> + if(has_deps) {
Put a space after the `if'.
> + bufq = &bufqueues[BQ_LRU];
> + } else {
> + buf_age(bp);
With comparing the code to reuse a buffer in the queue or the code in
the (outer) `then-clause' above, I guess calling buf_age() is not
enough.
> @@ -1186,6 +1184,22 @@
> }
>
> /*
> + * Deal with an invalid buffer (called instead of moving it to BQ_AGE).
> + * Sets its size and count to 0; releases its memory to the pool.
> + * The caller must release the actual buffer header -- currently, this
> + * is called from buf_trim, which brelse()s the buffer, and brelse()
> + * itself, which releases the header at the end of the function.
> + */
> +void buf_age(struct buf *bp)
void
buf_age(...
> +{
> + bufmem -= bp->b_bufsize;
> + if (bp->b_bufsize > 0) {
> + buf_mrelease(bp->b_data, bp->b_bufsize);
> + bp->b_bcount = bp->b_bufsize = 0;
> + }
I guess these spaces are cut&paste error.
> @@ -1210,14 +1224,8 @@
> simple_unlock(&bqueue_slock);
> goto out;
> }
> - size = bp->b_bufsize;
> - bufmem -= size;
> simple_unlock(&bqueue_slock);
> - if (size > 0) {
> - buf_mrelease(bp->b_data, size);
> - bp->b_bcount = bp->b_bufsize = 0;
> - }
> -
> + buf_age(bp);
Is it safe to update `bufmem' here?
enami.