From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8iS1-0001NR-Rn for qemu-devel@nongnu.org; Mon, 21 Nov 2016 01:51:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8iRy-0007aH-NR for qemu-devel@nongnu.org; Mon, 21 Nov 2016 01:51:37 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35224) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c8iRy-0007Zq-9f for qemu-devel@nongnu.org; Mon, 21 Nov 2016 01:51:34 -0500 Received: by mail-wm0-x241.google.com with SMTP id a20so24196954wme.2 for ; Sun, 20 Nov 2016 22:51:33 -0800 (PST) MIME-Version: 1.0 Sender: vase@selfip.ru In-Reply-To: <20161121012439.2394-1-w90p710@gmail.com> References: <20161121012439.2394-1-w90p710@gmail.com> From: Vasiliy Tolstov Date: Mon, 21 Nov 2016 09:51:30 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block/mirror: enable detect zeroes when driving mirror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Wei Cc: qemu-devel@nongnu.org, jcody@redhat.com, qemu-block@nongnu.org 21 =D0=9D=D0=BE=D1=8F 2016 =D0=B3. 4:27 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0= =BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C "Yang Wei" =D0= =BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > > 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 > --- Hi, does this patch fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=3D1219541 ? Or it unrelated to this issue? > 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 =3D opaque; > MirrorBlockJob *s =3D op->s; > + BlockDriverState *target =3D s->target; > + target->detect_zeroes =3D op->backup_detect_zeroes; > if (ret < 0) { > BlockErrorAction action; > > @@ -148,6 +151,7 @@ static void mirror_read_complete(void *opaque, int ret) > { > MirrorOp *op =3D opaque; > MirrorBlockJob *s =3D op->s; > + BlockDriverState *target =3D 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 =3D target->detect_zeroes; > + target->detect_zeroes =3D 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 > >