Re: b_end_io

Peter T. Breuer (ptb@it.uc3m.es)
Fri, 3 Dec 1999 00:48:22 +0100 (MET)


"Jens Axboe wrote:"
On Thu, Dec 02 1999, Peter T. Breuer wrote:
> > Can anyone tell me where the default bh->b_end_io value is set in 2.2.*
> > kernels? (it's the "end buffer io" function in the buffer heads).
>
> Look at brw_page and get_blk in buffer.c, it's quite clear.

brw_page does exist, but it doesn't mention b_end_io, and it is not
heavily referenced ... the function itself is not at all clear to me.

Init_buffer seems more of a promising trail It's used twice in
buffer.c. Aha! It's getblk! Yes .. that looks better. The default for
b_end_io is end_buffer_io_sync!

/* OK, FINALLY we know that this buffer is the only one of its kind,
* and that it's unused (b_count=0), unlocked, and clean.
*/
init_buffer(bh, dev, block, end_buffer_io_sync, NULL);
bh->b_state=0;
insert_into_queues(bh);
return bh;

Yes. I don't know how I missed that. Thank you! Now why didn't I see
that! OK .. that explains it. The default end_io is a static.

static void end_buffer_io_sync(struct buffer_head *bh, int uptodate)
{
mark_buffer_uptodate(bh, uptodate);
unlock_buffer(bh);
}

There's an end_buffer_io_async too .. Sigh. What I want is to commit a
buffer to a certain target area without discarding the buffer. Then I
want to retarget the buffer in a different (or the same buffer_head)
and commit it again. "The same" buffer_head would be nice.

Thanks again.

Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/