xfs
[Top] [All Lists]

Re: [PATCH 4/5] [PATCH] xfs: simplify buffer to transaction matching

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/5] [PATCH] xfs: simplify buffer to transaction matching
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 20 Apr 2010 16:41:55 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20100418001058.677429475@xxxxxxxxxxxxxxxxxxxxxx>
References: <20100418001041.865247520@xxxxxxxxxxxxxxxxxxxxxx> <20100418001058.677429475@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
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

<Prev in Thread] Current Thread [Next in Thread>