Re: [Ext2-devel] [PATCH] JBD: journal_release_buffer()

From: Alex Tomas
Date: Tue Jan 25 2005 - 09:40:25 EST



Hi, could you review the following solution?


t_outstanding_credits - number of _modified_ blocks in the transaction
t_reserved - number of blocks all running handle reserved

transaction size = t_outstanding_credits + t_reserved;





#define TSIZE(t) ((t)->t_outstanding_credits + (t)->t_reserved)

journal_start(blocks)
{
if (TSIZE(transaction) + blocks > MAX)
wait_for_space(journal);

transaction->t_reserved += blocks;
handle->h_buffer_credits = blocks;
}


journal_get_write_access(handle, bh)
{
if (jh->b_tcount >= 0)
jh->b_tcount++;
}

journal_dirty_metadata(handle, bh)
{
transaction->t_reserved--;
handle->h_buffer_credits--;
if (jh->b_tcount > 0) {
/* modifed, no need to track it any more */
transaction->t_outstanding_credits++;
jh->b_tcount = -1;
}
}

journal_release_buffer(handle, bh)
{
if (jh->b_tcount > 0) {
/* it's not modified yet */
jh->b_tcount--;
if (jh->b_tcount == 0) {
/* remove from the transaction */
}
}
}

journal_stop(handle)
{
transaction->t_outstanding_credits -= handle->h_buffer_credits;
}


thanks, Alex


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