[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async |
Date: |
Tue, 26 Aug 2014 17:21:43 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, 08/26 10:46, Paolo Bonzini wrote:
> Il 26/08/2014 08:08, Fam Zheng ha scritto:
> > + if (dbs->cancelled) {
> > + ret = -ECANCELED;
> > + }
>
> Why is dbs->cancelled necessary?
Request may complete after bdrv_aio_cancel_async with other status, this flag
is checked to fix the status to -ECANCELED.
>
> > dma_bdrv_unmap(dbs);
> > if (dbs->common.cb) {
> > dbs->common.cb(dbs->common.opaque, ret);
> > @@ -141,6 +148,9 @@ static void dma_bdrv_cb(void *opaque, int ret)
> >
> > trace_dma_bdrv_cb(dbs, ret);
> >
> > + if (dbs->cancelled) {
> > + ret = -ECANCELED;
> > + }
> > dbs->acb = NULL;
> > dbs->sector_num += dbs->iov.size / 512;
> >
> > @@ -185,6 +195,7 @@ static void dma_aio_cancel(BlockDriverAIOCB *acb)
> >
> > trace_dma_aio_cancel(dbs);
> >
> > + dbs->cancelled = true;
> > if (dbs->acb) {
> > BlockDriverAIOCB *acb = dbs->acb;
> > dbs->acb = NULL;
> > @@ -196,9 +207,25 @@ static void dma_aio_cancel(BlockDriverAIOCB *acb)
> > dma_complete(dbs, 0);
> > }
> >
> > +static void dma_aio_cancel_async(BlockDriverAIOCB *acb)
> > +{
> > + DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);
> > +
> > + trace_dma_aio_cancel(dbs);
> > +
> > + dbs->cancelled = true;
> > + if (dbs->acb) {
> > + acb = dbs->acb;
> > + dbs->acb = NULL;
>
> Why do you need to set dbs->acb to NULL, since the callback is going to
> be called?
Just copied from dma_aio_cancel, but seems not particularly useful. It reminds
me that the one in dma_aio_cancel also looks suspicious.
Fam
- [Qemu-devel] [RFC PATCH v2 0/8] block: Asynchronous request cancellation, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 1/8] block: Add refcnt in BlockDriverAIOCB, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 2/8] block: Add bdrv_aio_cancel_async, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 3/8] tests: Add testing code for bdrv_aio_cancel_async, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 4/8] linux-aio: Implement .cancel_async, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 5/8] thread-pool: Implement .cancel_async, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 6/8] dma: Implement .cancel_async, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 7/8] block: Implement bdrv_em_co_aiocb_info.cancel_async, Fam Zheng, 2014/08/26
- [Qemu-devel] [RFC PATCH v2 8/8] iscsi: Implement .cancel_async in acb info, Fam Zheng, 2014/08/26