xfs
[Top] [All Lists]

Re: [PATCH] xfs: set cursor in xfs_ail_splice() even when AIL was empty

To: <xfs@xxxxxxxxxxx>
Subject: Re: [PATCH] xfs: set cursor in xfs_ail_splice() even when AIL was empty
From: Alex Elder <aelder@xxxxxxx>
Date: Fri, 22 Jul 2011 09:24:28 -0500
In-reply-to: <201107212205.p6LM5dxF016460@xxxxxxxxxxxxxxxxxxxxxx>
References: <201107212205.p6LM5dxF016460@xxxxxxxxxxxxxxxxxxxxxx>
Reply-to: <aelder@xxxxxxx>
On Thu, 2011-07-21 at 17:05 -0500, Alex Elder wrote:
> In xfs_ail_splice(), if a cursor is provided it is updated
> to point to the last item on the list to be spliced into
> the AIL.  But if the AIL was found to be empty, the cursor
> (if provided) is just initialized instead.
> 
> There is no reason the null AIL case needs to be any different.
> And treating it the same way allows this code to be rearranged
> a bit, with a somewhat tidier result.
> 
> Signed-off-by: Alex Elder <aelder@xxxxxxx>

I discovered a problem as I was thinking about this
last night.  I'll send an update shortly.

The problem is that my proposed xfs_ail_splice()
shouldn't update the cursor if an empty list is
passed, because the result won't produce a valid
item pointer.  An earlier edition of this patch
asserted no empty list would get passed, but that
fired fairly quickly.  Looking carefully at the
code as it stands now, an empty list will actually
do no harm, but that's just lucky, more or less.

And because the list_splice() after that ends up
being a no-op, there is really no point in
scanning the AIL to re-validate lip.  Therefore
we should just avoid calling xfs_ail_splice()
at all with an empty item list.

                                        -Alex


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