On Sat, Apr 17, 2010 at 08:10:45PM -0400, Christoph Hellwig wrote:
> We currenly have a routine xfs_trans_buf_item_match_all which checks if any
> log item in a transaction contains a given buffer, and a second one that
> only does this check for the first, embedded chunk of log items. We only
> use the second routine if we know we only have that log item chunk, so get
> rid of the limited routine and always use the more complete one.
>
> Also rename the old xfs_trans_buf_item_match_all to xfs_trans_buf_item_match
> and update various surrounding comments, and move the remaining
> xfs_trans_buf_item_match on top of the file to avoid a forward prototype.
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.e:
len = BBTOB(len);
lidp = xfs_trans_first_item(tp);
while (lidp != NULL) {
blip = (xfs_buf_log_item_t *)lidp->lid_item;
lidp = xfs_trans_next_item(tp, lidp);
if (blip->bli_item.li_type != XFS_LI_BUF)
continue;
if (XFS_BUF_TARGET(blip->bli_buf) == target &&
XFS_BUF_ADDR(blip->bli_buf) == blkno &&
XFS_BUF_COUNT(blip->bli_buf) == len)
return blip->bli_buf;
}
Cheers,
Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
|