[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated() |
Date: |
Mon, 24 Jun 2013 10:13:43 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Jun 21, 2013 at 11:18:42AM +0200, Kevin Wolf wrote:
> Am 20.06.2013 um 20:20 hat Peter Lieven geschrieben:
> > @@ -800,6 +801,60 @@ iscsi_getlength(BlockDriverState *bs)
> > return len;
> > }
> >
> > +static int coroutine_fn iscsi_co_is_allocated(BlockDriverState *bs,
> > + int64_t sector_num,
> > + int nb_sectors, int *pnum)
> > +{
> > + IscsiLun *iscsilun = bs->opaque;
> > + struct scsi_task *task = NULL;
> > + struct scsi_get_lba_status *lbas = NULL;
> > + struct scsi_lba_status_descriptor *lbasd = NULL;
> > + int ret;
> > +
> > + *pnum = nb_sectors;
> > +
> > + if (iscsilun->lbpme == 0) {
> > + return 1;
> > + }
> > +
> > + /* in-flight requests could invalidate the lba status result */
> > + while (iscsi_process_flush(iscsilun)) {
> > + qemu_aio_wait();
> > + }
>
> Note that you're blocking here. The preferred way would be something
> involving a yield from the coroutine and a reenter as soon as all
> requests are done. Maybe a CoRwLock does what you need?
The other option is to avoid synchronization here and instead process
bs->tracked_requests so that any in-flight writes count as allocated.
Stefan
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), (continued)
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Paolo Bonzini, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Peter Lieven, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), ronnie sahlberg, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Peter Lieven, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), ronnie sahlberg, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Paolo Bonzini, 2013/06/21
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(),
Stefan Hajnoczi <=
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Paolo Bonzini, 2013/06/24
- Re: [Qemu-devel] [PATCH 1/2] iscsi: add support for bdrv_co_is_allocated(), Peter Lieven, 2013/06/24
[Qemu-devel] [PATCH 2/2] iscsi: add intelligent has_zero_init check, Peter Lieven, 2013/06/20
[Qemu-devel] [PATCH 0/2] iscsi: support for is_allocated and inproved has_zero_init, Peter Lieven, 2013/06/20