From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz3al-000588-J5 for qemu-devel@nongnu.org; Thu, 11 Dec 2014 08:15:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz3af-0004jp-0q for qemu-devel@nongnu.org; Thu, 11 Dec 2014 08:15:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz3ae-0004jl-Nw for qemu-devel@nongnu.org; Thu, 11 Dec 2014 08:15:32 -0500 Message-ID: <548998E6.9030408@redhat.com> Date: Thu, 11 Dec 2014 14:15:18 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1418223122-22481-1-git-send-email-pbonzini@redhat.com> <1418223122-22481-5-git-send-email-pbonzini@redhat.com> <20141211131336.GC23351@noname.redhat.com> In-Reply-To: <20141211131336.GC23351@noname.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/4] linux-aio: simplify removal of completed iocbs from the list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: ming.lei@canonical.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com On 11/12/2014 14:13, Kevin Wolf wrote: >> > +#define QSIMPLEQ_SPLIT_AFTER(head1, head2, elm, field) do { \ >> > + if (((head1)->sqh_first = (head2)->sqh_first) == NULL) { \ >> > + (head1)->sqh_last = &(head1)->sqh_first; \ >> > + } else { \ >> > + (head1)->sqh_last = &(elm)->field.sqe_next; \ >> > + if (((head2)->sqh_first = (elm)->field.sqe_next) == NULL) { \ >> > + (head2)->sqh_last = &(head2)->sqh_first; \ >> > + } \ >> > + } \ >> > +} while (/*CONSTCOND*/0) > Wouldn't it be easier to write a macro that doesn't split a queue in > two, but simply removes everything up to a given element? Yeah, though I figured that in the common case you'd have to free those elements or otherwise process them. But I left this patch last because I wasn't sure about the API. Feel free to ignore it, also given the above comment about EAGAIN. Paolo > Anyway, if you really want to implement a split operation, I think you > also need to break the actual chain, i.e. (head1)->sqh_last.sqe_next = > NULL.