From patchwork Tue Dec 18 07:57:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015109 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="TyPbQAd/"; 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 43Jr4F6F7lz9sBZ for ; Tue, 18 Dec 2018 18:58:21 +1100 (AEDT) Received: from localhost ([::1]:52350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGh-0006LJ-HV for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 02:58:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAFz-0006IY-Cz for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAFx-0003Vr-3B for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:35 -0500 Received: from mail-ve1eur01on0707.outbound.protection.outlook.com ([2a01:111:f400:fe1f::707]:27463 helo=EUR01-VE1-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 1gZAFw-0003Sp-K8; Tue, 18 Dec 2018 02:57:32 -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=Z2HtLBzcLdokeAYDE55uDdSw6+afK2+GPrbf3DeU+ng=; b=TyPbQAd/DP4mtAWFt1HUGprnzktDI+ii1AYHXqOS1p9M/xXJ7iN2rS07W4sVeMv97N8QDb4OWenKwn6Sh3aBn+TK03pLEOUI6Kq2p7ucxTusqPhPZVXwnZlPu9FFjj+49ET9DZK+RkeZITgqBPgVdMv1LD4PN/Xgqwjh03A2yCY= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4419.eurprd08.prod.outlook.com (20.179.34.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:30 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:30 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 01/10] mirror: inherit supported write/zero flags Thread-Index: AQHUlqdTXHuDwNBEYE210twFppaUpA== Date: Tue, 18 Dec 2018 07:57:30 +0000 Message-ID: <20181218075707.12006-2-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4419; 20:0GJlYw+R6zmGk2LPoHTsGhR7WI6c1D+jtCO45EXLqPXTB2uwd/W6hBiDn0Kbu3mhOaTSArcIb/l1OGgYN6GiTASdLq9yAezTP3AFXcpyWl7uBDScm8sPnYhXVgiKXTx5FU+ZBpz+HuCKYKXN/Hi8dFTXVa6Ig5IISST9oETRU4c= x-ms-office365-filtering-correlation-id: 22d2129e-edbe-4db7-55e5-08d664be75ba x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4419; x-ms-traffictypediagnostic: AM0PR08MB4419: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4419; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4419; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(396003)(39850400004)(346002)(376002)(366004)(199004)(189003)(8676002)(5660300001)(5640700003)(7736002)(8936002)(4326008)(81166006)(81156014)(14454004)(305945005)(53936002)(97736004)(106356001)(2501003)(68736007)(25786009)(2351001)(105586002)(1076003)(478600001)(386003)(6916009)(66066001)(6506007)(486006)(26005)(76176011)(71190400001)(71200400001)(6486002)(102836004)(86362001)(186003)(476003)(6512007)(99286004)(3846002)(6116002)(54906003)(2906002)(2616005)(256004)(11346002)(52116002)(107886003)(446003)(6436002)(36756003)(44832011)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4419; 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: /saezRBaArIU/egeyGijNZKMCQLzb5rTw8gc5yM3aTphKs2odlnZVTxQ363z/LE0Bv3d3CRy+4eqGEQ0/fcpmeDu5qQsgqS+T2ffeiY/Uzc1V0ijoWU2/iG1THPXCI6Gk5mTx3eE1GU1Cq5nASjZy2W29W7yRhKsuDvxBKs87nvFZHvx/FtxoKJhyQ75BO3MBGMU1KSJXo7rCeyuulIGPcp1n8GRW0/QSo6gYFYWQ7+1PVB0BrZrdWJFdbKO//ap/GcI3EKbFOc2wV5TUyNLrZE8yw4b/OpkJYNAxOQD7Xovn1C/a1mT/fmXEQyYQG74 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22d2129e-edbe-4db7-55e5-08d664be75ba X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:30.4338 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4419 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe1f::707 Subject: [Qemu-devel] [PATCH v11 01/10] 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 ab59ad77e8..be52c9be9c 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1529,8 +1529,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 Tue Dec 18 07:57:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015113 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="RFWY/+dC"; 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 43Jr7W6XTLz9rxp for ; Tue, 18 Dec 2018 19:01:10 +1100 (AEDT) Received: from localhost ([::1]:52368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAJP-0000lZ-Oo for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:01:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAG0-0006Ih-Hk for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAFz-0003Y0-6A for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:36 -0500 Received: from mail-ve1eur01on0731.outbound.protection.outlook.com ([2a01:111:f400:fe1f::731]:21220 helo=EUR01-VE1-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 1gZAFy-0003Wv-Nz; Tue, 18 Dec 2018 02:57:34 -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=YtKU7MAoZBfWpZzj3rR0JS/qAwrC+66+wyvLlMIdQIk=; b=RFWY/+dCz/hqSOpXJ45kUt8gaob57vl2ru83lxNyUqCL5N+rOmqwM5LMbbKLnp7PYMI7JWfTo6TWd21TuNbQaB0toKsKXes1/TxC2Ahq+xPT8CbYWJhfYaayUNzIDOIvLMHp4BjM8TxgQifzwC/d5N8r+eiHxfO1qsPFloMKMkY= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4419.eurprd08.prod.outlook.com (20.179.34.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:32 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:32 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 02/10] blkverify: set supported write/zero flags Thread-Index: AQHUlqdUL2Hr50GQwU2C89T+Wwyhaw== Date: Tue, 18 Dec 2018 07:57:32 +0000 Message-ID: <20181218075707.12006-3-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4419; 20:uu/lxXERrVnKLRqMFVdM9J9Wey97BRDGcoP4MEYWjemkkzW30ZnEm3mk3FhhEfBBedLq1N5ECUOB26qisqRiAeFWtNHzbA3AekNVtlCij8tLwdpxb9lZ+1LECX0IYt/H+QJnCX7/gHM6huGtt9at/bGXSG5m0znylan+mc9QmiI= x-ms-office365-filtering-correlation-id: d208b874-ab67-41c3-e3d2-08d664be770c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4419; x-ms-traffictypediagnostic: AM0PR08MB4419: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4419; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4419; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(396003)(39850400004)(346002)(376002)(366004)(199004)(189003)(8676002)(5660300001)(5640700003)(7736002)(8936002)(4326008)(81166006)(81156014)(14454004)(305945005)(53936002)(97736004)(106356001)(2501003)(68736007)(25786009)(2351001)(105586002)(1076003)(478600001)(386003)(6916009)(66066001)(6506007)(486006)(26005)(76176011)(71190400001)(71200400001)(6486002)(102836004)(86362001)(186003)(476003)(6512007)(99286004)(3846002)(6116002)(54906003)(2906002)(2616005)(256004)(11346002)(52116002)(107886003)(446003)(6436002)(36756003)(44832011)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4419; 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: yRowiAO6P5fQIXzbEjr7Vrt1rATOofD/30DbTFg73gx7Rk2y6nx2sLbKJ9qK62ny7yc4Y4t1aChOrm83Fl/VwDVNShOt5KvO1d39Yd51z84AWzzeuG7O8iSTVdnuNYqFHft7UQ0w0zbdFkNb3Ek1bhW2jHTb/ICxL1xegS4rBnmz2IQjjspaO5N5ojz02BvZsZwIAI5xQotECVZLh1D7rdmMwotkfbBnQisGFzUvdbYMXErbY+T7JpYoDtFvQxs8QYGD2NiBozhK42bhthFmqRZdOL/GqqOD7SXTy2qHL9CA2xsrVEI9Go7PBlD9tQ3h spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d208b874-ab67-41c3-e3d2-08d664be770c X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:32.6682 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4419 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe1f::731 Subject: [Qemu-devel] [PATCH v11 02/10] 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 Tue Dec 18 07:57:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015111 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="Gf+UCxPN"; 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 43Jr4M43krz9sBZ for ; Tue, 18 Dec 2018 18:58:27 +1100 (AEDT) Received: from localhost ([::1]:52353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGm-0006OV-SS for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 02:58:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAG3-0006Ls-1s for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAG1-0003at-FO for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:38 -0500 Received: from mail-am5eur02on0703.outbound.protection.outlook.com ([2a01:111:f400:fe07::703]:16960 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 1gZAG1-0003ZD-2N; Tue, 18 Dec 2018 02:57:37 -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=I9qY+dQfcLCBZk7l4ucZ47qQVSBb41CC1s87igRGLbE=; b=Gf+UCxPNIdMQiS58FDnW2pF/X6vVPD5QMQD1qQaVkHVAOwIwD6d1DNBuRR8Zhbx9h3simIQ1NriUsaWfwOnSp5Jw1Yyp84c8Bxu26+S+7nnFkwatSoodC5O9qybEEyJD1xYeEM2AjNEiXSUtodXF7wGzdPL0EMqVU/Pr2kO8ImQ= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4033.eurprd08.prod.outlook.com (20.178.119.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:34 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:34 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 03/10] quorum: set supported write flags Thread-Index: AQHUlqdV49agqvCBfkmvcehtQKt8iA== Date: Tue, 18 Dec 2018 07:57:34 +0000 Message-ID: <20181218075707.12006-4-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4033; 20:X0bwgh4cFso6fFdxwi+dg13fUM3h1YBnZXmy2nPduyfCaU9l3nlrcV/i2gDiQyNQXJb6MGOz9jCmtaKXTsBNyi4tOCy3Rsd0fQCi7pAVUubqY2gYbKNxwF/xSu/BA7Ut6mSSUVGUTalMHO3z+UGsw7ir/eetJtFYXFo7QbGFl3M= x-ms-office365-filtering-correlation-id: 37818705-f542-4507-1245-08d664be781f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4033; x-ms-traffictypediagnostic: AM0PR08MB4033: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4033; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4033; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(136003)(376002)(39850400004)(189003)(199004)(14454004)(6436002)(5660300001)(66066001)(52116002)(102836004)(2906002)(54906003)(99286004)(6116002)(316002)(107886003)(6486002)(76176011)(4326008)(6512007)(3846002)(1076003)(478600001)(53936002)(7736002)(68736007)(5640700003)(25786009)(11346002)(26005)(14444005)(486006)(44832011)(186003)(2351001)(2501003)(305945005)(8936002)(105586002)(476003)(81166006)(97736004)(6916009)(106356001)(71190400001)(81156014)(8676002)(71200400001)(386003)(6506007)(86362001)(256004)(446003)(2616005)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4033; 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: qRW162OaAVj66vq/vFss3QkHu7raKoMidKJj4P/KfVDA6ycFn/PI/gZ70JdHkchgr8gLDgbVGYCfW3oyokfkEtD3yo5eiiS+qHifMx3iKdH2rMDK1ypvlI39FV2mm3gIeJ7xtkxUC3210vVfKD6iiaaIfPODQHavrsWILtcoI1kXtKaoGzQ8JNJ2v0CrqiTJgAgleIDen4wjgjceiSyk6wb0c9+9xakPTPj4e1gAcAs5x3i/BCzVfJgxjDRZ9r0I1xwg9R71gzXMUsLCHxjJAjtRBeVzvXPzyrNnAGe24kSrkUi6oE9+X4W+O700Dj2V spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37818705-f542-4507-1245-08d664be781f X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:34.4026 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4033 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::703 Subject: [Qemu-devel] [PATCH v11 03/10] 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 Tue Dec 18 07:57:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015114 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="GzGSw7Bl"; 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 43Jr7r1mfdz9sBZ for ; Tue, 18 Dec 2018 19:01:28 +1100 (AEDT) Received: from localhost ([::1]:52372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAJh-0000x3-86 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:01:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAG3-0006Mc-PE for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAG1-0003bJ-V3 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:39 -0500 Received: from mail-am5eur02on0703.outbound.protection.outlook.com ([2a01:111:f400:fe07::703]:16960 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 1gZAG1-0003ZD-KX; Tue, 18 Dec 2018 02:57:37 -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=z0SWtcq6oS1mEUeuF+ykUHF9jYjYfkXMbZIOoETBOLw=; b=GzGSw7BlH53lNC12HTkokTIkGvG10S7C42GR3obmIKPSbQRIEs06VoCD466m0o4F61bbplPexz57+yVVHYMivkIxf1UV3Yb9A2Nx+03tsghxlsthE2O5U9q08WKkYpMlGnrxI68YLb3pivuFBhQ4AXSS22H/SAC9gqTdD21PPkY= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4033.eurprd08.prod.outlook.com (20.178.119.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:36 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:36 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 04/10] block: introduce BDRV_REQ_ALLOCATE flag Thread-Index: AQHUlqdWtBm9ajocoUWVCZ/dUy1rAw== Date: Tue, 18 Dec 2018 07:57:36 +0000 Message-ID: <20181218075707.12006-5-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4033; 20:IOAGaQu8Xgh2+jQRpBpTyXjCTEeZerjsffFfCncQmt15FCDSLw7LktLO1QJJRCJIObRKkTSfWxyJnP2MXyRk9HSHd33ahsAHoMQ0G4jdyxlieibQIaSk7970hr2/0eLAXzFy4mkWpSU5q3KBfH11PWszdlhEfxExF5XlMmsuWAU= x-ms-office365-filtering-correlation-id: b52e118c-7c2c-40fb-de4f-08d664be792e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4033; x-ms-traffictypediagnostic: AM0PR08MB4033: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4033; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4033; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(136003)(376002)(39850400004)(189003)(199004)(14454004)(6436002)(5660300001)(66066001)(52116002)(102836004)(2906002)(54906003)(99286004)(6116002)(316002)(107886003)(6486002)(76176011)(4326008)(6512007)(3846002)(1076003)(478600001)(53936002)(7736002)(68736007)(5640700003)(25786009)(11346002)(26005)(486006)(44832011)(186003)(2351001)(2501003)(305945005)(8936002)(105586002)(476003)(81166006)(97736004)(6916009)(106356001)(71190400001)(81156014)(8676002)(71200400001)(386003)(6506007)(86362001)(256004)(446003)(2616005)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4033; 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: 9myQrawTFhPBuP2Cf1OjslzpqPchnD/waYPR+oC9Z8kc+rMR29SES5hxunN6RKc4W8uckPp6l9Y9q8OrrnTuK05dWZNwE7sqLfDFbekWUeyzNmLGhapTcuV2BaZbPX3+dPC3LVVaDjw+rqyKPKTUOJae++x0P9Jlbfs4YFZ+exrN4hc2gS+dX1sxWBylS27TnEtXd3eMWGo/yN2vp/yixtvlLCKKnLfno2n9WpwkqLSRPPYvBsl6XM7jrtaVpXEtZLtpnbf4u7vAUh4o5OvLRKmFYt7Hk0YqUNwqrAxJeiyjGTYQtTEJSq+KCl4pZD+P spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b52e118c-7c2c-40fb-de4f-08d664be792e X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:36.1838 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4033 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::703 Subject: [Qemu-devel] [PATCH v11 04/10] 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: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- include/block/block.h | 10 +++++++++- include/block/block_int.h | 3 ++- block/io.c | 14 +++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index f70a843b72..643d32f4b8 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -83,8 +83,16 @@ 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..833129d912 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -724,7 +724,8 @@ 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..66006a089d 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; @@ -1773,6 +1773,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 +1861,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 +1986,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 Tue Dec 18 07:57:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015125 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="LGss9fbN"; 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 43JrD46m0Pz9sCh for ; Tue, 18 Dec 2018 19:05:08 +1100 (AEDT) Received: from localhost ([::1]:52394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZANG-0003ls-54 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:05:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAG8-0006PE-6r for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAG4-0003dg-PV for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:43 -0500 Received: from mail-ve1eur03on071d.outbound.protection.outlook.com ([2a01:111:f400:fe09::71d]:6167 helo=EUR03-VE1-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 1gZAG4-0003cS-9S; Tue, 18 Dec 2018 02:57:40 -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=fvc+iED4iWv1ieJRJLBavPDqDVCZcR3e7vVzDa9xwcU=; b=LGss9fbNfD6W5coN9p+sZeD710spJL79wYNAg7WYAvfB6Zgig0UKpAZEvbcunreSWIPFORqp/yh4lpvK9+M8Rw2BtZiyLp2E0Mo2WfGbNH4uYXgkwWNjrr69H7p+d1ggVkLQDdN48p30VIHvBSKXRiYVLOcPjK4AcOzH7zRrTd8= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4419.eurprd08.prod.outlook.com (20.179.34.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:38 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:38 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 05/10] block: treat BDRV_REQ_ALLOCATE as serialising Thread-Index: AQHUlqdYKh2pii7CQEWDNg94f2O9+A== Date: Tue, 18 Dec 2018 07:57:38 +0000 Message-ID: <20181218075707.12006-6-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4419; 20:Ln1XpZcOD9Bgv6g+jMGzRe4jrVj6OrzrvxynurRaaCF8QLIrNY+U+40m5PURKG707ZzsoWOA0pqs3nYanNgCOTiKddMyPFhQtGO0uhbpghdr/Yq37FldCnLVuBxzKUj5R5gnsA20NXInNYwTtHxRebvmxgjPgEoOXPai5sXYMFY= x-ms-office365-filtering-correlation-id: 44b1eeb7-fd1d-48d2-aa62-08d664be7a3e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4419; x-ms-traffictypediagnostic: AM0PR08MB4419: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4419; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4419; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(396003)(39850400004)(346002)(376002)(366004)(199004)(189003)(8676002)(5660300001)(5640700003)(7736002)(8936002)(4326008)(81166006)(81156014)(14454004)(305945005)(53936002)(97736004)(106356001)(2501003)(68736007)(25786009)(2351001)(105586002)(1076003)(478600001)(386003)(6916009)(66066001)(6506007)(486006)(26005)(76176011)(71190400001)(71200400001)(6486002)(102836004)(575784001)(86362001)(186003)(476003)(6512007)(99286004)(3846002)(6116002)(14444005)(54906003)(2906002)(2616005)(256004)(11346002)(52116002)(107886003)(446003)(6436002)(36756003)(44832011)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4419; 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: fP9rHSM4lVvuPlJZozAR7pOwTN75OE8LdeqtuYnL2FgWfF4FQyN/c5Xex6iDPblgxzZhZ1ubSLJwTj8JIKRfpYDMEpF0HrRmzBSDXA2g9ZJDExSakz4hblv0um1P44xJBo0mG0R5xOnLlNJBT/tZ8+OgOk0QG28Kj98j+CZBefLRZr8/3NZuC9sfqJ1wNgPlYKWXNpts3O+FzIJwMo6Cyz1aj9rGh/oHU1GXZihwoZhN2nDM3Tardn0xBoSSr1GtB/z9VFuvdaSNdaJ7n+LOgjLd0gZ9bTmS6ifuaiW3rHjpsi9+KoPNBQ0sU2KiWB0Z spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44b1eeb7-fd1d-48d2-aa62-08d664be7a3e X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:38.1369 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4419 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe09::71d Subject: [Qemu-devel] [PATCH v11 05/10] 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 Reviewed-by: Alberto Garcia --- include/block/block.h | 3 +++ block/io.c | 31 ++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 643d32f4b8..dfc0fc1b8f 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -88,6 +88,9 @@ typedef enum { * 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. + * This flag implicitly sets BDRV_REQ_SERIALISING meaning it is protected + * from conflicts with overlapping requests. If such conflict is detected, + * -EAGAIN is returned. */ BDRV_REQ_ALLOCATE = 0x100, diff --git a/block/io.c b/block/io.c index 66006a089d..4451714a60 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); @@ -1864,6 +1877,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 Tue Dec 18 07:57:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015115 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="b+mvRoGx"; 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 43Jr7v5XgZz9rxp for ; Tue, 18 Dec 2018 19:01:31 +1100 (AEDT) Received: from localhost ([::1]:52374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAJl-00011e-2O for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:01:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAG8-0006PI-BW for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAG6-0003fq-Ma for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:44 -0500 Received: from mail-am5eur03on0728.outbound.protection.outlook.com ([2a01:111:f400:fe08::728]:19870 helo=EUR03-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 1gZAG6-0003eE-AT; Tue, 18 Dec 2018 02:57:42 -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=Nk5Pq8alT6cyscCTifuw7wNRhjsTHJMsg/SN+QMICm8=; b=b+mvRoGxzxbpIzYKGSPHVfPCTgoFgrobbGir3UNLMX6wZiQ+XYhL8OFSoHGUb9IoHIAcF6tstkg12is8dInKsSU5Akp2WPeCAlY5sNWB0qV/I7GK7sQ98VX4C3qfHhe046lQf8D0Ur0s145Hv+KpjzuYDUfW9LTPdryPvaCSqPc= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4419.eurprd08.prod.outlook.com (20.179.34.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:40 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:40 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 06/10] file-posix: reset fallocate-related flags without CONFIG_FALLOCATE* Thread-Index: AQHUlqdZFXoiZoW54U6Zq1dDULXYzQ== Date: Tue, 18 Dec 2018 07:57:40 +0000 Message-ID: <20181218075707.12006-7-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4419; 20:yin8uVUf/j6jvq69SK1hcw8hXKzOZILi6kD0BRpwZ+2zBqRfbapD3KZIRsavtI3VNBAxyHgLnOA+5I53mrQq90lHI+sn5GBvmBQY6LB0bC+FKDTVfPIaMym9Svxnyhkfd8V6CVHgBEivnDkDdV1qqLPKgT4n3mpgOYzTn+RnoVg= x-ms-office365-filtering-correlation-id: b3b09627-c865-468e-722e-08d664be7bab x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4419; x-ms-traffictypediagnostic: AM0PR08MB4419: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4419; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4419; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(396003)(39850400004)(346002)(376002)(366004)(199004)(189003)(8676002)(5660300001)(5640700003)(7736002)(8936002)(4326008)(81166006)(81156014)(14454004)(305945005)(53936002)(97736004)(106356001)(2501003)(68736007)(25786009)(2351001)(105586002)(1076003)(478600001)(386003)(6916009)(66066001)(6506007)(486006)(26005)(76176011)(71190400001)(71200400001)(6486002)(102836004)(575784001)(86362001)(186003)(476003)(6512007)(99286004)(3846002)(6116002)(54906003)(2906002)(2616005)(256004)(11346002)(52116002)(107886003)(446003)(6436002)(36756003)(44832011)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4419; 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: gCwrqwOLCxtfGMRUoUOwZu32tkn8DxseGqDTJil75p8M90NXWaMv2wqHp///ZDsuKuQZnz2TvtRGfXhtdLjNOkULNg4ydkBr1ZbwkqU5zlWZgmvh1rGKcytrdXl+hUi13N08ye4taFIW5vwh9dHsxDG1oiUSgvUztPfhPQDb+evJFyjvbdhwMcuGwAFsusK0Hr1/zccIhXm+47I9brvUe4Vrl0GzS9YVDoQUccrDzQ8/DNCGduimkKNe/p0UHX1QXLP7bCSmLxMVeLAeYx1mKcYQhEZlpS4AlYImjjgAYxgxFvRlrxKkKqXn/HjJlA8b spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3b09627-c865-468e-722e-08d664be7bab X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:40.3713 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4419 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe08::728 Subject: [Qemu-devel] [PATCH v11 06/10] file-posix: reset fallocate-related flags without CONFIG_FALLOCATE* 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" these flags currently affect nothing without CONFIG_FALLOCATE*, so it's not a bug. Fixing it makes possible to adjust supported zero flag BDRV_REQ_ALLOCATE regardless of configuration (in the following patch). Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- block/file-posix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index d8f0b93752..a65e464cbc 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1488,9 +1488,7 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb) static int handle_aiocb_write_zeroes(void *opaque) { RawPosixAIOData *aiocb = opaque; -#if defined(CONFIG_FALLOCATE) || defined(CONFIG_XFS) BDRVRawState *s = aiocb->bs->opaque; -#endif #ifdef CONFIG_FALLOCATE int64_t len; #endif @@ -1514,6 +1512,8 @@ static int handle_aiocb_write_zeroes(void *opaque) } s->has_write_zeroes = false; } +#else + s->has_write_zeroes = false; #endif #ifdef CONFIG_FALLOCATE_PUNCH_HOLE @@ -1533,6 +1533,8 @@ static int handle_aiocb_write_zeroes(void *opaque) s->has_discard = false; } } +#else + s->has_discard = false; #endif #ifdef CONFIG_FALLOCATE @@ -1546,6 +1548,8 @@ static int handle_aiocb_write_zeroes(void *opaque) } s->has_fallocate = false; } +#else + s->has_fallocate = false; #endif return -ENOTSUP; From patchwork Tue Dec 18 07:57:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015112 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="hAogNuEy"; 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 43Jr4z5xgKz9sBZ for ; Tue, 18 Dec 2018 18:58:59 +1100 (AEDT) Received: from localhost ([::1]:52356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAHJ-0007AX-E6 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 02:58:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGE-0006Uc-2G for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAG9-0003j0-Qp for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:49 -0500 Received: from mail-eopbgr140100.outbound.protection.outlook.com ([40.107.14.100]:48750 helo=EUR01-VE1-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 1gZAG9-0003hI-CJ; Tue, 18 Dec 2018 02:57:45 -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=8kfLkwCBXcrR83664LT4qnS8U2O5hor0dgtJhUZP0Jg=; b=hAogNuEyx2Tgj+kbfXQU3qTv4i8TBTDtm9hEBhmT8A45fDvyBkxuZonqsHH7iu44OPLUPAWg/me6w0NKEy3NsVWpHuPdDwrIVmyPCzc/P8wK86C9e5/rLC+qwD+49kKS1IP5liISkeqUfRwjTM8u4RkLplaysn5N4F2H30LwgPo= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4289.eurprd08.prod.outlook.com (20.179.33.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:42 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:42 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 07/10] file-posix: support BDRV_REQ_ALLOCATE Thread-Index: AQHUlqdahHcZCREVxUusJk+nQCMLSQ== Date: Tue, 18 Dec 2018 07:57:41 +0000 Message-ID: <20181218075707.12006-8-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4289; 20:Jrjo0VcFIfkAiOnYR2dBtC3mXyy7E2zUllg+feXcwk3P2TqCYIEksaE52qoowXvj+PXbXVixZa4vYdvlFCuwIjqmLNiv1sQi76vikAz1yE5m5PYiMiwIR4qjUaM1AiMUqkUNAHY0+cc3jFTEeg6qi0mRbNvwznRva/OgNplhC8A= x-ms-office365-filtering-correlation-id: 88eb6799-42df-4863-c91a-08d664be7ca5 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4289; x-ms-traffictypediagnostic: AM0PR08MB4289: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4289; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4289; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39850400004)(376002)(346002)(396003)(189003)(199004)(5640700003)(6486002)(25786009)(53936002)(68736007)(97736004)(2616005)(6512007)(476003)(446003)(99286004)(4326008)(2906002)(71190400001)(76176011)(305945005)(186003)(1076003)(11346002)(7736002)(486006)(71200400001)(3846002)(86362001)(6436002)(478600001)(81166006)(54906003)(386003)(6506007)(81156014)(14454004)(105586002)(256004)(102836004)(2351001)(316002)(6916009)(6116002)(26005)(14444005)(106356001)(107886003)(8676002)(2501003)(52116002)(44832011)(36756003)(5660300001)(8936002)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4289; 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: HXosbFSD3WqobXumuL9vtS92Ay7WL9kOeRCfuoYePMUwAArPkho++oH8v61SfEH38ZfWRFwv2tQPhzLMVryT4zO2cDVx23xXw1bbaZGlylEUd4rYlPt/CpbO1ICPapnRfPoVQVN54va6JTQUb9qFwWy/z5vOvDCI5iE3PsyvlaiBGJBHbTdsbK97sOyEjE2j07KMJMCHnaemthwmV5C+8j/olAC3+YlL7LXddeSHTlIbS2afnAzuYJbqILgoICdhOAQ+9b/ybh7AL3pxPdSjdTs9q/2WAAGUC0q5jXQdi3PmkPwftu/e8rVRi8UdQivh spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88eb6799-42df-4863-c91a-08d664be7ca5 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:42.0432 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4289 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.14.100 Subject: [Qemu-devel] [PATCH v11 07/10] 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: Vladimir Sementsov-Ogievskiy 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 a65e464cbc..c3fbf53853 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -607,6 +607,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))) { @@ -650,10 +651,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)) { @@ -1552,6 +1554,10 @@ static int handle_aiocb_write_zeroes(void *opaque) s->has_fallocate = false; #endif + if (!s->has_fallocate) { + aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE; + } + return -ENOTSUP; } From patchwork Tue Dec 18 07:57:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015117 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="YDOJz3ac"; 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 43JrCP111zz9rxp for ; Tue, 18 Dec 2018 19:04:33 +1100 (AEDT) Received: from localhost ([::1]:52385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAMg-0003LW-Nu for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:04:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGC-0006SR-ET for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAGA-0003jJ-70 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:48 -0500 Received: from mail-am5eur02on0705.outbound.protection.outlook.com ([2a01:111:f400:fe07::705]:19486 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 1gZAG9-0003iD-Q4; Tue, 18 Dec 2018 02:57:45 -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=G01TaJ4ORb5qKJ1LhPo5tTwsvAa7dXKR+jXO+NgI8d0=; b=YDOJz3acnjzoxB6/o1QvqhsKnLaV6uuScrwOWDw7EB2c434j/arXWfOvkGb3unJtfIwuoSodda0HUj6Pd4Ch61AGfqIuNmz/APt0FFVnUhaL44VFW6Ojmwxg0eMIYR1xWkmFEC//q04IrdP0j7EuppjkxNoZ9x7mOUHOuUaCgjQ= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4033.eurprd08.prod.outlook.com (20.178.119.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:43 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:43 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 08/10] block: support BDRV_REQ_ALLOCATE in passthrough drivers Thread-Index: AQHUlqdbTA46tD3MWEiHE+OCT+JIJA== Date: Tue, 18 Dec 2018 07:57:43 +0000 Message-ID: <20181218075707.12006-9-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4033; 20:iofBh+/lZuvrkCEdYK+AnnsMfkJMwW3gPuINTJD+PX5KChgzJuqv5DBWVaKMamYjcVSktNs/mYwBixkRKQzF6fhyILwLMVHu1JqXG4rz6T/pG1SZEH8KC1KtU0YhK4zRbnO+gHmqB3NNBCIq3C8tUeiGGdhywovZ8+h3edZmTyY= x-ms-office365-filtering-correlation-id: dab4e692-9b1e-4ce4-59e4-08d664be7dba x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4033; x-ms-traffictypediagnostic: AM0PR08MB4033: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4033; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4033; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(136003)(376002)(39850400004)(189003)(199004)(575784001)(14454004)(6436002)(5660300001)(66066001)(52116002)(102836004)(2906002)(54906003)(99286004)(6116002)(316002)(107886003)(6486002)(76176011)(4326008)(6512007)(3846002)(1076003)(478600001)(53936002)(7736002)(68736007)(5640700003)(25786009)(11346002)(26005)(486006)(44832011)(186003)(2351001)(2501003)(305945005)(8936002)(105586002)(476003)(81166006)(97736004)(6916009)(106356001)(71190400001)(81156014)(8676002)(71200400001)(386003)(6506007)(86362001)(256004)(446003)(2616005)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4033; 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: yA3mFMFlr8TJYpEM19UT6C1MNMSWzOMWsn1JATnjMsQUTsnerqa1FGdqwTQeieUK7HP6swqj8l5pwulgXwnQAYxlHeu6WGYV5f0eMp7cxRxsRM0sj/Oi+4AYVmcf7twF6HbJqUI1ITUviASJsrjP5OoCacRaZdsFig8TpQ0VE14wuYn/7DtdD0UYKqFtl78LvF8y+IXeFdQ6H2bO7Q/iInTYKhsJQY/GtOFZpAPyvDVNPC0cJkd2zHiRgZxQsw7y4VGSgLIcj9ZyR6kNNfItG/12Cnu3yFijCs75dtXv8/dMiC6vN1AlG/gSxzUDZJR2 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dab4e692-9b1e-4ce4-59e4-08d664be7dba X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:43.8869 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4033 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::705 Subject: [Qemu-devel] [PATCH v11 08/10] 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 be52c9be9c..eebcacac98 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1532,7 +1532,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 Tue Dec 18 07:57:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015124 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="UEzZKNcu"; 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 43JrD442n7z9sC7 for ; Tue, 18 Dec 2018 19:05:08 +1100 (AEDT) Received: from localhost ([::1]:52393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZANC-0003jU-9M for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:05:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGF-0006Wc-Bz for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAGC-0003lL-8F for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:51 -0500 Received: from mail-am5eur02on0700.outbound.protection.outlook.com ([2a01:111:f400:fe07::700]:56086 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 1gZAGB-0003kG-Qf; Tue, 18 Dec 2018 02:57:48 -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=bbSZF04cAcNCS/p/EwDshQ27r24O9A1/6DbWlzJPZ3A=; b=UEzZKNcuLL8coWhZ91cGpmWBWyVMFThpkbSjvkOBqMQTPlub6SpeFePFXMN1ziAj6Zq9q3SErHZ2To029P4R0Fipc62BLZEVcgveMyR2yYgErtPiOGTsBu3bFhk84CyDgbco7+UvaKQeDehOw34x/wtQ5RK6HcGHzuZOLWW31zY= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4033.eurprd08.prod.outlook.com (20.178.119.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:45 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:45 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 09/10] qcow2: skip writing zero buffers to empty COW areas Thread-Index: AQHUlqdcC+cG8AXL2ESg1DcXJDCTRA== Date: Tue, 18 Dec 2018 07:57:45 +0000 Message-ID: <20181218075707.12006-10-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4033; 20:0zjbnNItDlHFJwhAF7rpgrzRoCGlfuq9AWM88S1Bf8OF1HNKBjr+3CQHC3h7M+QLZQV547KRN2EqoM/XA6xPddr03IRytiDQk6Sii5x7A6mBo+xndh48ptGwWtxaz+G4saxnqhh8cr9/mx46nmJMh3Bnx5kKRDg0w0lo2FTWnJg= x-ms-office365-filtering-correlation-id: 50d46088-9613-4dca-884e-08d664be7ecc x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4033; x-ms-traffictypediagnostic: AM0PR08MB4033: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4033; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4033; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(136003)(376002)(39850400004)(189003)(199004)(14454004)(6436002)(5660300001)(66066001)(52116002)(102836004)(2906002)(54906003)(99286004)(6116002)(316002)(107886003)(6486002)(76176011)(4326008)(6512007)(3846002)(1076003)(478600001)(53936002)(7736002)(68736007)(5640700003)(25786009)(11346002)(26005)(14444005)(486006)(44832011)(186003)(2351001)(2501003)(305945005)(8936002)(105586002)(476003)(81166006)(97736004)(6916009)(106356001)(71190400001)(81156014)(8676002)(71200400001)(386003)(6506007)(86362001)(256004)(446003)(2616005)(36756003)(21314003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4033; 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: X8qeiBY2XGVja9/8uCGmgv4PDh14y0TfWmm2rO+a1Xy278cJWGd+ZU2NNJdnWEx1AdEePXSJY9LMBPt54O6PCFeoPNQBiKTmDLJ45Msl7JsQlUcw0o0jJ6A1Bb9+09doh75ofVevsL2Qkn6YXPj2QCZI50mJTF6lsrkLNkFy2kFUP0Dy8J/Xj64yJKM0pVu4Ecrnwj+KVSGmDjG7lF7m/E5CjP3drs/saPLJ3FSsnLmZSD8r4SXeWyXqu2nwf94GPOJ+HQiNO5lsk4KljBLaUvYOGHLJz9t+BT1pdQXjHfhLXMAuifFjcjq3BqvFwPHY spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50d46088-9613-4dca-884e-08d664be7ecc X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:45.6994 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4033 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::700 Subject: [Qemu-devel] [PATCH v11 09/10] 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: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 4 +- block/qcow2.h | 6 +++ block/qcow2-cluster.c | 2 +- block/qcow2.c | 89 +++++++++++++++++++++++++++++++++++++- block/trace-events | 1 + tests/qemu-iotests/060 | 7 ++- tests/qemu-iotests/060.out | 5 ++- 7 files changed, 108 insertions(+), 6 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 762000f31f..204528b3f6 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3009,6 +3009,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', @@ -3027,7 +3029,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 a98d24500b..32d2c04bfa 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -386,6 +386,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 e2737429f5..23e0702027 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 4897abae5e..161b935962 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2021,6 +2021,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) { @@ -2046,6 +2051,77 @@ 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; + } + + /* + * Conventional place for qcow2_pre_write_overlap_check() but in this + * case it is already done for these clusters + */ + + 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) @@ -2126,24 +2202,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..163fb075ea 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -150,10 +150,15 @@ $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 0k 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 +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 diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index d67c6234a4..1d582d4b36 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 0 +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 Tue Dec 18 07:57:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015116 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="LmgEd9CX"; 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 43Jr9q60R0z9rxp for ; Tue, 18 Dec 2018 19:03:11 +1100 (AEDT) Received: from localhost ([::1]:52383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZALN-0002ID-DR for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 03:03:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGH-0006ZA-JN for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAGE-0003mi-Bo for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:53 -0500 Received: from mail-am5eur02on0706.outbound.protection.outlook.com ([2a01:111:f400:fe07::706]:42592 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 1gZAGD-0003ly-Vw; Tue, 18 Dec 2018 02:57:50 -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=LmgEd9CXLFEGZgMZRJuy1PqUyw6WDSuFTFLousG/P0X/UuXajKsNaYJ32j16vD3H8lQt5eynz4g2r2BBPL8YFxxYLS5ap813Gq5pKBDGtbvPDXdDnLbiTfRrK5oy9x27b46IjsXDJ2g1OdsENb7qxU5wZahwUAAzkTn9RnQ6YIA= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4033.eurprd08.prod.outlook.com (20.178.119.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:48 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:48 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 10/10] iotest 134: test cluster-misaligned encrypted write Thread-Index: AQHUlqdeR7AMLYK31EugEGRz/j0x3Q== Date: Tue, 18 Dec 2018 07:57:48 +0000 Message-ID: <20181218075707.12006-11-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4033; 20:sIz7fZgFa1bEGFgCGRV1gG+8phexWcoqA7kJ/KvfhD5/s4GP88oqKq221JstXwWbBbVWhFpfpdTrc/LymKYu3XkWYEMJ1Z9beyQTmIA/tTmqrH8Bz9BcaD3MioToAociX0zBy0LR579YQhZQk/k7E/kCLGLaInMv1NmhDe+qHWw= x-ms-office365-filtering-correlation-id: 4ccea9e1-6b61-417a-75cb-08d664be805f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4033; x-ms-traffictypediagnostic: AM0PR08MB4033: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4033; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4033; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(136003)(376002)(39850400004)(189003)(199004)(14454004)(6436002)(5660300001)(66066001)(52116002)(102836004)(2906002)(54906003)(99286004)(6116002)(316002)(107886003)(6486002)(76176011)(4326008)(6512007)(3846002)(1076003)(478600001)(53936002)(7736002)(68736007)(5640700003)(25786009)(11346002)(26005)(14444005)(486006)(44832011)(186003)(2351001)(2501003)(305945005)(8936002)(105586002)(476003)(81166006)(97736004)(6916009)(106356001)(71190400001)(81156014)(8676002)(71200400001)(386003)(6506007)(86362001)(256004)(446003)(2616005)(36756003)(21314003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4033; 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: 1Yz+TN2oSMr6PbehRSAm76uKMdjn9bXqyWYLA5VNNgPV/wu//epXnwcFKHhK/ucl+m8c33Zmvy6oKlPuUKCwB5K1iThau1JpA2SA2T5qfrGeCAq6c+JtHXVhgTlj4m5c9p0rUtLGEctl4JCqQUAyiKPGwiZlJvjKw8GRxbDSqE1xrjlNUw9Sli9fG4beS/8rQReGNwFh4WisM/k9zmmitEjUbIru4K56/qHM/mss4/BKkShx2Qy6M7ATUZSyRqYLNlW24mCMNcdXpdpHJWQ3ZhTRum41L0MA2h22Pna3nk7eiXW5T7sGCgL95JvQdYhO spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ccea9e1-6b61-417a-75cb-08d664be805f X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:48.1994 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4033 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::706 Subject: [Qemu-devel] [PATCH v11 10/10] 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)