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.