Hi,

On Wed, 13 Oct 1999 09:55:39 -0400, Chris Mason
<[EMAIL PROTECTED]> said:

> All true.  But shouldn't I be able to write function to reuse a buffer_head
> for a different block without freeing it?  I realize the buffer cache
> doesn't have a call to do it now, but it seems like it should be possible.

Sort of: you can definitely reuse the buffer data, but you almost
certainly need a new buffer_head with which to label it when it goes to
the log (ext3 tries to do that whenever possible).  However, there is
still a tradeoff: if you have the buffers shared, then no new
transaction can modify the buffer contents while a commit occurs.  If
you allow copy-on-write so that the commit can proceed while a new
transaction dirties the buffer, then once again you are requiring extra
memory allocation during the commit.  

However, the other part of the equation: the fact that you don't know in
advance how large a running transaction will become, and that its
buffers are pinned until the transaction completes and starts to commit
--- is much harder to work around.

--Stephen

Reply via email to