The Monday 01 Sep 2014 à 15:43:09 (+0800), Liu Yuan wrote :
> This is the reference usage how we propagate connection state to upper tier.
> 
> Cc: Eric Blake <ebl...@redhat.com>
> Cc: Benoit Canet <ben...@irqsave.net>
> Cc: Kevin Wolf <kw...@redhat.com>
> Cc: Stefan Hajnoczi <stefa...@redhat.com>
> Signed-off-by: Liu Yuan <namei.u...@gmail.com>
> ---
>  block/sheepdog.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> 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 *opaque)
>  {
>      BDRVSheepdogState *s = opaque;
>      AIOReq *aio_req, *next;
> +    BlockDriverState *bs = 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 ?

>  
>      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 *opaque)
>          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);

>  }
>  
>  /*
> -- 
> 1.9.1
> 

Reply via email to