From patchwork Mon Dec 3 10:14:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="LOcKjAy7"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gzL07n9z9s47 for ; Mon, 3 Dec 2018 21:22:22 +1100 (AEDT) Received: from localhost ([::1]:47786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlMp-0007Er-JL for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:22:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFr-0002IT-Vi for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFm-0004uI-5j for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:07 -0500 Received: from mail-eopbgr60112.outbound.protection.outlook.com ([40.107.6.112]:44323 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFl-0004nY-QT; Mon, 03 Dec 2018 05:15:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LioKNapJF+AZ2Ioa+fsVlOAJVJoX/UTUrR4UFmkpdjI=; b=LOcKjAy7dmUXLKdGTc8iDVvCmWfLLqWA60IN//dCvVFz7axgqzy8KPZSM4VHrRdsBQoBjLAVJIdCXdxJRSIojtGvy3lhW6nsZIWiskFriEmkm7Q/V3stAnTiPd63hNE89DUxlVtXxYTR5bsz+Xh5jEqWaLtOzLCl4PhBnu6BRDM= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3922.eurprd08.prod.outlook.com (20.178.118.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 10:14:53 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:53 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 1/9] mirror: inherit supported write/zero flags Thread-Index: AQHUivEISvkkVZZLeUinNE1cHGns1A== Date: Mon, 3 Dec 2018 10:14:53 +0000 Message-ID: <20181203101429.88735-2-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3922; 20:SBkvIi482KtQJO+d4ARCQujIlZ6gKBWaWRQLclpRZ7gyZ4wkMPOQCVm6+jwOMTs2CvKg7FLKb/G9Vun1VrLoW0P1LWorRKstWh3jcj2tSlYnQeihtUFJHBtZGIKLDP1RU5n/VVHCiAcQck/2ZMDoWPusQygdHokcYondPz5+Ln8= x-ms-office365-filtering-correlation-id: dbb6ef1a-1f3d-4012-fc0f-08d659082aa1 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3922; x-ms-traffictypediagnostic: AM0PR08MB3922: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3922; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3922; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(376002)(346002)(396003)(189003)(199004)(476003)(107886003)(5660300001)(54906003)(14454004)(2906002)(52116002)(386003)(7736002)(1076002)(99286004)(6506007)(316002)(3846002)(6116002)(305945005)(68736007)(25786009)(478600001)(76176011)(97736004)(86362001)(66066001)(36756003)(8676002)(44832011)(6486002)(8936002)(2501003)(81156014)(81166006)(256004)(26005)(2351001)(11346002)(4326008)(446003)(102836004)(106356001)(105586002)(5640700003)(186003)(6436002)(71200400001)(71190400001)(6512007)(486006)(53936002)(6916009)(2616005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3922; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: BckZQ4imrLSJdU2F/Tq761s4mk6hNU8OFb2f442Hj41LCAKVcOKD34sBDC3+23hILUUD0MBuVQ+TaLx8Is8vDgylF+00llRFSQZb33mB9eyBQ2pJWrVsHPpCpvi68PcN6VxVt01+gqh2mLP9DEFxWz6Rqe76ENkE/b7LIL1MGCh3ceyuO5LskYJQj8UZnVg7F11a12a/KZmHKAjKls7HhMCcEW0eZGx+pv/U7IgJ+fkicqmAXTwWFTeDDuuhApdVx6kI71NfmWeFT0rhKfHKBA5fyAlbjj1M36c4rYAkWBTlexe2JgViOlethkCTaGQ74G6kZfqo0KpQ8tN3RQPNwzrihebqBW5UiLhuTK0RqJ4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbb6ef1a-1f3d-4012-fc0f-08d659082aa1 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:53.3095 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3922 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.6.112 Subject: [Qemu-devel] [PATCH v10 1/9] mirror: inherit supported write/zero flags 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/mirror.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 56d9ef7474..56908c9b19 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1528,8 +1528,12 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, mirror_top_bs->implicit = true; } mirror_top_bs->total_sectors = bs->total_sectors; - mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED; - mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED; + mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | + (BDRV_REQ_FUA & bs->supported_write_flags); + mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) + & bs->supported_zero_flags); + bs_opaque = g_new0(MirrorBDSOpaque, 1); mirror_top_bs->opaque = bs_opaque; bdrv_set_aio_context(mirror_top_bs, bdrv_get_aio_context(bs)); From patchwork Mon Dec 3 10:14:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="T69NJSAI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gwV1RJPz9s7W for ; Mon, 3 Dec 2018 21:19:52 +1100 (AEDT) Received: from localhost ([::1]:47770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlKO-0005OJ-Lb for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:19:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFr-0002IS-VL for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFq-0004xz-36 for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:07 -0500 Received: from mail-db3eur04on0714.outbound.protection.outlook.com ([2a01:111:f400:fe0c::714]:4512 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFo-0004uU-6m; Mon, 03 Dec 2018 05:15:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FI9d2QmHe8e4VZkOQlI+liTuAwODNOvZ/jXWze4EtmE=; b=T69NJSAI1Sbau5QwPniDZqa61WHLGSkPB1OECdS+LPX9T/P/SquyMIOhYWAZt+Un+W8wdwv/87PKxO79SmPYPhjWEtIi+E0tA5sxd6EswMro/A8mLiXYw+rIDVJ2TANabreevQv1RRGNlAFFBAxMWCY6qt9FfSQU03IdzVOr7T4= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3922.eurprd08.prod.outlook.com (20.178.118.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 10:14:54 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:54 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 2/9] blkverify: set supported write/zero flags Thread-Index: AQHUivEIKP3xHJgtqUy0UuZcnLvJBA== Date: Mon, 3 Dec 2018 10:14:54 +0000 Message-ID: <20181203101429.88735-3-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3922; 20:ALpxaaJ4WJZLg9HThf1OBJsc9qzUga1LvRa2KqH6JEqyRoOkJFQz2hIYjtPbLTHpqXW3NKuxPqfBJDSWGGZcFkOircu+hAtear+ntE2Ib4mrj009ywZ7OHYwjj39vaBo2mrQ4SnzD1b+VAEdH79Bl0b4owgYMQkdh28LNs4VRSE= x-ms-office365-filtering-correlation-id: 481db3e9-a3ef-47ff-e28c-08d659082b3d x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3922; x-ms-traffictypediagnostic: AM0PR08MB3922: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3922; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3922; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(376002)(346002)(396003)(189003)(199004)(476003)(107886003)(5660300001)(54906003)(14454004)(2906002)(52116002)(386003)(7736002)(1076002)(99286004)(6506007)(316002)(3846002)(6116002)(305945005)(68736007)(25786009)(478600001)(76176011)(97736004)(86362001)(66066001)(36756003)(8676002)(44832011)(6486002)(8936002)(2501003)(81156014)(81166006)(256004)(26005)(2351001)(11346002)(4326008)(446003)(102836004)(106356001)(105586002)(5640700003)(186003)(6436002)(71200400001)(71190400001)(6512007)(486006)(53936002)(6916009)(2616005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3922; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: BG7MzmMAPAqlXrMwxtRZfw+uXLyBFFRABIvCkcuHIHlTpJfeM99+AsucU2LeHMhVvMjQ7Wsuq8RfiaSD143rG200bm1Bp/ay/lFD0c/EIEajyHW6wBOGN1sqkOWf2zBLOfA3yJ6xzX3z/ZAT22hyUcKVwaz6IOcC8GqMWAVAifvw4XH6AmgursUep1GJkHmnPz4/p3QpASKsXZa3AKy+/xvGUdj+vX6XbRLcGC2IVaNRye6STeabc1cp4nzCYhgZuNV25pxyOAxQP5xIOjId8biZhfgFekyso5be9OO/pX4Z0Bc9wQsF7BXKgDcXAUPqzIN3VgXebgoBruqiuGf4Pr3RzmCcBGgNJUHeTOyxkgI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 481db3e9-a3ef-47ff-e28c-08d659082b3d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:54.1771 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3922 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe0c::714 Subject: [Qemu-devel] [PATCH v10 2/9] blkverify: set supported write/zero flags 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/blkverify.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/block/blkverify.c b/block/blkverify.c index 89bf4386e3..bb52596cbb 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -141,8 +141,14 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED; - bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED; + bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | + (BDRV_REQ_FUA & + bs->file->bs->supported_write_flags & + s->test_file->bs->supported_write_flags); + bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & + bs->file->bs->supported_zero_flags & + s->test_file->bs->supported_zero_flags); ret = 0; fail: From patchwork Mon Dec 3 10:14:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Xtf4a7cm"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gyj2Qf3z9s7W for ; Mon, 3 Dec 2018 21:21:49 +1100 (AEDT) Received: from localhost ([::1]:47783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlMI-0006pR-TO for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:21:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFt-0002KD-R8 for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFo-0004w1-3v for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:09 -0500 Received: from mail-eopbgr60112.outbound.protection.outlook.com ([40.107.6.112]:44323 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFn-0004nY-6Y; Mon, 03 Dec 2018 05:15:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S3eWdumPqaCjZLHb5YgQJRWh/kuKXaqQWWfIgVVEl+k=; b=Xtf4a7cmtF5wGMY+7Gf+oXnxueCaqgQcC1GDdY9X0yJzYpj5+cdTHEesp7j/VnKIJGygdYiRN2GhlQPwRZdNVH4h9O9+OPueAZCuTa4NG347l/V2A7lScKd3Azwmco9y/ZA8L/hJT2y2koesyGdXVa+zc9KUqOYX+SeR/e3gAPY= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3922.eurprd08.prod.outlook.com (20.178.118.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 10:14:55 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:55 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 3/9] quorum: set supported write flags Thread-Index: AQHUivEJjrM9eBW4qkWz0dPxCuDyfA== Date: Mon, 3 Dec 2018 10:14:55 +0000 Message-ID: <20181203101429.88735-4-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3922; 20:crwjm9F4YvCPy8ij7YFXFTrcgLe024dzZHclGqpEOqEPE+nDgO42/Gvw1FcRWym7XsMUP7Xd/gDrkGvpclmcWY3yJsiufUw/Dc5Pe0wzw5PA6ilhC2CS9Kqf5dqJoJi/rLH08BeHsf+5UAN8vjP4N+k03l1DddHST9PqRWouAvk= x-ms-office365-filtering-correlation-id: a58b8503-f505-4c55-a527-08d659082bc3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3922; x-ms-traffictypediagnostic: AM0PR08MB3922: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3922; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3922; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(376002)(346002)(396003)(189003)(199004)(476003)(107886003)(5660300001)(54906003)(14454004)(2906002)(52116002)(386003)(7736002)(1076002)(99286004)(6506007)(316002)(3846002)(6116002)(305945005)(68736007)(25786009)(478600001)(76176011)(97736004)(86362001)(66066001)(36756003)(8676002)(14444005)(44832011)(6486002)(8936002)(2501003)(81156014)(81166006)(256004)(26005)(2351001)(11346002)(4326008)(446003)(102836004)(106356001)(105586002)(5640700003)(186003)(6436002)(71200400001)(71190400001)(6512007)(486006)(53936002)(6916009)(2616005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3922; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ovVVirssc2DN7ND7/GGp/j1aIpywKSutoUmZjSXaZyM7YqFqP0VLHr9U9D0d57OMtJjIfxTVc3GD0ODS0EnXCXKBduKFSzGd5b3uW5xcFriNvWaMFaspHtJ/rGh2aIxQ912hG+6EThrACBsJoP6Ybcei3xokf+RpTQE+49rpEQpm3T0xTf3/yNcwUal+sLEuCdyn09gLK5G2QTK9m3om3WmjTIfJGb8LrG0RiNzgsmf1i0akrOkCib2s/Y4I3yXlJRWYhMHLF1JBJhrHnzPoYYwyOPwHRBRrxU8FVWjlf+aZ3qrs/p+QFs1oAX8HpmpsAvTLylaNkgIMPHfwGayT835N72kUMJZ3RwItS23uCgY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a58b8503-f505-4c55-a527-08d659082bc3 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:55.2629 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3922 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.6.112 Subject: [Qemu-devel] [PATCH v10 3/9] quorum: set supported write flags 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/quorum.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/block/quorum.c b/block/quorum.c index 16b3c8067c..d21a6a3b8e 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -857,6 +857,19 @@ static QemuOptsList quorum_runtime_opts = { }, }; +static void quorum_set_supported_flags(BlockDriverState *bs) +{ + BDRVQuorumState *s = bs->opaque; + int i; + + bs->supported_write_flags = BDRV_REQ_FUA; + for (i = 0; i < s->num_children; i++) { + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; + } + + bs->supported_write_flags |= BDRV_REQ_WRITE_UNCHANGED; +} + static int quorum_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -950,7 +963,7 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags, } s->next_child_index = s->num_children; - bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED; + quorum_set_supported_flags(bs); g_free(opened); goto exit; @@ -1025,6 +1038,8 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, s->children = g_renew(BdrvChild *, s->children, s->num_children + 1); s->children[s->num_children++] = child; + quorum_set_supported_flags(bs); + out: bdrv_drained_end(bs); } @@ -1063,6 +1078,8 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, bdrv_unref_child(bs, child); bdrv_drained_end(bs); + + quorum_set_supported_flags(bs); } static void quorum_refresh_filename(BlockDriverState *bs, QDict *options) From patchwork Mon Dec 3 10:14:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Kree2mXY"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437grv54rrz9s47 for ; Mon, 3 Dec 2018 21:16:47 +1100 (AEDT) Received: from localhost ([::1]:47754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlHQ-00034c-QM for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:16:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFq-0002H5-10 for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFl-0004tr-Nr for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:05 -0500 Received: from mail-eopbgr00107.outbound.protection.outlook.com ([40.107.0.107]:40233 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFk-0004r0-Av; Mon, 03 Dec 2018 05:15:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Nhmp+t6AVx4VjepLhDyhjluxK73ileGhh3juYWk3feI=; b=Kree2mXY2Ov+Z6YDe3P66Rs5cfK2jOvsuY1GsbU3aL6rR1nEQKnOlbACmRRlDT70MOn4aEkxW/8aXEuacks/2U0zyLOyFNkjj4cfS6plRo3cL4NwRjfuukeXSqeib8AIDrNbyd+u1cuOpLw8oyyOcyk2IfjkDy3Y2W2/zEvQaIY= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3875.eurprd08.prod.outlook.com (20.178.82.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Mon, 3 Dec 2018 10:14:56 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:56 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 4/9] block: introduce BDRV_REQ_ALLOCATE flag Thread-Index: AQHUivEKBvOuojkc60qskc5y3A0w/Q== Date: Mon, 3 Dec 2018 10:14:56 +0000 Message-ID: <20181203101429.88735-5-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3875; 20:fvwT9rosUxyCN4ReEbBrEkQ/Wzog4ubiXvG74a8dJZBtYnpI3ljWymYmmKrSjYRZH2lQELANHBx59+yGuAaJ/zYfLV/z/ISgPE397DPqcDDNXV93XTsc2ECpo3paTcB5FZxjqn+r9EVetLAsS+NehHj6CIIPud1SS0XrIak+ASY= x-ms-office365-filtering-correlation-id: bd193eb9-fca5-4687-b90e-08d659082c66 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3875; x-ms-traffictypediagnostic: AM0PR08MB3875: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3875; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3875; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(376002)(136003)(396003)(346002)(366004)(199004)(189003)(305945005)(5660300001)(7736002)(106356001)(68736007)(2906002)(105586002)(256004)(14444005)(6436002)(2351001)(6486002)(71190400001)(71200400001)(6116002)(3846002)(4326008)(36756003)(6506007)(186003)(476003)(25786009)(102836004)(2616005)(478600001)(76176011)(14454004)(486006)(53936002)(86362001)(44832011)(99286004)(5640700003)(26005)(107886003)(6512007)(386003)(66066001)(316002)(8676002)(54906003)(11346002)(446003)(81166006)(81156014)(8936002)(2501003)(6916009)(52116002)(97736004)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3875; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: bfNAHnyfTmOurVF8VyYas+CSxIxs5hqbNdzTaAowKIH3LJgqwE9YMor3/kyMU/AamzwSisFeJ+TzjJLEqrUvxPq2oM191BuCRi7ZCxx6FqUH8ME8/XxpNkPYw8q2P/Juf7npw4gLtKUdeIqA04SiVrR3Kud6612rOpANwyIXX1jtNzXeRxSCrOZX46xsqWu40tL9t8WXhmyCd+ruSrjVpCuxyYM8RbippVSeHgqoZgPAPhtAnt5X/kViTFvNfNxa3P5K2oNATzTyQZ2JL20Rm9r403wIVSZegtsV1zPgET+igYt4TMKyoeUuNNyo/W+Uri5gQYhhTwnH2alWpGrPrdRSaW4heeG/Ik/od0i2j1M= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd193eb9-fca5-4687-b90e-08d659082c66 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:56.0945 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3875 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.107 Subject: [Qemu-devel] [PATCH v10 4/9] block: introduce BDRV_REQ_ALLOCATE flag 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The flag is supposed to indicate that the region of the disk image has to be sufficiently allocated so it reads as zeroes. The call with the flag set must return -ENOTSUP if allocation cannot be done efficiently. This has to be made sure of by both - the drivers that support the flag - and the common block layer (so it will not fall back to any slowpath (like writing zero buffers) in case the driver does not support the flag). Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- include/block/block.h | 9 ++++++++- include/block/block_int.h | 2 +- block/io.c | 18 ++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 7f5453b45b..f571082415 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -83,8 +83,15 @@ typedef enum { */ BDRV_REQ_SERIALISING = 0x80, + /* The BDRV_REQ_ALLOCATE flag is used to indicate that the driver has to + * efficiently allocate the space so it reads as zeroes, or return an error. + * If this flag is set then BDRV_REQ_ZERO_WRITE must also be set. + * This flag cannot be set together with BDRV_REQ_MAY_UNMAP. + */ + BDRV_REQ_ALLOCATE = 0x100, + /* Mask of valid flags */ - BDRV_REQ_MASK = 0xff, + BDRV_REQ_MASK = 0x1ff, } BdrvRequestFlags; typedef struct BlockSizes { diff --git a/include/block/block_int.h b/include/block/block_int.h index f605622216..ff84c5d8aa 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -724,7 +724,7 @@ struct BlockDriverState { * their children. */ unsigned int supported_write_flags; /* Flags honored during pwrite_zeroes (so far: BDRV_REQ_FUA, - * BDRV_REQ_MAY_UNMAP, BDRV_REQ_WRITE_UNCHANGED) */ + * BDRV_REQ_MAY_UNMAP, BDRV_REQ_WRITE_UNCHANGED, BDRV_REQ_ALLOCATE) */ unsigned int supported_zero_flags; /* the following member gives a name to every node on the bs graph. */ diff --git a/block/io.c b/block/io.c index bd9d688f8b..d9d7644858 100644 --- a/block/io.c +++ b/block/io.c @@ -1534,7 +1534,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, assert(!bs->supported_zero_flags); } - if (ret == -ENOTSUP) { + if (ret == -ENOTSUP && !(flags & BDRV_REQ_ALLOCATE)) { /* Fall back to bounce buffer if write zeroes is unsupported */ BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE; @@ -1702,7 +1702,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, !(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_pwrite_zeroes && qemu_iovec_is_zero(qiov)) { flags |= BDRV_REQ_ZERO_WRITE; - if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) { + if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP && + !(flags & BDRV_REQ_ALLOCATE)) + { flags |= BDRV_REQ_MAY_UNMAP; } } @@ -1773,6 +1775,9 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild *child, assert(flags & BDRV_REQ_ZERO_WRITE); if (head_padding_bytes || tail_padding_bytes) { + if (flags & BDRV_REQ_ALLOCATE) { + return -ENOTSUP; + } buf = qemu_blockalign(bs, align); iov = (struct iovec) { .iov_base = buf, @@ -1858,6 +1863,9 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, bool use_local_qiov = false; int ret; + assert(!((flags & BDRV_REQ_ALLOCATE) && (flags & BDRV_REQ_MAY_UNMAP))); + assert(!((flags & BDRV_REQ_ALLOCATE) && !(flags & BDRV_REQ_ZERO_WRITE))); + trace_bdrv_co_pwritev(child->bs, offset, bytes, flags); if (!bs->drv) { @@ -1980,6 +1988,12 @@ int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, { trace_bdrv_co_pwrite_zeroes(child->bs, offset, bytes, flags); + if ((flags & BDRV_REQ_ALLOCATE) && + !(child->bs->supported_zero_flags & BDRV_REQ_ALLOCATE)) + { + return -ENOTSUP; + } + if (!(child->bs->open_flags & BDRV_O_UNMAP)) { flags &= ~BDRV_REQ_MAY_UNMAP; } From patchwork Mon Dec 3 10:14:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="SvvmR70Q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gvh1br9z9s1c for ; Mon, 3 Dec 2018 21:19:12 +1100 (AEDT) Received: from localhost ([::1]:47764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlJl-0004sm-Pr for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:19:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFr-0002IR-VE for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFo-0004vt-2C for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:07 -0500 Received: from mail-eopbgr00107.outbound.protection.outlook.com ([40.107.0.107]:40233 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFm-0004r0-8g; Mon, 03 Dec 2018 05:15:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ebkufZL8nsXIr6VCfve1CswnbbTplJl2MbGrAMSfGcE=; b=SvvmR70QKRPzXz7/El3B0UYJVjqif+xO33WmVYdnfQbcPMBg6SMPyrXdEsWcIX6itIwtWjiM/leKWlXFuyyyPXRgnhgrVFZ8cN3YaQJNhuVfkZ+Kq4KAr2KUyLpekhLGiWSXNsArGdL0uq2s6aN3sJq/d5UCy9srrMW61LyvzTs= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3875.eurprd08.prod.outlook.com (20.178.82.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Mon, 3 Dec 2018 10:14:57 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:57 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 5/9] block: treat BDRV_REQ_ALLOCATE as serialising Thread-Index: AQHUivEKfLKyjUuzakO7xI+sP/yunQ== Date: Mon, 3 Dec 2018 10:14:57 +0000 Message-ID: <20181203101429.88735-6-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3875; 20:cV3K+Fp7ZWc8DtDBSs3SaeCCE/IT0RLB8KAwBtVwcN79mEKpnedQi8/TrBuU41wRkIS6/GlvzfCt3biWQulptVjCo81SdVapE/x3TAf1H1kLkqRAK846D5kenFR5vx7vTEmIRvPrGOZn6zVq3A1m3QnGnGumRPsSTzkAZuYdYEo= x-ms-office365-filtering-correlation-id: ccbe3199-711c-428c-ead5-08d659082ce5 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3875; x-ms-traffictypediagnostic: AM0PR08MB3875: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3875; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3875; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(376002)(136003)(396003)(346002)(366004)(199004)(189003)(305945005)(5660300001)(7736002)(106356001)(68736007)(2906002)(105586002)(256004)(14444005)(6436002)(2351001)(6486002)(71190400001)(71200400001)(6116002)(3846002)(4326008)(36756003)(6506007)(186003)(476003)(25786009)(102836004)(2616005)(478600001)(76176011)(14454004)(486006)(53936002)(86362001)(44832011)(99286004)(5640700003)(26005)(107886003)(6512007)(386003)(66066001)(316002)(8676002)(54906003)(11346002)(446003)(81166006)(81156014)(8936002)(2501003)(6916009)(52116002)(97736004)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3875; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: okRCfTFMQnO2wPGZHfeB7V5x26IFscTccwUYycj14mVUYxXOR6kgEvRPNksqb7U3QInagUrCE0QJs5D6b64iANbZYtHYsTYidPf3LvZFzA5a78+/IuSilglMX6eSY4biuuMQKU0/9bcXmLV2ri7QONsG2cEO4/zxwTa9U3W0YiXz66dD1NeCscWf2Q1+fVjO4Tp2q1gyz+Mxy+BwEQoWB9wwMOqkaxAorp5bcPyt3ZtToWugMhGc5cL4GJiqa1cnZeuorn2iwCDLqQDEzyyPOQlDSkZHP7u8sAky4GRt1o3C7KAtVzFVI9zVvmnxifFAfOq0XMihfZnw7xis1SSl+qcIDlElrvaZGh6HNYduQF8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccbe3199-711c-428c-ead5-08d659082ce5 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:57.1552 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3875 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.107 Subject: [Qemu-devel] [PATCH v10 5/9] block: treat BDRV_REQ_ALLOCATE as serialising 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The idea is that ALLOCATE requests may overlap with other requests. Reuse the existing block layer infrastructure for serialising requests. Use the following approach: - mark ALLOCATE also SERIALISING, so subsequent requests to the area wait - ALLOCATE request itself must never wait if another request is in flight already. Return EAGAIN, let the caller reconsider. Signed-off-by: Anton Nefedov --- block/io.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/block/io.c b/block/io.c index d9d7644858..6ff946f63d 100644 --- a/block/io.c +++ b/block/io.c @@ -720,12 +720,13 @@ void bdrv_dec_in_flight(BlockDriverState *bs) bdrv_wakeup(bs); } -static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) +static bool coroutine_fn find_or_wait_serialising_requests( + BdrvTrackedRequest *self, bool wait) { BlockDriverState *bs = self->bs; BdrvTrackedRequest *req; bool retry; - bool waited = false; + bool found = false; if (!atomic_read(&bs->serialising_in_flight)) { return false; @@ -751,11 +752,14 @@ static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) * will wait for us as soon as it wakes up, then just go on * (instead of producing a deadlock in the former case). */ if (!req->waiting_for) { + found = true; + if (!wait) { + break; + } self->waiting_for = req; qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); self->waiting_for = NULL; retry = true; - waited = true; break; } } @@ -763,7 +767,12 @@ static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) qemu_co_mutex_unlock(&bs->reqs_lock); } while (retry); - return waited; + return found; +} + +static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) +{ + return find_or_wait_serialising_requests(self, true); } static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, @@ -1585,7 +1594,7 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, BdrvTrackedRequest *req, int flags) { BlockDriverState *bs = child->bs; - bool waited; + bool found; int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); if (bs->read_only) { @@ -1602,9 +1611,13 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, mark_request_serialising(req, bdrv_get_cluster_size(bs)); } - waited = wait_serialising_requests(req); + found = find_or_wait_serialising_requests(req, + !(flags & BDRV_REQ_ALLOCATE)); + if (found && (flags & BDRV_REQ_ALLOCATE)) { + return -EAGAIN; + } - assert(!waited || !req->serialising || + assert(!found || !req->serialising || is_request_serialising_and_aligned(req)); assert(req->overlap_offset <= offset); assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); @@ -1866,6 +1879,10 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, assert(!((flags & BDRV_REQ_ALLOCATE) && (flags & BDRV_REQ_MAY_UNMAP))); assert(!((flags & BDRV_REQ_ALLOCATE) && !(flags & BDRV_REQ_ZERO_WRITE))); + if (flags & BDRV_REQ_ALLOCATE) { + flags |= BDRV_REQ_SERIALISING; + } + trace_bdrv_co_pwritev(child->bs, offset, bytes, flags); if (!bs->drv) { From patchwork Mon Dec 3 10:14:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006772 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="DPt5hy7i"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gr362DZz9sDF for ; Mon, 3 Dec 2018 21:16:03 +1100 (AEDT) Received: from localhost ([::1]:47750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlGj-0002TF-9c for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:16:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFt-0002KG-Ro for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFs-000509-0I for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:09 -0500 Received: from mail-eopbgr00107.outbound.protection.outlook.com ([40.107.0.107]:40233 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFq-0004r0-7B; Mon, 03 Dec 2018 05:15:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YGjizEy/GB3PF7s/S5Vc4NZWHXtHRI7KXMAxZnjO8NY=; b=DPt5hy7idnqdyZSNAJVp6Qc0r7HN9ZVywZVeEFQIXBMnQcQXm7hOBuuie/2VCW5IESkayOSKL+Y2D/hI7pU39ltQrgoOtInOW1u2bZVEdjMWobXoaCQyqCY5qbOmGcoBEZ6kKKb510KCPA7rRVdmS98BDHZRMDzu76Nt+C65G4E= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3875.eurprd08.prod.outlook.com (20.178.82.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Mon, 3 Dec 2018 10:14:58 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:58 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE Thread-Index: AQHUivELwkWpGqFhVEGjIAvGeleILw== Date: Mon, 3 Dec 2018 10:14:58 +0000 Message-ID: <20181203101429.88735-7-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3875; 20:RXRmoI42VbKv3t3L8xsNCvTZ54Im5fMZtYVIAWIgakil0vu16KB/YkazWUdN6jVMDCVtEl12vwZn41LGU7ltFjRVN2j2k4O+22ygoiCVtUc2ipgKbTTLZf/bNbPcGHAAlsVPeOjH965aEUvA2gIsCWSNRcsaoX8Ugm5/rmWVa1E= x-ms-office365-filtering-correlation-id: b89fb5a2-1376-4611-ed22-08d659082d87 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3875; x-ms-traffictypediagnostic: AM0PR08MB3875: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3875; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3875; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(376002)(136003)(396003)(346002)(366004)(199004)(189003)(305945005)(5660300001)(7736002)(106356001)(68736007)(2906002)(105586002)(256004)(14444005)(6436002)(2351001)(6486002)(71190400001)(71200400001)(6116002)(3846002)(4326008)(36756003)(6506007)(186003)(476003)(25786009)(102836004)(2616005)(478600001)(76176011)(14454004)(486006)(53936002)(86362001)(575784001)(44832011)(99286004)(5640700003)(26005)(107886003)(6512007)(386003)(66066001)(316002)(8676002)(54906003)(11346002)(446003)(81166006)(81156014)(8936002)(2501003)(6916009)(52116002)(97736004)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3875; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: wBXoubnm0XOwvtdmIl/sEyo4nCzU9tCbTnsQboo/XEgpPy+oe5mT9v1IkW5a/EH02RSZT7UQ82qi9d14r/HRqEjQIZedzIUfe/AiFiGDl8bd6f+65AdBXLjNek4a3CLN0CcvS13B7wFOefb2pvH1s9VuMMpuGnlSGcRejfMDojzwTVI/+b33EUnCBTv74+tcG64G6+4Ht83ImcI35s5EnidgE4/fWeJv1K5NM8E7Vz2p/BIKoqoqWK8dmzhUhLawlpw/L1O3kgilHFZfFVAlAvDLEpMyGJ3rmQKkGhGApg6FYWEm/CCYrOetkdHI1Vpl05QBU1+Y0LGVGSWytYdz3fzSPh4UUOPeaieG3vSV6Xw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b89fb5a2-1376-4611-ed22-08d659082d87 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:58.1089 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3875 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.107 Subject: [Qemu-devel] [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Current write_zeroes implementation is good enough to satisfy this flag too Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- block/file-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 07bbdab953..b0b7ab0159 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -603,6 +603,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, } else { s->discard_zeroes = true; s->has_fallocate = true; + bs->supported_zero_flags = BDRV_REQ_ALLOCATE; } } else { if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) { @@ -646,10 +647,11 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, #ifdef CONFIG_XFS if (platform_test_xfs_fd(s->fd)) { s->is_xfs = true; + bs->supported_zero_flags = BDRV_REQ_ALLOCATE; } #endif - bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; + bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP; ret = 0; fail: if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { @@ -1520,6 +1522,10 @@ static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData *aiocb) } s->has_fallocate = false; } + + if (!s->has_fallocate) { + aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE; + } #endif return -ENOTSUP; From patchwork Mon Dec 3 10:14:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Zpmjn5Oh"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437h1W01WRz9sCX for ; Mon, 3 Dec 2018 21:24:15 +1100 (AEDT) Received: from localhost ([::1]:47793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlOe-0000J8-G9 for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:24:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFx-0002Oc-Pt for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFr-000501-Vy for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:13 -0500 Received: from mail-eopbgr60112.outbound.protection.outlook.com ([40.107.6.112]:44323 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFq-0004nY-8V; Mon, 03 Dec 2018 05:15:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SNbE8fyndPP8F6upmM+BETEMYXaP42IXcxoO4eHP+uQ=; b=Zpmjn5Ohlo70FOz2ZQjwQeTKh4gp2rR2teugzs1TfAGCAjZffc5GDJUuBPE3Ix+RLFNfwjicizD/HWGRhJIIVhBWvp2H0KvpXnJH7adQHTTxtNncbPVlWdjAyhOU1XOg+4Xw8z6eCSsWj3pFw3ZMxl3hMQ881p9YHV4JeyeliK4= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3922.eurprd08.prod.outlook.com (20.178.118.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 10:14:59 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:59 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 7/9] block: support BDRV_REQ_ALLOCATE in passthrough drivers Thread-Index: AQHUivELYrOYb5W/Skevq0eKVt4lpQ== Date: Mon, 3 Dec 2018 10:14:59 +0000 Message-ID: <20181203101429.88735-8-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3922; 20:zUnfHAlPsOsTUR74oRDSynW2qz5eo37VbwYhVPWYYgVt1w4QpSCPKNMRAIdk/F7Q/AfycxBbDEfm/M3X7cW6KC/YBhL1w1tdDItpOZ5gWifWDYVihAaCiRpY17PJSurRFK+xC0fa4QA7uVxN0k0QNXKYVBCZmqNp6GZ1pDxnQeI= x-ms-office365-filtering-correlation-id: 37696fc8-9885-4c6c-71b3-08d659082e19 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3922; x-ms-traffictypediagnostic: AM0PR08MB3922: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3922; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3922; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(376002)(346002)(396003)(189003)(199004)(476003)(107886003)(5660300001)(54906003)(14454004)(2906002)(52116002)(386003)(7736002)(1076002)(99286004)(6506007)(316002)(3846002)(6116002)(305945005)(68736007)(25786009)(478600001)(76176011)(97736004)(86362001)(575784001)(66066001)(36756003)(8676002)(44832011)(6486002)(8936002)(2501003)(81156014)(81166006)(256004)(26005)(2351001)(11346002)(4326008)(446003)(102836004)(106356001)(105586002)(5640700003)(186003)(6436002)(71200400001)(71190400001)(6512007)(486006)(53936002)(6916009)(2616005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3922; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3JKWU4FWQVOtA+EquuPDbWR+mylNF7+TZ9VYfRPBi6toTH6wXOKrA6xcHvUGOQvOqq7vQ5EA84EK649/VuJgvpgJ6zcN2Cln+0W3uKAL3+rvpfn4lslwrKxbnt+p/ZMt8roXAtoJcEx2MiYqupTGeJ3gweqo80Cr4fSOMTymJxDvj1+xKiS43lmzPM0LEqa7qtXWvqyRwQPT0v/7olebEFzkbK/AfBmi3qTHkOF1NP8XOhV4i7T9FSWrhEZtqOS9WIzRP47OXgcVlwnwJWvcQH5jLe4HTWksUoHqGrGe5maKyc6JqvEID8xZItBdqOKsMK5XPBXfTGZ6WOtyz7/bzd0etfzIX1IzKTFD4Oak/rc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37696fc8-9885-4c6c-71b3-08d659082e19 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:59.0255 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3922 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.6.112 Subject: [Qemu-devel] [PATCH v10 7/9] block: support BDRV_REQ_ALLOCATE in passthrough drivers 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Support the flag if the underlying BDS supports it Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/blkdebug.c | 2 +- block/blkverify.c | 2 +- block/copy-on-read.c | 4 ++-- block/mirror.c | 2 +- block/raw-format.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 0759452925..f0fc2ec276 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -401,7 +401,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags, bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | - ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_ALLOCATE) & bs->file->bs->supported_zero_flags); ret = -EINVAL; diff --git a/block/blkverify.c b/block/blkverify.c index bb52596cbb..9cb4f94b68 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -146,7 +146,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, bs->file->bs->supported_write_flags & s->test_file->bs->supported_write_flags); bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | - ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_ALLOCATE) & bs->file->bs->supported_zero_flags & s->test_file->bs->supported_zero_flags); diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 64dcc424b5..1eb993699a 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -38,8 +38,8 @@ static int cor_open(BlockDriverState *bs, QDict *options, int flags, bs->file->bs->supported_write_flags); bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | - ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & - bs->file->bs->supported_zero_flags); + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_ALLOCATE) & + bs->file->bs->supported_zero_flags); return 0; } diff --git a/block/mirror.c b/block/mirror.c index 56908c9b19..9d836a6bd3 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1531,7 +1531,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | (BDRV_REQ_FUA & bs->supported_write_flags); mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | - ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_ALLOCATE) & bs->supported_zero_flags); bs_opaque = g_new0(MirrorBDSOpaque, 1); diff --git a/block/raw-format.c b/block/raw-format.c index 6f6dc99b2c..ad7453dc83 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -432,7 +432,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | - ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_ALLOCATE) & bs->file->bs->supported_zero_flags); if (bs->probed && !bdrv_is_read_only(bs)) { From patchwork Mon Dec 3 10:14:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="WgY4We+X"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gr32MWDz9sCs for ; Mon, 3 Dec 2018 21:16:03 +1100 (AEDT) Received: from localhost ([::1]:47751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlGi-0002Ts-Pq for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:16:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFw-0002Mx-Ny for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFt-00054U-Sw for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:12 -0500 Received: from mail-db3eur04on0714.outbound.protection.outlook.com ([2a01:111:f400:fe0c::714]:4512 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFs-0004uU-1Y; Mon, 03 Dec 2018 05:15:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1q2g/4jQlTwXDuNi8WAD+IFCiVqusDTaT0vMylyyAts=; b=WgY4We+XrEaz0Ls5GU2D3PAg8cCXzMp1sIb9bdB8j3H778pFvXPZFjYxNfPNgUBJQwWJRWJuvwXRGc+q0yVowlB5mop3/YdP97+kOs05APvqgyCttvcgBrIBjvMXeerleOt9kE8hjyTih5jyCc3GqRtr5pEpqRvc8ltUicZmhOc= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3922.eurprd08.prod.outlook.com (20.178.118.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 10:15:00 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:15:00 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 8/9] qcow2: skip writing zero buffers to empty COW areas Thread-Index: AQHUivEMFZ+BKPUbXkqHMTqd3200yg== Date: Mon, 3 Dec 2018 10:14:59 +0000 Message-ID: <20181203101429.88735-9-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3922; 20:A2P0gcD4psOD4887gGBGq6u0m7CKf1ymSyoGmfXQ6BEbIeCwz7D/n+pBIzmfnGPKAYdd0zTK7rtXmY6L933R3RTjkwL2KJ/hgHoiHeY8oMSaT7wSRZH8vpshuBCGFetoSdfbLoXCgi5K7bzkOGwLDDAqBVCCzfjybPl6pBLCksM= x-ms-office365-filtering-correlation-id: 907a8080-6692-473c-28e0-08d659082ea5 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3922; x-ms-traffictypediagnostic: AM0PR08MB3922: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3922; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3922; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(376002)(346002)(396003)(189003)(199004)(476003)(107886003)(5660300001)(54906003)(14454004)(2906002)(52116002)(386003)(7736002)(1076002)(99286004)(6506007)(316002)(3846002)(6116002)(305945005)(68736007)(25786009)(478600001)(76176011)(97736004)(86362001)(66066001)(36756003)(8676002)(14444005)(44832011)(6486002)(8936002)(2501003)(81156014)(81166006)(256004)(26005)(2351001)(11346002)(4326008)(446003)(102836004)(106356001)(105586002)(5640700003)(186003)(6436002)(71200400001)(71190400001)(6512007)(486006)(53936002)(6916009)(2616005)(21314003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3922; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: C/hf2jIRI69p/EyV/6L00E6AAuOjKW21o7P2wsVHSqn2N+Xg3eV18QHsv3J+vlWm7/rvK0B4ON3zQsKCl1MYDXqPqpddzO/XpweaR53EZyUSGX352ri2O5DFSU2XPW7pl+QuAtfqp2IJ6QH+mC6vxxB5vpWd64SPdM0U0qvfSLM+MVZ9XRaB7OXLwjD5XOh5lcghE65IQS5pI1CVnYnWdzuvWZRDG7wYf1S+45+26XvO3x5EyuOHObjQrLKCN+9PSQ16rTPo/A68xSOknAARWNaJ6OCXk4WF7t14LDaUi7YdmwyYpX4QZd/gcbAoN9nWvFgZCJQpNR53nEIGrNqmGIoB+qp2LgiVbAr+2MGbnW0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 907a8080-6692-473c-28e0-08d659082ea5 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:59.9111 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3922 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe0c::714 Subject: [Qemu-devel] [PATCH v10 8/9] qcow2: skip writing zero buffers to empty COW areas 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If COW areas of the newly allocated clusters are zeroes on the backing image, efficient bdrv_write_zeroes(flags=BDRV_REQ_ALLOCATE) can be used on the whole cluster instead of writing explicit zero buffers later in perform_cow(). iotest 060: write to the discarded cluster does not trigger COW anymore. Use a backing image instead. Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- qapi/block-core.json | 4 +- block/qcow2.h | 6 +++ block/qcow2-cluster.c | 2 +- block/qcow2.c | 80 +++++++++++++++++++++++++++++++++++++- block/trace-events | 1 + tests/qemu-iotests/060 | 26 ++++++++----- tests/qemu-iotests/060.out | 5 ++- 7 files changed, 109 insertions(+), 15 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index d4fe710836..50598aa8fe 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3004,6 +3004,8 @@ # # @cor_write: a write due to copy-on-read (since 2.11) # +# @cluster_alloc_space: an allocation of file space for a cluster (since 4.0) +# # Since: 2.9 ## { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG', @@ -3022,7 +3024,7 @@ 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev', 'pwritev_zero', 'pwritev_done', 'empty_image_prepare', 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters', - 'cor_write'] } + 'cor_write', 'cluster_alloc_space'] } ## # @BlkdebugInjectErrorOptions: diff --git a/block/qcow2.h b/block/qcow2.h index 8662b68575..8a64077897 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -389,6 +389,12 @@ typedef struct QCowL2Meta */ Qcow2COWRegion cow_end; + /** + * Indicates that COW regions are already handled and do not require + * any more processing. + */ + bool skip_cow; + /** * The I/O vector with the data from the actual guest write request. * If non-NULL, this is meant to be merged together with the data diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index d37fe08b3d..3685c5f67e 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -806,7 +806,7 @@ static int perform_cow(BlockDriverState *bs, QCowL2Meta *m) assert(start->offset + start->nb_bytes <= end->offset); assert(!m->data_qiov || m->data_qiov->size == data_bytes); - if (start->nb_bytes == 0 && end->nb_bytes == 0) { + if ((start->nb_bytes == 0 && end->nb_bytes == 0) || m->skip_cow) { return 0; } diff --git a/block/qcow2.c b/block/qcow2.c index 991d6ac91b..027188a1a3 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2015,6 +2015,11 @@ static bool merge_cow(uint64_t offset, unsigned bytes, continue; } + /* If COW regions are handled already, skip this too */ + if (m->skip_cow) { + continue; + } + /* The data (middle) region must be immediately after the * start region */ if (l2meta_cow_start(m) + m->cow_start.nb_bytes != offset) { @@ -2040,6 +2045,68 @@ static bool merge_cow(uint64_t offset, unsigned bytes, return false; } +static bool is_unallocated(BlockDriverState *bs, int64_t offset, int64_t bytes) +{ + int64_t nr; + return !bytes || + (!bdrv_is_allocated_above(bs, NULL, offset, bytes, &nr) && nr == bytes); +} + +static bool is_zero_cow(BlockDriverState *bs, QCowL2Meta *m) +{ + /* This check is designed for optimization shortcut so it must be + * efficient. + * Instead of is_zero(), use is_unallocated() as it is faster (but not + * as accurate and can result in false negatives). */ + return is_unallocated(bs, m->offset + m->cow_start.offset, + m->cow_start.nb_bytes) && + is_unallocated(bs, m->offset + m->cow_end.offset, + m->cow_end.nb_bytes); +} + +static int handle_alloc_space(BlockDriverState *bs, QCowL2Meta *l2meta) +{ + BDRVQcow2State *s = bs->opaque; + QCowL2Meta *m; + + if (!(bs->file->bs->supported_zero_flags & BDRV_REQ_ALLOCATE)) { + return 0; + } + + if (bs->encrypted) { + return 0; + } + + for (m = l2meta; m != NULL; m = m->next) { + int ret; + + if (!m->cow_start.nb_bytes && !m->cow_end.nb_bytes) { + continue; + } + + if (!is_zero_cow(bs, m)) { + continue; + } + + BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC_SPACE); + /* instead of writing zero COW buffers, + efficiently zero out the whole clusters */ + ret = bdrv_co_pwrite_zeroes(bs->file, m->alloc_offset, + m->nb_clusters * s->cluster_size, + BDRV_REQ_ALLOCATE); + if (ret < 0) { + if (ret != -ENOTSUP && ret != -EAGAIN) { + return ret; + } + continue; + } + + trace_qcow2_skip_cow(qemu_coroutine_self(), m->offset, m->nb_clusters); + m->skip_cow = true; + } + return 0; +} + static coroutine_fn int qcow2_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) @@ -2122,24 +2189,33 @@ static coroutine_fn int qcow2_co_pwritev(BlockDriverState *bs, uint64_t offset, goto fail; } + qemu_co_mutex_unlock(&s->lock); + + ret = handle_alloc_space(bs, l2meta); + if (ret < 0) { + qemu_co_mutex_lock(&s->lock); + goto fail; + } + /* If we need to do COW, check if it's possible to merge the * writing of the guest data together with that of the COW regions. * If it's not possible (or not necessary) then write the * guest data now. */ if (!merge_cow(offset, cur_bytes, &hd_qiov, l2meta)) { - qemu_co_mutex_unlock(&s->lock); BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); trace_qcow2_writev_data(qemu_coroutine_self(), cluster_offset + offset_in_cluster); ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster, cur_bytes, &hd_qiov, 0); - qemu_co_mutex_lock(&s->lock); if (ret < 0) { + qemu_co_mutex_lock(&s->lock); goto fail; } } + qemu_co_mutex_lock(&s->lock); + ret = qcow2_handle_l2meta(bs, &l2meta, true); if (ret) { goto fail; diff --git a/block/trace-events b/block/trace-events index 3e8c47bb24..f3f6d66dcc 100644 --- a/block/trace-events +++ b/block/trace-events @@ -69,6 +69,7 @@ qcow2_writev_done_part(void *co, int cur_bytes) "co %p cur_bytes %d" qcow2_writev_data(void *co, uint64_t offset) "co %p offset 0x%" PRIx64 qcow2_pwrite_zeroes_start_req(void *co, int64_t offset, int count) "co %p offset 0x%" PRIx64 " count %d" qcow2_pwrite_zeroes(void *co, int64_t offset, int count) "co %p offset 0x%" PRIx64 " count %d" +qcow2_skip_cow(void *co, uint64_t offset, int nb_clusters) "co %p offset 0x%" PRIx64 " nb_clusters %d" # block/qcow2-cluster.c qcow2_alloc_clusters_offset(void *co, uint64_t offset, int bytes) "co %p offset 0x%" PRIx64 " bytes %d" diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index af0588ae9a..089df94657 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -150,27 +150,33 @@ $QEMU_IO -c "$OPEN_RO" -c "read -P 1 0 512" | _filter_qemu_io echo echo "=== Testing overlap while COW is in flight ===" echo +BACKING_IMG=$TEST_IMG.base +TEST_IMG=$BACKING_IMG _make_test_img 1G + +$QEMU_IO -c 'write 64k 64k' "$BACKING_IMG" | _filter_qemu_io + # compat=0.10 is required in order to make the following discard actually -# unallocate the sector rather than make it a zero sector - we want COW, after -# all. -IMGOPTS='compat=0.10' _make_test_img 1G +# unallocate the sector rather than make it a zero sector as we would like +# to reuse it for another guest offset +IMGOPTS='compat=0.10' _make_test_img -b "$BACKING_IMG" 1G # Write two clusters, the second one enforces creation of an L2 table after # the first data cluster. $QEMU_IO -c 'write 0k 64k' -c 'write 512M 64k' "$TEST_IMG" | _filter_qemu_io -# Discard the first cluster. This cluster will soon enough be reallocated and -# used for COW. +# Discard the first cluster. This cluster will soon enough be reallocated $QEMU_IO -c 'discard 0k 64k' "$TEST_IMG" | _filter_qemu_io # Now, corrupt the image by marking the second L2 table cluster as free. poke_file "$TEST_IMG" '131084' "\x00\x00" # 0x2000c -# Start a write operation requiring COW on the image stopping it right before -# doing the read; then, trigger the corruption prevention by writing anything to -# any unallocated cluster, leading to an attempt to overwrite the second L2 +# Start a write operation requiring COW on the image; +# this write will reuse the host offset released by a previous discard. +# Stop it right before doing the read. +# Then, trigger the corruption prevention by writing anything to +# another unallocated cluster, leading to an attempt to overwrite the second L2 # table. Finally, resume the COW write and see it fail (but not crash). echo "open -o file.driver=blkdebug $TEST_IMG break cow_read 0 -aio_write 0k 1k +aio_write 64k 1k wait_break 0 -write 64k 64k +write 128k 64k resume 0" | $QEMU_IO | _filter_qemu_io echo diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index d67c6234a4..ec8f15d2f0 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -97,7 +97,10 @@ read 512/512 bytes at offset 0 === Testing overlap while COW is in flight === -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1073741824 +wrote 65536/65536 bytes at offset 65536 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 backing_file=TEST_DIR/t.IMGFMT.base wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 536870912 From patchwork Mon Dec 3 10:15:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="iEnLMlEq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gyf3BCYz9s47 for ; Mon, 3 Dec 2018 21:21:46 +1100 (AEDT) Received: from localhost ([::1]:47782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlMG-0006oe-1T for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:21:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFw-0002My-QQ for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFu-00055L-Ba for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:12 -0500 Received: from mail-eopbgr60112.outbound.protection.outlook.com ([40.107.6.112]:44323 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTlFu-0004nY-0D; Mon, 03 Dec 2018 05:15:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZsPRd/+7V0SoxigRqm20RMePq0NSbY8JpO+QRsCj7AQ=; b=iEnLMlEqyYf6ZUVqPMRaWgiUUDgHHDTAx0yfJU7B9Xx1fhCDuTDrAlCntLt9/ylBP6Z8dsRiqKGulkdqRC5jWdX1VptqpqIJs0K4/QH6F6LHPfk2EwlGQFLejpIgMsQsjrntWEvtyEafWR2ivLm0jgrr0vjuU0ERTyPleAKkL4c= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3922.eurprd08.prod.outlook.com (20.178.118.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 10:15:00 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:15:00 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 9/9] iotest 134: test cluster-misaligned encrypted write Thread-Index: AQHUivEMw9dvY84eo0yHqsTsgEA/1A== Date: Mon, 3 Dec 2018 10:15:00 +0000 Message-ID: <20181203101429.88735-10-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3922; 20:Fbyf7xvbJxDU3ORj+5xlcymSNw1AxOHHGgreVmbkXYdZeot3oBtbSmQeVFV1J2S7/eMEUyFcBJmCxqbxOkHY/IhAaq30Y8ly9HQWoq31eRKWhk0t/TGhf06GhBucmF1y6E/xeR+G4XCmFswrk+OmxBjadUuULBA8W9+cocWYjis= x-ms-office365-filtering-correlation-id: 0b94caea-f30f-4edf-c09d-08d659082f2c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3922; x-ms-traffictypediagnostic: AM0PR08MB3922: authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3922; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3922; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(376002)(346002)(396003)(189003)(199004)(476003)(107886003)(5660300001)(54906003)(14454004)(2906002)(52116002)(386003)(7736002)(1076002)(99286004)(6506007)(316002)(3846002)(6116002)(305945005)(68736007)(25786009)(478600001)(76176011)(97736004)(86362001)(66066001)(36756003)(8676002)(14444005)(44832011)(6486002)(8936002)(2501003)(81156014)(81166006)(256004)(26005)(2351001)(11346002)(4326008)(446003)(102836004)(106356001)(105586002)(5640700003)(186003)(6436002)(71200400001)(71190400001)(6512007)(486006)(53936002)(6916009)(2616005)(21314003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3922; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: X7uO5LG5/CgqaoJmdNq6aj1Boo/qSwfmO6yHsW6YVI+xspEiTn6eWLOuMR5Wc9HExW6lSQgVzi9Nc6vecxgajfaIASsrncJEgGJTz6TSwyD55DDPBwFq5GUmCy2WcMRSnENdoYFSuKKF6KajvUh1hxFa1Sjvr81qhVGbfF084j/bLZ1AbR1JDAKJQ8GX7q/nE/TPxogyqmCyB+RoQ/Mr8oIE8jxSA/gtRkpGuWuTCkxxjfgmoda7VyxBA1FFtkZISoe1BZTdhBI/pUnpnPUrYbdGrg8LdtZJQtcRMSyE8QLW95pQPL0PkJRssozHnzmv2k1oAOPicWeu1u5ljuwNYiFgmJMUwwdMvoHbnYUfR+0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b94caea-f30f-4edf-c09d-08d659082f2c X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:15:00.7457 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3922 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.6.112 Subject: [Qemu-devel] [PATCH v10 9/9] iotest 134: test cluster-misaligned encrypted 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" COW (even empty/zero) areas require encryption too Signed-off-by: Anton Nefedov Reviewed-by: Eric Blake Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- tests/qemu-iotests/134 | 9 +++++++++ tests/qemu-iotests/134.out | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 index cacabcd28b..792c8ca12f 100755 --- a/tests/qemu-iotests/134 +++ b/tests/qemu-iotests/134 @@ -57,6 +57,15 @@ echo echo "== reading whole image ==" $QEMU_IO --object $SECRET -c "read 0 $size" --image-opts $IMGSPEC | _filter_qemu_io | _filter_testdir +echo +echo "== rewriting cluster part ==" +$QEMU_IO --object $SECRET -c "write -P 0xb 512 512" --image-opts $IMGSPEC | _filter_qemu_io | _filter_testdir + +echo +echo "== verify pattern ==" +$QEMU_IO --object $SECRET -c "read -P 0 0 512" --image-opts $IMGSPEC | _filter_qemu_io | _filter_testdir +$QEMU_IO --object $SECRET -c "read -P 0xb 512 512" --image-opts $IMGSPEC | _filter_qemu_io | _filter_testdir + echo echo "== rewriting whole image ==" $QEMU_IO --object $SECRET -c "write -P 0xa 0 $size" --image-opts $IMGSPEC | _filter_qemu_io | _filter_testdir diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out index 972be49d91..09d46f6b17 100644 --- a/tests/qemu-iotests/134.out +++ b/tests/qemu-iotests/134.out @@ -5,6 +5,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encryption=on encrypt. read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== rewriting cluster part == +wrote 512/512 bytes at offset 512 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== verify pattern == +read 512/512 bytes at offset 0 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 512 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + == rewriting whole image == wrote 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)