[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/8] block: add driver operation callbacks
From: |
Liu Yuan |
Subject: |
Re: [Qemu-devel] [PATCH 2/8] block: add driver operation callbacks |
Date: |
Mon, 1 Sep 2014 17:19:19 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Sep 01, 2014 at 10:28:54AM +0200, Benoît Canet wrote:
> The Monday 01 Sep 2014 à 15:43:08 (+0800), Liu Yuan wrote :
> > Driver operations are defined as callbacks passed from block upper drivers
> > to
> > lower drivers and are supposed to be called by lower drivers.
> >
> > Requests handling(queuing, submitting, etc.) are done in protocol tier in
> > the
> > block layer and connection states are also maintained down there. Driver
> > operations are supposed to notify the upper tier (such as quorum) of the
> > states
> > changes.
> >
> > For now only two operation are added:
> >
> > driver_disconnect: called when connection is off
> > driver_reconnect: called when connection is on after disconnection
> >
> > Which are used to notify upper tier of the connection state.
> >
> > Cc: Eric Blake <address@hidden>
> > Cc: Benoit Canet <address@hidden>
> > Cc: Kevin Wolf <address@hidden>
> > Cc: Stefan Hajnoczi <address@hidden>
> > Signed-off-by: Liu Yuan <address@hidden>
> > ---
> > block.c | 7 +++++++
> > include/block/block.h | 7 +++++++
> > include/block/block_int.h | 3 +++
> > 3 files changed, 17 insertions(+)
> >
> > diff --git a/block.c b/block.c
> > index c12b8de..22eb3e4 100644
> > --- a/block.c
> > +++ b/block.c
> > @@ -2152,6 +2152,13 @@ void bdrv_set_dev_ops(BlockDriverState *bs, const
> > BlockDevOps *ops,
> > bs->dev_opaque = opaque;
> > }
> >
> > +void bdrv_set_drv_ops(BlockDriverState *bs, const BlockDrvOps *ops,
> > + void *opaque)
> > +{
> > + bs->drv_ops = ops;
> > + bs->drv_opaque = opaque;
>
> We need to be very carefull of the mix between these fields and the infamous
> bdrv_swap function.
>
> Also I don't know if "driver operations" is the right name since the
> BlockDriver structure's
> callback could also be named "driver operations".
>
BlockDrvierState has a "device operation" for callbacks from devices. So I
choose "driver operation". So any sugguestion for better name?
Thanks
Yuan
[Qemu-devel] [PATCH 3/8] block/sheepdog: propagate disconnect/reconnect events to upper driver, Liu Yuan, 2014/09/01
[Qemu-devel] [PATCH 4/8] block/quorum: add quorum_aio_release() helper, Liu Yuan, 2014/09/01
[Qemu-devel] [PATCH 5/8] quorum: fix quorum_aio_cancel(), Liu Yuan, 2014/09/01