From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532963757978879.9370378031846; Mon, 30 Jul 2018 08:15:57 -0700 (PDT) Received: from localhost ([::1]:53168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9ts-0007gb-P6 for importer@patchew.org; Mon, 30 Jul 2018 11:15:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oJ-00037V-0X for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oE-00088Q-Sk for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33844 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oC-00086W-Oo; Mon, 30 Jul 2018 11:10:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6702340201A3; Mon, 30 Jul 2018 15:10:04 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49321112D189; Mon, 30 Jul 2018 15:10:02 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:46 +0200 Message-Id: <20180730150958.14607-2-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 30 Jul 2018 15:10:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 30 Jul 2018 15:10:04 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 01/13] qcow: fix a reference leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: KONRAD Frederic Since 42a3e1ab367cdf38cce093de24eb406b99a4ef96 qemu asserts when using the vvfat driver: git clone git://qemu.org/qemu.git cd qemu ./configure --target-list=3Dppc-softmmu --enable-debug make -j8 mkdir foo touch foo/hello ./ppc-softmmu/qemu-system-ppc -M prep --nographic --monitor null = \ -hda fat:rw:./foo "Ctrl-C" qemu-system-ppc: block.c:3368: bdrv_close_all: Assertion = \ `((&all_bdrv_states)->tqh_first =3D=3D ((void *)0))' failed. This is because we reference bs twice in qcow_co_create(..) one time in bdrv_open_blockdev_ref(..) and in blk_insert_bs(..) but we unref it only on= ce in blk_unref which leads to the reference leak. Note that I didn't tested much QCOW after this change as I don't use it muc= h. Signed-off-by: KONRAD Frederic Signed-off-by: Kevin Wolf --- block/qcow.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/qcow.c b/block/qcow.c index 102d058d1c..385d935258 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -938,6 +938,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOp= tions *opts, ret =3D 0; exit: blk_unref(qcow_blk); + bdrv_unref(bs); qcrypto_block_free(crypto); return ret; } --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153296354914173.20615363663615; Mon, 30 Jul 2018 08:12:29 -0700 (PDT) Received: from localhost ([::1]:53149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9qS-0004n0-Vh for importer@patchew.org; Mon, 30 Jul 2018 11:12:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oH-00034m-R2 for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oG-00089d-J0 for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51188 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oD-00087N-Sy; Mon, 30 Jul 2018 11:10:06 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E9798198B01; Mon, 30 Jul 2018 15:10:05 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1E59112D189; Mon, 30 Jul 2018 15:10:04 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:47 +0200 Message-Id: <20180730150958.14607-3-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 30 Jul 2018 15:10:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 30 Jul 2018 15:10:05 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/13] qcow2: A grammar fix in conflicting cache sizing error message X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Leonid Bloch Signed-off-by: Leonid Bloch Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- block/qcow2.c | 2 +- tests/qemu-iotests/103.out | 4 ++-- tests/qemu-iotests/137.out | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 6162ed8be2..ec9e6238a0 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -797,7 +797,7 @@ static void read_cache_sizes(BlockDriverState *bs, Qemu= Opts *opts, if (l2_cache_size_set && refcount_cache_size_set) { error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_= SIZE " and " QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not be = set " - "the same time"); + "at the same time"); return; } else if (*l2_cache_size > combined_cache_size) { error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed " diff --git a/tests/qemu-iotests/103.out b/tests/qemu-iotests/103.out index bd45d3875a..bd9eec3250 100644 --- a/tests/qemu-iotests/103.out +++ b/tests/qemu-iotests/103.out @@ -5,10 +5,10 @@ wrote 65536/65536 bytes at offset 0 =20 =3D=3D=3D Testing invalid option combinations =3D=3D=3D =20 -can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcoun= t-cache-size may not be set the same time +can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcoun= t-cache-size may not be set at the same time can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-si= ze can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed ca= che-size -can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcoun= t-cache-size may not be set the same time +can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcoun= t-cache-size may not be set at the same time can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power o= f two between 512 and the cluster size (65536) can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power o= f two between 512 and the cluster size (65536) can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power o= f two between 512 and the cluster size (65536) diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index 96724a6c33..6a2ffc71fd 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -16,7 +16,7 @@ read 33554432/33554432 bytes at offset 0 =3D=3D=3D Try setting some invalid values =3D=3D=3D =20 Parameter 'lazy-refcounts' expects 'on' or 'off' -cache-size, l2-cache-size and refcount-cache-size may not be set the same = time +cache-size, l2-cache-size and refcount-cache-size may not be set at the sa= me time l2-cache-size may not exceed cache-size refcount-cache-size may not exceed cache-size L2 cache size too big --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532963693881185.2485468375545; Mon, 30 Jul 2018 08:14:53 -0700 (PDT) Received: from localhost ([::1]:53162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9sn-0006VK-Pa for importer@patchew.org; Mon, 30 Jul 2018 11:14:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oO-0003GF-97 for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oM-0008Hj-5Z for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45510 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oE-000887-Un; Mon, 30 Jul 2018 11:10:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 911D5CFB54; Mon, 30 Jul 2018 15:10:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8E89112D189; Mon, 30 Jul 2018 15:10:05 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:48 +0200 Message-Id: <20180730150958.14607-4-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:06 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 03/13] file-posix: Handle EINTR in preallocation=full write X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Cc: qemu-stable@nongnu.org Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- block/file-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index ad299beb38..928b863ced 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1646,6 +1646,9 @@ static int handle_aiocb_truncate(RawPosixAIOData *aio= cb) num =3D MIN(left, 65536); result =3D write(fd, buf, num); if (result < 0) { + if (errno =3D=3D EINTR) { + continue; + } result =3D -errno; error_setg_errno(errp, -result, "Could not write zeros for preallocation"= ); --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532963943180595.7662674423443; Mon, 30 Jul 2018 08:19:03 -0700 (PDT) Received: from localhost ([::1]:53188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9wo-0001Jh-K1 for importer@patchew.org; Mon, 30 Jul 2018 11:18:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oN-0003Dt-2H for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oM-0008Hr-6F for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45516 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oG-00089C-8H; Mon, 30 Jul 2018 11:10:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A473ACFB54; Mon, 30 Jul 2018 15:10:07 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE867112D189; Mon, 30 Jul 2018 15:10:06 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:49 +0200 Message-Id: <20180730150958.14607-5-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:07 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 04/13] docs: Describe using images in writing iotests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- docs/devel/testing.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 5e19cd50da..8e1fa3a66e 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -255,6 +255,17 @@ comparable library support for invoking and interactin= g with QEMU programs. If you opt for Python, it is strongly recommended to write Python 3 compatible code. =20 +Both Python and Bash frameworks in iotests provide helpers to manage test +images. They can be used to create and clean up images under the test +directory. If no I/O or any protocol specific feature is needed, it is oft= en +more convenient to use the pseudo block driver, ``null-co://``, as the test +image, which doesn't require image creation or cleaning up. Avoid system-w= ide +devices or files whenever possible, such as ``/dev/null`` or ``/dev/zero``. +Otherwise, image locking implications have to be considered. For example, +another application on the host may have locked the file, possibly leading= to a +test failure. If using such devices are explicitly desired, consider addi= ng +``locking=3Doff`` option to disable image locking. + Docker based tests =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964025004129.74415709480127; Mon, 30 Jul 2018 08:20:25 -0700 (PDT) Received: from localhost ([::1]:53194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9yB-0002KZ-Tb for importer@patchew.org; Mon, 30 Jul 2018 11:20:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oS-0003KW-3O for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oN-0008In-9C for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36900 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oI-0008CT-Pp; Mon, 30 Jul 2018 11:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 591654219DBA; Mon, 30 Jul 2018 15:10:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id E06DF112D189; Mon, 30 Jul 2018 15:10:07 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:50 +0200 Message-Id: <20180730150958.14607-6-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 30 Jul 2018 15:10:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 30 Jul 2018 15:10:10 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 05/13] iotests: Don't lock /dev/null in 226 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng On my system (Fedora 28), this script reports a 'failed to get "consistent read" lock' error. Following docs/devel/testing.rst, it's better to add locking=3Doff here. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/226 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/226 b/tests/qemu-iotests/226 index 211ea9888a..8ec3e612dd 100755 --- a/tests/qemu-iotests/226 +++ b/tests/qemu-iotests/226 @@ -56,10 +56,10 @@ for PROTO in "file" "host_device" "host_cdrom"; do echo echo "=3D=3D Testing RO =3D=3D" $QEMU_IO -c "open -r -o driver=3D$PROTO,filename=3D$TEST_IMG" 2>&1 | _= filter_testdir | _filter_imgfmt - $QEMU_IO -c "open -r -o driver=3D$PROTO,filename=3D/dev/null" 2>&1 | _= filter_imgfmt + $QEMU_IO -c "open -r -o driver=3D$PROTO,filename=3D/dev/null,locking= =3Doff" 2>&1 | _filter_imgfmt echo "=3D=3D Testing RW =3D=3D" $QEMU_IO -c "open -o driver=3D$PROTO,filename=3D$TEST_IMG" 2>&1 | _fil= ter_testdir | _filter_imgfmt - $QEMU_IO -c "open -o driver=3D$PROTO,filename=3D/dev/null" 2>&1 | _fil= ter_imgfmt + $QEMU_IO -c "open -o driver=3D$PROTO,filename=3D/dev/null,locking=3Dof= f" 2>&1 | _filter_imgfmt done =20 # success, all done --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532963707658179.1615538799632; Mon, 30 Jul 2018 08:15:07 -0700 (PDT) Received: from localhost ([::1]:53164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9t4-0006k1-FG for importer@patchew.org; Mon, 30 Jul 2018 11:15:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oS-0003KV-1Z for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oN-0008Ih-7m for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45524 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oJ-0008EV-Ut; Mon, 30 Jul 2018 11:10:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 663805BCB6; Mon, 30 Jul 2018 15:10:11 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 877DF112D189; Mon, 30 Jul 2018 15:10:10 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:51 +0200 Message-Id: <20180730150958.14607-7-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:11 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 06/13] Revert "qemu-img: Document copy offloading implications with -S and -c" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng This reverts commit eb461485f4558e362fab905735b50987505bca44. Now that we introduce an explicit option, these implicit rules are not used. Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- qemu-img.texi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qemu-img.texi b/qemu-img.texi index 5853cd18d1..aeb1b9e66c 100644 --- a/qemu-img.texi +++ b/qemu-img.texi @@ -96,8 +96,7 @@ will enumerate information about backing files in a disk = image chain. Refer below for further description. =20 @item -c -indicates that target image must be compressed (qcow format only). If this -option is used, copy offloading will not be attempted. +indicates that target image must be compressed (qcow format only) =20 @item -h with or without a command shows help and lists the supported formats @@ -116,8 +115,7 @@ in case both @var{-q} and @var{-p} options are used. indicates the consecutive number of bytes that must contain only zeros for qemu-img to create a sparse image during conversion. This value is rou= nded down to the nearest 512 bytes. You may use the common size suffixes like -@code{k} for kilobytes. If this option is used, copy offloading will not be -attempted. +@code{k} for kilobytes. =20 @item -t @var{cache} specifies the cache mode that should be used with the (destination) file. = See --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532963872358423.11495836507913; Mon, 30 Jul 2018 08:17:52 -0700 (PDT) Received: from localhost ([::1]:53184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9vd-0000bf-BW for importer@patchew.org; Mon, 30 Jul 2018 11:17:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oQ-0003Ix-8h for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oP-0008Jt-2S for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38574 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oK-0008GI-R9; Mon, 30 Jul 2018 11:10:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 775237C6CA; Mon, 30 Jul 2018 15:10:12 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CFB7112D189; Mon, 30 Jul 2018 15:10:11 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:52 +0200 Message-Id: <20180730150958.14607-8-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 15:10:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 15:10:12 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 07/13] qemu-img: Add -C option for convert with copy offloading X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- qemu-img.c | 21 +++++++++++++++++---- qemu-img-cmds.hx | 2 +- qemu-img.texi | 8 +++++++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 9b7506b8ae..1acddf693c 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2024,11 +2024,12 @@ static int img_convert(int argc, char **argv) skip_create =3D false, progress =3D false, tgt_image_opts =3D fal= se; int64_t ret =3D -EINVAL; bool force_share =3D false; + bool explict_min_sparse =3D false; =20 ImgConvertState s =3D (ImgConvertState) { /* Need at least 4k of zeros for sparse detection */ .min_sparse =3D 8, - .copy_range =3D true, + .copy_range =3D false, .buf_sectors =3D IO_BUF_SIZE / BDRV_SECTOR_SIZE, .wr_in_order =3D true, .num_coroutines =3D 8, @@ -2043,7 +2044,7 @@ static int img_convert(int argc, char **argv) {"target-image-opts", no_argument, 0, OPTION_TARGET_IMAGE_OPTS= }, {0, 0, 0, 0} }; - c =3D getopt_long(argc, argv, ":hf:O:B:co:l:S:pt:T:qnm:WU", + c =3D getopt_long(argc, argv, ":hf:O:B:Cco:l:S:pt:T:qnm:WU", long_options, NULL); if (c =3D=3D -1) { break; @@ -2067,9 +2068,11 @@ static int img_convert(int argc, char **argv) case 'B': out_baseimg =3D optarg; break; + case 'C': + s.copy_range =3D true; + break; case 'c': s.compressed =3D true; - s.copy_range =3D false; break; case 'o': if (!is_valid_option_list(optarg)) { @@ -2112,7 +2115,7 @@ static int img_convert(int argc, char **argv) } =20 s.min_sparse =3D sval / BDRV_SECTOR_SIZE; - s.copy_range =3D false; + explict_min_sparse =3D true; break; } case 'p': @@ -2172,6 +2175,16 @@ static int img_convert(int argc, char **argv) goto fail_getopt; } =20 + if (s.compressed && s.copy_range) { + error_report("Cannot enable copy offloading when -c is used"); + goto fail_getopt; + } + + if (explict_min_sparse && s.copy_range) { + error_report("Cannot enable copy offloading when -S is used"); + goto fail_getopt; + } + if (tgt_image_opts && !skip_create) { error_report("--target-image-opts requires use of -n flag"); goto fail_getopt; diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx index 69758fb6e8..1526f327a5 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx @@ -44,7 +44,7 @@ STEXI ETEXI =20 DEF("convert", img_convert, - "convert [--object objectdef] [--image-opts] [--target-image-opts] [-U= ] [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-= B backing_file] [-o options] [-l snapshot_param] [-S sparse_size] [-m num_c= oroutines] [-W] filename [filename2 [...]] output_filename") + "convert [--object objectdef] [--image-opts] [--target-image-opts] [-U= ] [-C] [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fm= t] [-B backing_file] [-o options] [-l snapshot_param] [-S sparse_size] [-m = num_coroutines] [-W] filename [filename2 [...]] output_filename") STEXI @item convert [--object @var{objectdef}] [--image-opts] [--target-image-op= ts] [-U] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_c= ache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-l= @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W= ] @var{filename} [@var{filename2} [...]] @var{output_filename} ETEXI diff --git a/qemu-img.texi b/qemu-img.texi index aeb1b9e66c..3b6710a580 100644 --- a/qemu-img.texi +++ b/qemu-img.texi @@ -169,6 +169,12 @@ Number of parallel coroutines for the convert process Allow out-of-order writes to the destination. This option improves perform= ance, but is only recommended for preallocated devices like host devices or other raw block devices. +@item -C +Try to use copy offloading to move data from source image to target. This = may +improve performance if the data is remote, such as with NFS or iSCSI backe= nds, +but will not automatically sparsify zero sectors, and may result in a fully +allocated target image depending on the host support for getting allocation +information. @end table =20 Parameters to dd subcommand: @@ -319,7 +325,7 @@ Error on reading data =20 @end table =20 -@item convert [--object @var{objectdef}] [--image-opts] [--target-image-op= ts] [-U] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_c= ache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-l= @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W= ] @var{filename} [@var{filename2} [...]] @var{output_filename} +@item convert [--object @var{objectdef}] [--image-opts] [--target-image-op= ts] [-U] [-C] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{= src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}= ] [-l @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}= ] [-W] @var{filename} [@var{filename2} [...]] @var{output_filename} =20 Convert the disk image @var{filename} or a snapshot @var{snapshot_param} to disk image @var{output_filename} using format @var{output_fmt}. It can = be optionally compressed (@code{-c} --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964181172260.2825102975502; Mon, 30 Jul 2018 08:23:01 -0700 (PDT) Received: from localhost ([::1]:53215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkA0W-0004Nh-56 for importer@patchew.org; Mon, 30 Jul 2018 11:22:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oV-0003NY-BZ for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oR-0008LD-Cq for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45532 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oM-0008HG-2N; Mon, 30 Jul 2018 11:10:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DCE8CFB54; Mon, 30 Jul 2018 15:10:13 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id B336B112D189; Mon, 30 Jul 2018 15:10:12 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:53 +0200 Message-Id: <20180730150958.14607-9-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:13 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 08/13] iotests: Add test for 'qemu-img convert -C' compatibility X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- tests/qemu-iotests/082 | 8 ++++++++ tests/qemu-iotests/082.out | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082 index a872f771a6..3e605d52d1 100755 --- a/tests/qemu-iotests/082 +++ b/tests/qemu-iotests/082 @@ -158,6 +158,14 @@ run_qemu_img convert -o help run_qemu_img convert -O bochs -o help =20 echo +echo =3D=3D=3D convert: -C and other options =3D=3D=3D + +# Adding the help option to a command without other -o options +run_qemu_img convert -C -S 4k -O $IMGFMT "$TEST_IMG" "$TEST_IMG".target +run_qemu_img convert -C -S 8k -O $IMGFMT "$TEST_IMG" "$TEST_IMG".target +run_qemu_img convert -C -c -O $IMGFMT "$TEST_IMG" "$TEST_IMG".target + +echo echo =3D=3D=3D amend: Options specified more than once =3D=3D=3D =20 # Last -f should win diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out index 60ef87c276..19e9fb13ff 100644 --- a/tests/qemu-iotests/082.out +++ b/tests/qemu-iotests/082.out @@ -508,6 +508,17 @@ size Virtual disk size Testing: convert -O bochs -o help qemu-img: Format driver 'bochs' does not support image creation =20 +=3D=3D=3D convert: -C and other options =3D=3D=3D + +Testing: convert -C -S 4k -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.target +qemu-img: Cannot enable copy offloading when -S is used + +Testing: convert -C -S 8k -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.target +qemu-img: Cannot enable copy offloading when -S is used + +Testing: convert -C -c -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.target +qemu-img: Cannot enable copy offloading when -c is used + =3D=3D=3D amend: Options specified more than once =3D=3D=3D =20 Testing: amend -f foo -f qcow2 -o lazy_refcounts=3Don TEST_DIR/t.qcow2 --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964290208457.7340397624454; Mon, 30 Jul 2018 08:24:50 -0700 (PDT) Received: from localhost ([::1]:53225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkA2T-0005f9-0m for importer@patchew.org; Mon, 30 Jul 2018 11:24:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oW-0003Og-Br for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oV-0008Nr-Fg for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38578 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oN-0008IH-1Q; Mon, 30 Jul 2018 11:10:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FEE57C6CA; Mon, 30 Jul 2018 15:10:14 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9207112D189; Mon, 30 Jul 2018 15:10:13 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:54 +0200 Message-Id: <20180730150958.14607-10-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 15:10:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 15:10:14 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/13] block: Fix documentation for BDRV_REQ_MAY_UNMAP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" BDRV_REQ_MAY_UNMAP in a write_zeroes request does not only allow the driver to unmap the blocks, but it actively requests that the blocks be unmapped afterwards if at all possible. Signed-off-by: Kevin Wolf --- include/block/block.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index f85e3a6ed3..4e0871aaf9 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -43,11 +43,12 @@ typedef struct BlockFragInfo { typedef enum { BDRV_REQ_COPY_ON_READ =3D 0x1, BDRV_REQ_ZERO_WRITE =3D 0x2, - /* The BDRV_REQ_MAY_UNMAP flag is used to indicate that the block driv= er - * is allowed to optimize a write zeroes request by unmapping (discard= ing) - * blocks if it is guaranteed that the result will read back as - * zeroes. The flag is only passed to the driver if the block device is - * opened with BDRV_O_UNMAP. + + /* + * The BDRV_REQ_MAY_UNMAP flag is used in write_zeroes requests to ind= icate + * that the block driver should unmap (discard) blocks if it is guaran= teed + * that the result will read back as zeroes. The flag is only passed t= o the + * driver if the block device is opened with BDRV_O_UNMAP. */ BDRV_REQ_MAY_UNMAP =3D 0x4, =20 --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964239379862.2008961895654; Mon, 30 Jul 2018 08:23:59 -0700 (PDT) Received: from localhost ([::1]:53223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkA1e-00059W-8L for importer@patchew.org; Mon, 30 Jul 2018 11:23:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oV-0003NW-BL for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oR-0008Kq-1d for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33852 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oO-0008JC-4B; Mon, 30 Jul 2018 11:10:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5EA94022909; Mon, 30 Jul 2018 15:10:15 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD673112D189; Mon, 30 Jul 2018 15:10:14 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:55 +0200 Message-Id: <20180730150958.14607-11-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 30 Jul 2018 15:10:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 30 Jul 2018 15:10:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 10/13] file-posix: Fix write_zeroes with unmap on block devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The BLKDISCARD ioctl doesn't guarantee that the discarded blocks read as all-zero afterwards, so don't try to abuse it for zero writing. We try to only use this if BLKDISCARDZEROES tells us that it is safe, but this is unreliable on older kernels and a constant 0 in newer kernels. In other words, this code path is never actually used with newer kernels, so we don't even try to unmap while writing zeros. This patch removes the abuse of discard for writing zeroes from file-posix and instead adds a new function that uses interfaces that are actually meant to deallocate and zero out at the same time. Only if those fail, it falls back to zeroing out without unmap. We never fall back to a discard operation any more that may or may not result in zeros. Signed-off-by: Kevin Wolf --- block/file-posix.c | 59 ++++++++++++++++++++++++++++++++++++++++----------= ---- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 928b863ced..fe83cbf0eb 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -648,7 +648,7 @@ static int raw_open_common(BlockDriverState *bs, QDict = *options, } #endif =20 - bs->supported_zero_flags =3D s->discard_zeroes ? BDRV_REQ_MAY_UNMAP : = 0; + bs->supported_zero_flags =3D BDRV_REQ_MAY_UNMAP; ret =3D 0; fail: if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { @@ -1487,6 +1487,35 @@ static ssize_t handle_aiocb_write_zeroes(RawPosixAIO= Data *aiocb) return -ENOTSUP; } =20 +static ssize_t handle_aiocb_write_zeroes_unmap(RawPosixAIOData *aiocb) +{ + BDRVRawState *s G_GNUC_UNUSED =3D aiocb->bs->opaque; + int ret; + + /* First try to write zeros and unmap at the same time */ + +#ifdef CONFIG_FALLOCATE_PUNCH_HOLE + ret =3D do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, + aiocb->aio_offset, aiocb->aio_nbytes); + if (ret !=3D -ENOTSUP) { + return ret; + } +#endif + +#ifdef CONFIG_XFS + if (s->is_xfs) { + /* xfs_discard() guarantees that the discarded area reads as all-z= ero + * afterwards, so we can use it here. */ + return xfs_discard(s, aiocb->aio_offset, aiocb->aio_nbytes); + } +#endif + + /* If we couldn't manage to unmap while guaranteed that the area reads= as + * all-zero afterwards, just write zeroes without unmapping */ + ret =3D handle_aiocb_write_zeroes(aiocb); + return ret; +} + #ifndef HAVE_COPY_FILE_RANGE static off_t copy_file_range(int in_fd, off_t *in_off, int out_fd, off_t *out_off, size_t len, unsigned int flag= s) @@ -1732,6 +1761,9 @@ static int aio_worker(void *arg) case QEMU_AIO_WRITE_ZEROES: ret =3D handle_aiocb_write_zeroes(aiocb); break; + case QEMU_AIO_WRITE_ZEROES | QEMU_AIO_DISCARD: + ret =3D handle_aiocb_write_zeroes_unmap(aiocb); + break; case QEMU_AIO_COPY_RANGE: ret =3D handle_aiocb_copy_range(aiocb); break; @@ -2556,15 +2588,13 @@ static int coroutine_fn raw_co_pwrite_zeroes( int bytes, BdrvRequestFlags flags) { BDRVRawState *s =3D bs->opaque; + int operation =3D QEMU_AIO_WRITE_ZEROES; =20 - if (!(flags & BDRV_REQ_MAY_UNMAP)) { - return paio_submit_co(bs, s->fd, offset, NULL, bytes, - QEMU_AIO_WRITE_ZEROES); - } else if (s->discard_zeroes) { - return paio_submit_co(bs, s->fd, offset, NULL, bytes, - QEMU_AIO_DISCARD); + if (flags & BDRV_REQ_MAY_UNMAP) { + operation |=3D QEMU_AIO_DISCARD; } - return -ENOTSUP; + + return paio_submit_co(bs, s->fd, offset, NULL, bytes, operation); } =20 static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) @@ -3057,20 +3087,19 @@ static coroutine_fn int hdev_co_pwrite_zeroes(Block= DriverState *bs, int64_t offset, int bytes, BdrvRequestFlags flags) { BDRVRawState *s =3D bs->opaque; + int operation =3D QEMU_AIO_WRITE_ZEROES | QEMU_AIO_BLKDEV; int rc; =20 rc =3D fd_open(bs); if (rc < 0) { return rc; } - if (!(flags & BDRV_REQ_MAY_UNMAP)) { - return paio_submit_co(bs, s->fd, offset, NULL, bytes, - QEMU_AIO_WRITE_ZEROES|QEMU_AIO_BLKDEV); - } else if (s->discard_zeroes) { - return paio_submit_co(bs, s->fd, offset, NULL, bytes, - QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV); + + if (flags & BDRV_REQ_MAY_UNMAP) { + operation |=3D QEMU_AIO_DISCARD; } - return -ENOTSUP; + + return paio_submit_co(bs, s->fd, offset, NULL, bytes, operation); } =20 static int coroutine_fn hdev_co_create_opts(const char *filename, QemuOpts= *opts, --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964113165287.7828712459633; Mon, 30 Jul 2018 08:21:53 -0700 (PDT) Received: from localhost ([::1]:53213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9zb-0003UI-Tj for importer@patchew.org; Mon, 30 Jul 2018 11:21:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oV-0003NV-Ag for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oR-0008LR-Hb for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49264 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oP-0008Jo-6P; Mon, 30 Jul 2018 11:10:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA08640216FE; Mon, 30 Jul 2018 15:10:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2682112D189; Mon, 30 Jul 2018 15:10:15 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:56 +0200 Message-Id: <20180730150958.14607-12-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 30 Jul 2018 15:10:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 30 Jul 2018 15:10:16 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 11/13] block/qapi: Add 'qdev' field to query-blockstats result X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Like for query-block, the client needs to identify which BlockBackend the returned data is for. Anonymous BlockBackends are identified by the device model they are attached to. Add a 'qdev' field that contains the qdev ID or QOM path of the attached device model. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- qapi/block-core.json | 14 ++++++++++---- block/qapi.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index d40d5ecc3b..5b9084a394 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -866,6 +866,9 @@ # # @node-name: The node name of the device. (Since 2.3) # +# @qdev: The qdev ID, or if no ID is assigned, the QOM path of the block +# device. (since 3.0) +# # @stats: A @BlockDeviceStats for the device. # # @parent: This describes the file block device if it has one. @@ -879,7 +882,7 @@ # Since: 0.14.0 ## { 'struct': 'BlockStats', - 'data': {'*device': 'str', '*node-name': 'str', + 'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str', 'stats': 'BlockDeviceStats', '*parent': 'BlockStats', '*backing': 'BlockStats'} } @@ -941,7 +944,8 @@ # "idle_time_ns":2953431879, # "account_invalid":true, # "account_failed":false -# } +# }, +# "qdev": "/machine/unattached/device[23]" # }, # { # "device":"ide1-cd0", @@ -959,7 +963,8 @@ # "wr_merged":0, # "account_invalid":false, # "account_failed":false -# } +# }, +# "qdev": "/machine/unattached/device[24]" # }, # { # "device":"floppy0", @@ -977,7 +982,8 @@ # "wr_merged":0, # "account_invalid":false, # "account_failed":false -# } +# }, +# "qdev": "/machine/unattached/device[16]" # }, # { # "device":"sd0", diff --git a/block/qapi.c b/block/qapi.c index e12968fec8..50f867d634 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -597,11 +597,21 @@ BlockStatsList *qmp_query_blockstats(bool has_query_n= odes, BlockStatsList *info =3D g_malloc0(sizeof(*info)); AioContext *ctx =3D blk_get_aio_context(blk); BlockStats *s; + char *qdev; =20 aio_context_acquire(ctx); s =3D bdrv_query_bds_stats(blk_bs(blk), true); s->has_device =3D true; s->device =3D g_strdup(blk_name(blk)); + + qdev =3D blk_get_attached_dev_id(blk); + if (qdev && *qdev) { + s->has_qdev =3D true; + s->qdev =3D qdev; + } else { + g_free(qdev); + } + bdrv_query_blk_stats(s->stats, blk); aio_context_release(ctx); =20 --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964385499752.035964218732; Mon, 30 Jul 2018 08:26:25 -0700 (PDT) Received: from localhost ([::1]:53237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkA40-0007Qg-D7 for importer@patchew.org; Mon, 30 Jul 2018 11:26:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oW-0003OY-7x for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oV-0008Nm-Eq for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45538 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oQ-0008KI-8n; Mon, 30 Jul 2018 11:10:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC554CFB58; Mon, 30 Jul 2018 15:10:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12ADD112D189; Mon, 30 Jul 2018 15:10:16 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:57 +0200 Message-Id: <20180730150958.14607-13-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 15:10:17 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 12/13] block/qapi: Include anonymous BBs in query-blockstats X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Consistent with query-block, query-blockstats should not only include named BlockBackends, but also those that are anonymous, but belong to a device model. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/qapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/qapi.c b/block/qapi.c index 50f867d634..339727f0f4 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -593,12 +593,16 @@ BlockStatsList *qmp_query_blockstats(bool has_query_n= odes, p_next =3D &info->next; } } else { - for (blk =3D blk_next(NULL); blk; blk =3D blk_next(blk)) { + for (blk =3D blk_all_next(NULL); blk; blk =3D blk_all_next(blk)) { BlockStatsList *info =3D g_malloc0(sizeof(*info)); AioContext *ctx =3D blk_get_aio_context(blk); BlockStats *s; char *qdev; =20 + if (!*blk_name(blk) && !blk_get_attached_dev(blk)) { + continue; + } + aio_context_acquire(ctx); s =3D bdrv_query_bds_stats(blk_bs(blk), true); s->has_device =3D true; --=20 2.13.6 From nobody Wed Dec 17 21:54:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532964451483161.02065500577373; Mon, 30 Jul 2018 08:27:31 -0700 (PDT) Received: from localhost ([::1]:53239 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkA54-0008IU-1Y for importer@patchew.org; Mon, 30 Jul 2018 11:27:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9oY-0003Ra-Lx for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9oW-0008Oo-W4 for qemu-devel@nongnu.org; Mon, 30 Jul 2018 11:10:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36906 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk9oR-0008Kv-C5; Mon, 30 Jul 2018 11:10:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F16104219DBA; Mon, 30 Jul 2018 15:10:18 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-86.ams2.redhat.com [10.36.117.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 257E5112D189; Mon, 30 Jul 2018 15:10:18 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 30 Jul 2018 17:09:58 +0200 Message-Id: <20180730150958.14607-14-kwolf@redhat.com> In-Reply-To: <20180730150958.14607-1-kwolf@redhat.com> References: <20180730150958.14607-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 30 Jul 2018 15:10:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 30 Jul 2018 15:10:19 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 13/13] qemu-iotests: Test query-blockstats with -drive and -blockdev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Make sure that query-blockstats returns information for every BlockBackend that is named or attached to a device model (or both). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- tests/qemu-iotests/227 | 101 ++++++++++++++++++++++ tests/qemu-iotests/227.out | 205 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/group | 1 + 3 files changed, 307 insertions(+) create mode 100755 tests/qemu-iotests/227 create mode 100644 tests/qemu-iotests/227.out diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227 new file mode 100755 index 0000000000..9a5f7f9f14 --- /dev/null +++ b/tests/qemu-iotests/227 @@ -0,0 +1,101 @@ +#!/bin/bash +# +# Test query-blockstats with different ways to create a BB +# +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D$(basename $0) +echo "QA output created by $seq" + +here=3D$PWD +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt generic +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp-pretty stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_generated_node_ids +} + +echo +echo '=3D=3D=3D blockstats with -drive if=3Dvirtio =3D=3D=3D' +echo + +run_qemu -drive driver=3Dnull-co,if=3Dvirtio <