qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 回复: [PATCH v2 3/3] scsi-disk: Add support for the GET LBA STATUS 16


From: Paolo Bonzini
Subject: Re: 回复: [PATCH v2 3/3] scsi-disk: Add support for the GET LBA STATUS 16 command
Date: Wed, 8 Jul 2020 14:38:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 08/07/20 14:29, Stefan Hajnoczi wrote:
> Something similar is needed for GET_LBA_STATUS. Since there is no
> bdrv_aio_block_status() you can create a coroutine instead of an aiocb:
> 
>   static void coroutine_fn scsi_co_block_status(void *opaque)
>   {
>       int ret;
> 
>       aio_context_acquire(blk_get_aio_context(s->qdev.conf.blk));
> 
>       ret = bdrv_co_block_status(...);
> 
>       ...fill in outbuf...
> 
>       scsi_req_complete(&r->req, GOOD);
> 
>       aio_context_release(blk_get_aio_context(s->qdev.conf.blk));
> 
>       scsi_req_unref(&r->req);
>   }
> 
>   ...in scsi_disk_emulate_command()...
>   scsi_req_ref(&r->req);
>   co = qemu_coroutine_create(scsi_co_block_status, r);
>   aio_co_schedule(blk_get_aio_context(s->qdev.conf.blk), co);
>   return 0;
> 
> This is just a sketch, I haven't checked the details. The trickiest
> issue is probably how to deal with r->req.aiocb, which is normally set
> for async requests. It will be necessary to study the code to figure out
> a solution because there is no BlockAIOCB in this case (we're using a
> coroutine instead).

It's probably simplest to put the code above in block/block-backend.c,
in the form of blk_aio_block_status which would follow what is done in
blk_aio_prwv.

Paolo

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]