From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, Lin Ma <LMa@suse.com>
Cc: "'fam@euphon.net'" <fam@euphon.net>,
"'kwolf@redhat.com'" <kwolf@redhat.com>,
"'qemu-devel@nongnu.org'" <qemu-devel@nongnu.org>,
"'mreitz@redhat.com'" <mreitz@redhat.com>
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 [thread overview]
Message-ID: <134f2a0d-98ba-5a9a-3d8b-b0efeb8cd582@redhat.com> (raw)
In-Reply-To: <20200708122925.GF459887@stefanha-x1.localdomain>
[-- Attachment #1.1: Type: text/plain, Size: 1304 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-07-08 22:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 10:30 [PATCH v2 0/3] Add Support for GET LBA STATUS 16 command in scsi emulation Lin Ma
2020-06-17 10:30 ` [PATCH v2 1/3] block: Add bdrv_co_get_lba_status Lin Ma
2020-06-22 10:25 ` Stefan Hajnoczi
2020-06-17 10:30 ` [PATCH v2 2/3] block: Add GET LBA STATUS support Lin Ma
2020-06-17 10:30 ` [PATCH v2 3/3] scsi-disk: Add support for the GET LBA STATUS 16 command Lin Ma
2020-06-22 12:14 ` Stefan Hajnoczi
2020-06-29 9:18 ` 回复: " Lin Ma
2020-07-08 12:29 ` Stefan Hajnoczi
2020-07-08 12:38 ` Paolo Bonzini [this message]
2020-06-17 11:14 ` [PATCH v2 0/3] Add Support for GET LBA STATUS 16 command in scsi emulation no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=134f2a0d-98ba-5a9a-3d8b-b0efeb8cd582@redhat.com \
--to=pbonzini@redhat.com \
--cc=LMa@suse.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).