From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XON2X-0002pU-74 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 04:32:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XON2Q-0001Xf-9t for qemu-devel@nongnu.org; Mon, 01 Sep 2014 04:32:41 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:36369 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XON2Q-0001Wq-3Q for qemu-devel@nongnu.org; Mon, 01 Sep 2014 04:32:34 -0400 Date: Mon, 1 Sep 2014 10:31:47 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140901083146.GD15537@irqsave.net> References: <1409557394-11853-1-git-send-email-namei.unix@gmail.com> <1409557394-11853-4-git-send-email-namei.unix@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1409557394-11853-4-git-send-email-namei.unix@gmail.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/8] block/sheepdog: propagate disconnect/reconnect events to upper driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yuan Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi The Monday 01 Sep 2014 =E0 15:43:09 (+0800), Liu Yuan wrote : > This is the reference usage how we propagate connection state to upper = tier. >=20 > Cc: Eric Blake > Cc: Benoit Canet > Cc: Kevin Wolf > Cc: Stefan Hajnoczi > Signed-off-by: Liu Yuan > --- > block/sheepdog.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/block/sheepdog.c b/block/sheepdog.c > index 53c24d6..9c0fc49 100644 > --- a/block/sheepdog.c > +++ b/block/sheepdog.c > @@ -714,6 +714,11 @@ static coroutine_fn void reconnect_to_sdog(void *o= paque) > { > BDRVSheepdogState *s =3D opaque; > AIOReq *aio_req, *next; > + BlockDriverState *bs =3D s->bs; > + > + if (bs->drv_ops && bs->drv_ops->driver_disconnect) { > + bs->drv_ops->driver_disconnect(bs); > + } Since this sequence will be strictly the same for all the implementation could we create a bdrv_signal_disconnect(bs); in the block layer to make = this code generic ? > =20 > aio_set_fd_handler(s->aio_context, s->fd, NULL, NULL, NULL); > close(s->fd); > @@ -756,6 +761,10 @@ static coroutine_fn void reconnect_to_sdog(void *o= paque) > QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings= ); > resend_aioreq(s, aio_req); > } > + > + if (bs->drv_ops && bs->drv_ops->driver_reconnect) { > + bs->drv_ops->driver_reconnect(bs); > + } Same here bdrv_signal_reconnect(bs); > } > =20 > /* > --=20 > 1.9.1 >=20