From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPE9b-0006sz-09 for qemu-devel@nongnu.org; Mon, 08 Apr 2013 11:38:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPE9W-0006ko-A3 for qemu-devel@nongnu.org; Mon, 08 Apr 2013 11:38:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPE9W-0006kW-1G for qemu-devel@nongnu.org; Mon, 08 Apr 2013 11:38:38 -0400 Date: Mon, 8 Apr 2013 17:38:19 +0200 From: Kevin Wolf Message-ID: <20130408153819.GI2657@dhcp-200-207.str.redhat.com> References: <1364507550-25093-1-git-send-email-aliguori@us.ibm.com> <1364507550-25093-3-git-send-email-aliguori@us.ibm.com> <20130402083724.GF2341@dhcp-200-207.str.redhat.com> <20130408153127.GB22660@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130408153127.GB22660@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 2/3] sheepdog: pass NULL for io_flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org, Mike Roth Am 08.04.2013 um 17:31 hat Stefan Hajnoczi geschrieben: > On Tue, Apr 02, 2013 at 10:37:24AM +0200, Kevin Wolf wrote: > > Am 28.03.2013 um 22:52 hat Anthony Liguori geschrieben: > > > Signed-off-by: Anthony Liguori > > > --- > > > block/sheepdog.c | 11 ++--------- > > > 1 file changed, 2 insertions(+), 9 deletions(-) > > > > > > diff --git a/block/sheepdog.c b/block/sheepdog.c > > > index bb67c4c..2bccd9b 100644 > > > --- a/block/sheepdog.c > > > +++ b/block/sheepdog.c > > > @@ -503,13 +503,6 @@ static void restart_co_req(void *opaque) > > > qemu_coroutine_enter(co, NULL); > > > } > > > > > > -static int have_co_req(void *opaque) > > > -{ > > > - /* this handler is set only when there is a pending request, so > > > - * always returns 1. */ > > > > Now you return 1 even when no request is pending (which is the case in > > which no io_flush handler would be set before). Why is this correct? > > (This is actually a question about PATCH 1/3, I just noticed it here. > > Are there more cases like this?) > > The trick with return 1 handlers is that they are deleted when there are > no more requests. The pattern is: > > ...begin processing request... > qemu_set_fd_handler2(fd, ..., have_co_req); > qemu_coroutine_yield() > qemu_set_fd_handler2(fd, NULL, NULL, NULL, NULL); /* delete handler */ > ...finish processing request... Indeed. I thought I had seen a case where only the flush handler is reset, but it seems I didn't look close enough. Kevin