qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block/mirror: enable detect zeroes when driving


From: wyang
Subject: Re: [Qemu-devel] [PATCH] block/mirror: enable detect zeroes when driving mirror
Date: Tue, 22 Nov 2016 10:31:56 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 2016年11月21日 14:51, Vasiliy Tolstov wrote:

21 Ноя 2016 г. 4:27 пользователь "Yang Wei" <address@hidden <mailto:address@hidden>> написал:
>
> In order to preserve sparse disk image, detect_zeroes
> should also be enabled when bdrv_get_block_status_above()
> returns BDRV_BLOCK_DATA
>
> Signed-off-by: Yang Wei <address@hidden <mailto:address@hidden>>
> ---

Hi, does this patch fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=1219541 ? Or it unrelated to this issue?

yes, you also need to backport the functionality of NBD's write zeroes( fa778f and 1f4d6d)

Thanks
Wei


>  block/mirror.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index b2c1fb8..8b20b7a 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -76,6 +76,7 @@ typedef struct MirrorOp {
>      QEMUIOVector qiov;
>      int64_t sector_num;
>      int nb_sectors;
> +    BlockdevDetectZeroesOptions backup_detect_zeroes;
>  } MirrorOp;
>
> static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, > @@ -132,6 +133,8 @@ static void mirror_write_complete(void *opaque, int ret)
>  {
>      MirrorOp *op = opaque;
>      MirrorBlockJob *s = op->s;
> +    BlockDriverState *target = s->target;
> +    target->detect_zeroes = op->backup_detect_zeroes;
>      if (ret < 0) {
>          BlockErrorAction action;
>
> @@ -148,6 +151,7 @@ static void mirror_read_complete(void *opaque, int ret)
>  {
>      MirrorOp *op = opaque;
>      MirrorBlockJob *s = op->s;
> +    BlockDriverState *target = s->target;
>      if (ret < 0) {
>          BlockErrorAction action;
>
> @@ -160,6 +164,9 @@ static void mirror_read_complete(void *opaque, int ret)
>          mirror_iteration_done(op, ret);
>          return;
>      }
> +    op->backup_detect_zeroes = target->detect_zeroes;
> + target->detect_zeroes = s->unmap ? BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP :
> +        BLOCKDEV_DETECT_ZEROES_OPTIONS_ON;
> blk_aio_pwritev(s->target, op->sector_num * BDRV_SECTOR_SIZE, &op->qiov,
>                      0, mirror_write_complete, op);
>  }
> --
> 2.10.2
>
>




reply via email to

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