Received: from eggs.gnu.org ([2001:4830:134:3::10]:46154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7iMk-0007uf-3K for qemu-devel@nongnu.org; Fri, 18 Nov 2016 07:34:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7iMj-0001D8-Aw for qemu-devel@nongnu.org; Fri, 18 Nov 2016 07:34:02 -0500 From: Alberto Garcia In-Reply-To: <20161118122112.GA4694@noname.redhat.com> References: <1478798349-28983-1-git-send-email-kwolf@redhat.com> <1478798349-28983-7-git-send-email-kwolf@redhat.com> <20161118122112.GA4694@noname.redhat.com> Date: Fri, 18 Nov 2016 13:33:52 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RFC PATCH 6/8] quorum: Avoid bdrv_aio_writev() for rewrites List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, mreitz@redhat.com, qemu-devel@nongnu.org On Fri 18 Nov 2016 01:21:12 PM CET, Kevin Wolf wrote: >> > + /* one less rewrite to do */ >> > + acb->rewrite_count--; >> > + qemu_coroutine_enter_if_inactive(acb->co); >> >> I think you should only enter acb->co when acb->rewrite_count reaches >> zero. >> >> In all other cases the main coroutine simply iterates inside the >> while() loop, verifies that the number is still positive and yields >> again. >> >> The same applies to all other cases of >> qemu_coroutine_enter_if_inactive, by the way (I failed to notice it >> in patch #5). > > I think I like it better this way because it keeps the loop condition > local to the caller instead of spreading it across the caller and the > places that reenter. On the other hand, I can see that not doing the > extra context switch might be a little more efficient. Apart from the efficiency, I actually find it a bit easier to understand if it's made explicit: /* Once all rewrites are done we can wake up the caller */ if (--acb->rewrite_count == 0) { qemu_coroutine_enter_if_inactive(acb->co); } But I can understand that some people may find your way easier. I don't feel strongly about it, so no need to change it. Berto