All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.6 2/2] block: Fix blk_aio_write_zeroes()
Date: Fri, 15 Apr 2016 01:30:09 +0200	[thread overview]
Message-ID: <57102801.1050303@redhat.com> (raw)
In-Reply-To: <1460545601-29196-3-git-send-email-kwolf@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2038 bytes --]

On 13.04.2016 13:06, Kevin Wolf wrote:
> Commit 57d6a428 broke blk_aio_write_zeroes() because in some write
> functions in the call path don't have an explicit length argument but
> reuse qiov->size instead. Which is great, except that write_zeroes
> doesn't have a qiov, which this commit interprets as 0 bytes.
> Consequently, blk_aio_write_zeroes() didn't effectively do anything.

You mean it has written null data? :-)

Alternative version: So it has written zero bytes? Works as intended, then.

> 
> This patch introduces an explicit acb->bytes in BlkAioEmAIOCB and uses
> that instead of acb->rwco.size.
> 
> The synchronous version of the function is okay because it does pass a
> qiov (with the right size and a NULL pointer as its base).
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/block-backend.c      | 20 +++++++----
>  tests/qemu-iotests/033     |  8 +++--
>  tests/qemu-iotests/033.out | 82 ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 100 insertions(+), 10 deletions(-)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index d74f670..140c3f7 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c

[...]

> @@ -937,7 +940,8 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
>          return blk_abort_aio_request(blk, cb, opaque, -EINVAL);
>      }
>  
> -    return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS, NULL,
> +    return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS,
> +                        nb_sectors << BDRV_SECTOR_BITS, NULL,
>                          blk_aio_write_entry, BDRV_REQ_ZERO_WRITE, cb, opaque);
>  }

Another thing about blk_aio_write_zeroes() that might need fixing is
that it completely ignores its flags parameter.

That can be done in a seperate patch, however (and is probably not
critical, as this currently just means that a potential REQ_MAY_UNMAP
from scsi-disk is ignored), so:

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-04-14 23:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 11:06 [Qemu-devel] [PATCH for-2.6 0/2] block: Fix blk_aio_write_zeroes() Kevin Wolf
2016-04-13 11:06 ` [Qemu-devel] [PATCH for-2.6 1/2] qemu-io: Support 'aio_write -z' Kevin Wolf
2016-04-14 23:14   ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-15  8:18     ` Kevin Wolf
2016-04-14 23:24   ` Max Reitz
2016-04-13 11:06 ` [Qemu-devel] [PATCH for-2.6 2/2] block: Fix blk_aio_write_zeroes() Kevin Wolf
2016-04-14 23:30   ` Max Reitz [this message]
2016-04-15  8:34     ` [Qemu-devel] [Qemu-block] " 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=57102801.1050303@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.