struct buf * and journaled-UFS help

Alexander Kabaev ak03 at
Wed Mar 3 13:49:25 PST 2004

On 03 Mar 2004 16:38:49 -0500
"David E. Cross" <crossd at> wrote:

> As some are aware I have been working with a computer science graduate
> student to bring jounralling to the UFS(2) filesystem.  Right now we
> have it so that operations are journaled to an in-core memory
> structure(comprised of BLKSIZE * number amount of memory, which is
> obtained by malloc(9)).  When this in-core journal gets full we need
> to flush it to disk.  Previously we had used VOP_WRITE() for this, but
> it was suggested, and I agree that we should use either VOP_STRATEGY
> or brwite/bread for our IO work.  Both of these require a "struct buf"
> to do their work.  What is the appropriate way to get such a
> structure?  I have seen gbincore() used in similar cases, but it seems
> that gbincore(), like many of the other buf(9) routines are for
> getting an already allocated struct buf from the system pool; for
> example gbincore checks that the lblkno of what is requested is the
> name as the block already allocated in either the clean or dirty block
> trees.

If you don't need any delwri functionality struct buf provides, I would
suggest using struct bio to route IO directly to storage drivers/geom.

Alexander Kabaev

More information about the freebsd-fs mailing list