From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7 06/19] scsi-disk: Switch to byte-based aio block access
Date: Tue, 10 May 2016 10:55:44 +0200 [thread overview]
Message-ID: <20160510085544.GE4921@noname.str.redhat.com> (raw)
In-Reply-To: <1462552005-4887-7-git-send-email-eblake@redhat.com>
Am 06.05.2016 um 18:26 hat Eric Blake geschrieben:
> Sector-based blk_aio_readv() and blk_aio_writev() should die; switch
> to byte-based blk_aio_preadv() and blk_aio_pwritev() instead.
>
> As part of the cleanup, scsi_init_iovec() no longer needs to return
> a value, and reword a comment.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> v7: remove more unused 'n', fix comment wording
> ---
> hw/scsi/scsi-disk.c | 41 ++++++++++++++++++++---------------------
> 1 file changed, 20 insertions(+), 21 deletions(-)
>
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index 1335392..d6bb9ad 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -108,7 +108,7 @@ static void scsi_check_condition(SCSIDiskReq *r, SCSISense sense)
> scsi_req_complete(&r->req, CHECK_CONDITION);
> }
>
> -static uint32_t scsi_init_iovec(SCSIDiskReq *r, size_t size)
> +static void scsi_init_iovec(SCSIDiskReq *r, size_t size)
> {
> SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
>
> @@ -118,7 +118,6 @@ static uint32_t scsi_init_iovec(SCSIDiskReq *r, size_t size)
> }
> r->iov.iov_len = MIN(r->sector_count * 512, r->buflen);
> qemu_iovec_init_external(&r->qiov, &r->iov, 1);
> - return r->qiov.size / 512;
The return value was MIN(r->sector_count, SCSI_DMA_BUF_SIZE / 512).
> }
>
> static void scsi_disk_save_request(QEMUFile *f, SCSIRequest *req)
> @@ -316,7 +315,6 @@ done:
> static void scsi_do_read(SCSIDiskReq *r, int ret)
> {
> SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
> - uint32_t n;
>
> assert (r->req.aiocb == NULL);
>
> @@ -340,11 +338,12 @@ static void scsi_do_read(SCSIDiskReq *r, int ret)
> r->req.aiocb = dma_blk_read(s->qdev.conf.blk, r->req.sg, r->sector,
> scsi_dma_complete, r);
> } else {
> - n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE);
> + scsi_init_iovec(r, SCSI_DMA_BUF_SIZE);
> block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct,
> - n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);
> - r->req.aiocb = blk_aio_readv(s->qdev.conf.blk, r->sector, &r->qiov, n,
> - scsi_read_complete, r);
> + SCSI_DMA_BUF_SIZE, BLOCK_ACCT_READ);
But here you use SCSI_DMA_BUF_SIZE without considering r->sector_count.
Is this correct or are requests that are smaller than SCSI_DMA_BUF_SIZE
now accounted for more data than they actually read?
Would r->qiov.size be more obviously correct? You did that for writes.
> + r->req.aiocb = blk_aio_preadv(s->qdev.conf.blk,
> + r->sector << BDRV_SECTOR_BITS, &r->qiov,
> + 0, scsi_read_complete, r);
> }
>
> done:
Kevin
next prev parent reply other threads:[~2016-05-10 8:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 16:26 [Qemu-devel] [PATCH v7 00/19] block: kill sector-based blk_write/read Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 01/19] block: Allow BDRV_REQ_FUA through blk_pwrite() Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 02/19] block: Switch blk_read_unthrottled() to byte interface Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 03/19] block: Switch blk_*write_zeroes() " Eric Blake
2016-05-23 15:42 ` Kevin Wolf
2016-05-23 16:03 ` Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 04/19] block: Introduce byte-based aio read/write Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 05/19] ide: Switch to byte-based aio block access Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 06/19] scsi-disk: " Eric Blake
2016-05-10 8:55 ` Kevin Wolf [this message]
2016-05-10 12:56 ` Eric Blake
2016-05-10 14:49 ` Kevin Wolf
2016-05-12 11:25 ` Paolo Bonzini
2016-05-12 11:26 ` Paolo Bonzini
2016-05-12 16:58 ` Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 07/19] virtio: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 08/19] xen_disk: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 09/19] fdc: Switch to byte-based " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 10/19] nand: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 11/19] onenand: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 12/19] pflash: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 13/19] sd: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 14/19] m25p80: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 15/19] atapi: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 16/19] nbd: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 17/19] qemu-img: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 18/19] qemu-io: " Eric Blake
2016-05-06 16:26 ` [Qemu-devel] [PATCH v7 19/19] block: Kill unused sector-based blk_* functions Eric Blake
2016-05-10 8:56 ` [Qemu-devel] [PATCH v7 00/19] block: kill sector-based blk_write/read Kevin Wolf
2016-05-10 15:06 ` Kevin Wolf
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=20160510085544.GE4921@noname.str.redhat.com \
--to=kwolf@redhat.com \
--cc=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).