From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPE2e-0003sZ-AD for qemu-devel@nongnu.org; Mon, 08 Apr 2013 11:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPE2d-0003qB-1N for qemu-devel@nongnu.org; Mon, 08 Apr 2013 11:31:32 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:53782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPE2c-0003q0-S7 for qemu-devel@nongnu.org; Mon, 08 Apr 2013 11:31:30 -0400 Received: by mail-wi0-f176.google.com with SMTP id hm14so2697437wib.15 for ; Mon, 08 Apr 2013 08:31:30 -0700 (PDT) Date: Mon, 8 Apr 2013 17:31:27 +0200 From: Stefan Hajnoczi Message-ID: <20130408153127.GB22660@stefanha-thinkpad.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130402083724.GF2341@dhcp-200-207.str.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: Kevin Wolf Cc: Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org, Mike Roth 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... Stefan