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
signature.asc
Description: OpenPGP digital signature