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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to