From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJliA-0003fQ-Ex for qemu-devel@nongnu.org; Thu, 14 Jan 2016 12:29:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJli9-0005ZB-GR for qemu-devel@nongnu.org; Thu, 14 Jan 2016 12:29:26 -0500 Date: Thu, 14 Jan 2016 17:29:16 +0000 From: "Daniel P. Berrange" Message-ID: <20160114172916.GF19340@redhat.com> References: <1452760863-25350-1-git-send-email-famz@redhat.com> <1452760863-25350-4-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1452760863-25350-4-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 3/3] nbd-server: Coroutine based negotiation Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, qemu-block@nongnu.org On Thu, Jan 14, 2016 at 04:41:03PM +0800, Fam Zheng wrote: > Create a coroutine in nbd_client_new, so that nbd_send_negotiate doesn't > need qemu_set_block(). > > Handlers need to be set temporarily for csock fd in case the coroutine > yields during I/O. > > With this, if the other end disappears in the middle of the negotiation, > we don't block the whole event loop. > > To make the code clearer, unify all function names that belong to > negotiate, so they are less likely to be misused. This is important > because we rely on negotiation staying in main loop, as commented in > nbd_negotiate_read/write(). To nit-pick, is generally better to do such generic renaming of existing code separately from commits which include functional changes > > Signed-off-by: Fam Zheng > --- > nbd/server.c | 150 ++++++++++++++++++++++++++++++++++++++++------------------- Reviewed-by: Daniel P. Berrange Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|