xfs
[Top] [All Lists]

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

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/5] [PATCH] xfs: simplify buffer to transaction matching
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sat, 1 May 2010 08:58:39 -0400
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20100420064155.GH15130@dastard>
References: <20100418001041.865247520@xxxxxxxxxxxxxxxxxxxxxx> <20100418001058.677429475@xxxxxxxxxxxxxxxxxxxxxx> <20100420064155.GH15130@dastard>
User-agent: Mutt/1.5.19 (2009-01-05)
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));

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