[PATCH 4/5] [PATCH] xfs: simplify buffer to transaction matching
Christoph Hellwig
hch at infradead.org
Sat May 1 07:58:39 CDT 2010
On Tue, Apr 20, 2010 at 04:41:55PM +1000, Dave Chinner wrote:
> Good start, but I think that it should use xfs_trans_first_item()
> and xfs_trans_next_item() rather than walking the descriptor
> table directly.
I tried implementing it, but it doesn't work. We can call the buffer
matching routines on transactions that don't have any item linked to
it, which will cause xfs_trans_first_item to panic. Compare this code
in xfs_trans_buf_item_match:
for (licp = &tp->t_items; licp != NULL; licp = licp->lic_next) {
if (xfs_lic_are_all_free(licp)) {
ASSERT(licp == &tp->t_items);
ASSERT(licp->lic_next == NULL);
return NULL;
}
...
}
to this in xfs_trans_first_item:
licp = &tp->t_items;
/*
* If it's not in the first chunk, skip to the second.
*/
if (xfs_lic_are_all_free(licp)) {
licp = licp->lic_next;
}
/*
* Return the first non-free descriptor in the chunk.
*/
ASSERT(!xfs_lic_are_all_free(licp));
More information about the xfs
mailing list