From patchwork Mon Jan 14 11:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 100556C2 for ; Mon, 14 Jan 2019 11:21:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0175328AF6 for ; Mon, 14 Jan 2019 11:21:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3C9928B7F; Mon, 14 Jan 2019 11:21:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B7F828B83 for ; Mon, 14 Jan 2019 11:21:10 +0000 (UTC) Received: from localhost ([127.0.0.1]:49313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Ik-0002UT-Qw for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:21:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gc-0000W3-QF for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0GZ-00019g-RM for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:54 -0500 Received: from mail-am5eur02on0707.outbound.protection.outlook.com ([2a01:111:f400:fe07::707]:30621 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 1gj0GZ-0000Wf-9N; Mon, 14 Jan 2019 06:18:51 -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=BTwew+tpnIJT875hqsQc3D2ZZHkxS9GE2m9B/hbgqzw=; b=MshcWBmUHuL1mnVhAo9rIpsUeI5K1ws8p4ref8ksu2K/Njvv0hvagXOdcbXwbgqTp/ZDWjoiw7DPNpnNvJcuMMwxhBp6bqYN1+5QDMJ6jBxxS47J5VmngQykgmchdAdw1YbLJSx6tSUn3YI7Jbgjcn70dzLASMuLBoCGOllQnug= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:23 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:23 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 01/10] mirror: inherit supported write/zero flags Thread-Index: AQHUq/rcpoByAgczjUS++QuUBnjmgw== Date: Mon, 14 Jan 2019 11:18:23 +0000 Message-ID: <20190114111744.113188-2-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:5Io/Ajuq7XAKZhf/iQ2GfcfNT8xxjAgaWK7OCYJeGr13KcaN0C4GMdTS/vnf39dbr4bhpLGGrM2AcDesA+KVtrR5DnBoj/AKmJPVmigzdCDoM91ek0guKm3penxUWExG7omERoXA5/NNoXbtYzKAzCWE/7fAFKZv7DuEFs7h9oo= x-ms-office365-filtering-correlation-id: fdc45586-520d-4958-c5f9-08d67a11fed8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(575784001)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NpCmB7twqGA5sLf7ZCQY7qr1AXcqyGcdXhkJAATEKjFNb2JLEBf7pdKuhOJqM7DzOHvZQmRFl1Ib/3j7pvxpo20SyJu7ccy6ekbeU7Q5gXhNG4uuAHNzhgJGxg44S2sOqsC/lEwpNNe0erMIiR4HTXSoY1NcmEIWA4fusNXlvywpq1IDQ8FjMploY1pRl6FnxSvyvY3RN+msfOGovN4lQWg2jL+zJPWVTM++1+SS22BD53YoqoBl+xbfg4IxRmScRJBGQZ5Rhh2pnSuwpD89QMSvPK4pc5pQ7VmHE34CmLoRj3o1sBwhEuD/FXJe286ixvnc28pA0cN+i2cnm+zw3Ykx2q/51PI6R0qWGsekSuVwQ87ntJW78RrqveLd7f3cJYoS1py9zXtsnCAIZnTKeqNV+n8i/I1nh7/R9tst+6c= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdc45586-520d-4958-c5f9-08d67a11fed8 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:22.2291 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::707 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 f0b211a9c8..7b5a5f13a2 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 Mon Jan 14 11:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D0486C2 for ; Mon, 14 Jan 2019 11:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F68228AF9 for ; Mon, 14 Jan 2019 11:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DBAA28AF3; Mon, 14 Jan 2019 11:21:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4FDA28AF9 for ; Mon, 14 Jan 2019 11:21:25 +0000 (UTC) Received: from localhost ([127.0.0.1]:49374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0J2-0002hS-SX for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:21:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gb-0000UI-0e for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0GZ-00018R-BS for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:52 -0500 Received: from mail-eopbgr130115.outbound.protection.outlook.com ([40.107.13.115]:51232 helo=EUR01-HE1-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 1gj0GZ-0000hM-0u; Mon, 14 Jan 2019 06:18:51 -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=Le9P5lJUOGhlnkqXxLbXCyN0dOM9uXVzRs0yIculyiWpDEAJeyz/HMh1hZR/idTVQ9i53iM4ujif20gMJenf4pbkt48DYvyhGkOGL4zeLHsrwxAE5tx3MazDLKb3n2X8gk1JC7ZDmH2yHeB4LwRDJAfhSPmu2zSjDSUYeWHhk+I= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:24 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:24 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 02/10] blkverify: set supported write/zero flags Thread-Index: AQHUq/rdeM65fZr9/EyCC9c0efNEHQ== Date: Mon, 14 Jan 2019 11:18:23 +0000 Message-ID: <20190114111744.113188-3-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:UkORla6qyWaGefYV9zZYXFpqcn/fE46Y+nB+nP2POWW9QiuIE8SR/TCBNqTERg7D10xFQhfnmre497S7lHkd17YdblLPfw2w+3f1fjPds34sFw9RnwdlUJfZnGW3h7eEsLjIMwZHTjEXC69yOQhReqxuUEgPrZQvilp8wx5IFOU= x-ms-office365-filtering-correlation-id: 33107b47-dd2a-4196-8f2f-08d67a11ff65 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(4744005)(6486002)(6916009)(8936002)(1076003)(36756003)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: LXrKYOow1mczw+Ziph/aFI0PdRWzPb1Z7WitRNMOa+nhEI6mGv76jfl/zLtMZ2eWa8N5wj0bHYfxtF7oku/pKdM0HyTMqyD9KnLBJuI6SLCEgyR+lEi8b3LmKsC7O4YOkQXZMzh5lLgGEtmXUdNQOw5RHa47BwwsfrQ8wediMlWQ4N9N/KWGXo+rLSEGc6b6CMSfehOXA4xtpGAsl5t0p9yHXfmU64CdF/P+3xJrQFZrFcrenGOKw1zl2Nf3yJ32P8unisvr2C6a7KjMhzzveyrYoqd+cFhNW0Uilty9oXk/HCan8NK5Hh7UcYbOGbO0SSaIgK9mDYXnA2NnWv2tcVo8YR/5sxK4QJdvcugmEIILTf0gbwxxj9kqwkA0xGj1f7IHAuKd8G9L1NkpaOX4qzUqS9kP1Cbv4n7mHJES1bE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33107b47-dd2a-4196-8f2f-08d67a11ff65 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:23.1538 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.13.115 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/blkverify.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/block/blkverify.c b/block/blkverify.c index 89bf4386e3..bb52596cbb 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -141,8 +141,14 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED; - bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED; + bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | + (BDRV_REQ_FUA & + bs->file->bs->supported_write_flags & + s->test_file->bs->supported_write_flags); + bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & + bs->file->bs->supported_zero_flags & + s->test_file->bs->supported_zero_flags); ret = 0; fail: From patchwork Mon Jan 14 11:18:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E91B8139A for ; Mon, 14 Jan 2019 11:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D99A528A89 for ; Mon, 14 Jan 2019 11:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD8FA28A8F; Mon, 14 Jan 2019 11:34:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 646F428A8C for ; Mon, 14 Jan 2019 11:34:50 +0000 (UTC) Received: from localhost ([127.0.0.1]:52158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0W1-00044v-M8 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:34:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gd-0000WI-SF for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0Ga-0001AB-1q for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:54 -0500 Received: from mail-eopbgr130115.outbound.protection.outlook.com ([40.107.13.115]:51232 helo=EUR01-HE1-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 1gj0GZ-0000hM-Kq; Mon, 14 Jan 2019 06:18:51 -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=btrmy8eodon36snO4G1dBlfXDHzNLc0hKsVdve+uyUcZeXb+uaceXzW4k9B1crw+PChUMdGN+19ML/g1lq6Euk2eMt0j4XDc7T3EQIrfi9NI54epSw6cp6AOYVFNI6m8aKyrFsyDD0K+Mr0Ik9eI2j/loFTbZmZvff1IRJTHZpw= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:25 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:25 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 03/10] quorum: set supported write flags Thread-Index: AQHUq/rd0rh6oRoMJE6q4dQWY0WCkw== Date: Mon, 14 Jan 2019 11:18:25 +0000 Message-ID: <20190114111744.113188-4-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:ZhCCR9XpeNaz1atlzDxG56VedbwN3ECI7tMhhmRNhP9CyYoCy7D0tA9G0s4zNHQE0z+rvMEqmYVcVy4Fh4B66bNOK2KM5ouznq8jW2mwC3lV1XVSqI5F3i7ZfMgB61YQ9Qw0pl+8Zups51du+qhsca6ZA3yP4Q/0eQGtwiahSGQ= x-ms-office365-filtering-correlation-id: 9bde85f5-16df-43bb-29a9-08d67a11fff6 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(14444005)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vTjnZO3gPoyXY1XGV4JeS8ExTaNZRScFjcVe0W6PU1TQ9C+UB6hvLbKKdlDOPZMOtuKqf8rNnvnjyhMOp5Zexb5QMy4YgzN6GFdFuP0bYSNdMif2nACDdIF09ZH3HD5WLKf84qYyDuxQUtZrse89PCgcimmPEmclNxgHnRguaCFQDPNDHlS7msVeMQ6AYs7v0e7qXWOM5sxcu0REjfVHgUULCHpcZ4zoEEa5Gg8+TOTubBzCHOCOKuQkPiMY7r2jgGjY4s95xQJaKAdzz5oIgfXuFX9urnuPKH6Vfe/Q3j0sEacBaJM/lnVqwZjfo4LZWr/JsJPiBFJz52I5D/61RPVeo4ZC6MX4AjomSVcrAdtgtdS/PJrIcWLydvCNKFSeEs1kkfM2K4Y972FwEKv+1j1RlpUj1pTW9CoaSwRF320= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bde85f5-16df-43bb-29a9-08d67a11fff6 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:24.0954 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.13.115 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/quorum.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/block/quorum.c b/block/quorum.c index 16b3c8067c..d21a6a3b8e 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -857,6 +857,19 @@ static QemuOptsList quorum_runtime_opts = { }, }; +static void quorum_set_supported_flags(BlockDriverState *bs) +{ + BDRVQuorumState *s = bs->opaque; + int i; + + bs->supported_write_flags = BDRV_REQ_FUA; + for (i = 0; i < s->num_children; i++) { + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; + } + + bs->supported_write_flags |= BDRV_REQ_WRITE_UNCHANGED; +} + static int quorum_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -950,7 +963,7 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags, } s->next_child_index = s->num_children; - bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED; + quorum_set_supported_flags(bs); g_free(opened); goto exit; @@ -1025,6 +1038,8 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, s->children = g_renew(BdrvChild *, s->children, s->num_children + 1); s->children[s->num_children++] = child; + quorum_set_supported_flags(bs); + out: bdrv_drained_end(bs); } @@ -1063,6 +1078,8 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, bdrv_unref_child(bs, child); bdrv_drained_end(bs); + + quorum_set_supported_flags(bs); } static void quorum_refresh_filename(BlockDriverState *bs, QDict *options) From patchwork Mon Jan 14 11:18:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B672B6C2 for ; Mon, 14 Jan 2019 11:24:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A73CD286A9 for ; Mon, 14 Jan 2019 11:24:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AE3B28821; Mon, 14 Jan 2019 11:24:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1EC72286A9 for ; Mon, 14 Jan 2019 11:24:46 +0000 (UTC) Received: from localhost ([127.0.0.1]:50061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0MH-0005LI-AB for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:24:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gc-0000Vl-FL for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0Ga-0001BI-QB for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:54 -0500 Received: from mail-am5eur02on0707.outbound.protection.outlook.com ([2a01:111:f400:fe07::707]:30621 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 1gj0Ga-0000Wf-AK; Mon, 14 Jan 2019 06:18:52 -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=Jk4Ou71Ecg5NH8Uoivhsp51jEo5uchjOikj365cBYPo=; b=MBPCzYkOAxwU+167Uc+WGy5SA7az7dGPgkUfU/jUI2X5k+wpclEW0dmdNc9P7UVSAfEbiyauoXpyrZPtRvDC55K9jlTpkx7bNB9gqY59WGEH5Hb07OuPAXea77uf98/NtqH3EUbQiGb1UMnQ452pAlzy43sHZs3fop0N/cROSiY= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:26 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:26 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 04/10] block: introduce BDRV_REQ_ALLOCATE flag Thread-Index: AQHUq/reTrm4r3g2pk6/zDL/tMY6ew== Date: Mon, 14 Jan 2019 11:18:26 +0000 Message-ID: <20190114111744.113188-5-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:QGagsOTlpYAirrEwqDBfHG9bM1yo2QS5+2dNejbFCpqFjl0ZU5XFGdo6tGvq/dS+4wek9vpow853qfOyYCjDmt5JsfNl9fJey6P0IN5RBBBCQKnqNAZggCbqPBjdzKimtajRb8TlbDNSwk2H+mu67VoOWXjsnEB05A7djQ4+7Ho= x-ms-office365-filtering-correlation-id: ddd14434-80cc-47a7-8869-08d67a12009b x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 5+Kx+zg6jNP3vTUswnHtqFcMcQyDHa/rwnK9Es3ImXTbFOp5JRx1AkKk3Ec3NT0ltIahtknbTF4B5WPfRThwfIGIFY4iW0in8PhSaeO+GYKgZPwFxiamMAB/mc56qUqSGesxXQNDMPWI924To2W9Kp8w13HcLhZqlUfSup5gAKwk0mYH0NoC6zn5RidltETqIfeRtHXgF7UDaybNXyzJoi6CJMb9LIQgJwi8r5f8g8axnnHSomfjzomNs5BdAXDqMOucPRdnHa+NY17UKLMgQ3Z2H248IcHToEwET7iKyPQerj+QDXQ918Ym76OKeQTdoONQNBJCOU9Gt1UXIPWVtRhGrt49+GWMzQ1S41W0jMhN4Fxj6Z7hDWASiTHtvn7TvZIQAAPCNCU8BmLzT9EtXMQTUqs6xMOfexibp6E2MbY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddd14434-80cc-47a7-8869-08d67a12009b X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:25.1852 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::707 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Mon Jan 14 11:18:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F25106C2 for ; Mon, 14 Jan 2019 11:36:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E31F528AF6 for ; Mon, 14 Jan 2019 11:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D621E28AF9; Mon, 14 Jan 2019 11:36:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51F9228AF6 for ; Mon, 14 Jan 2019 11:36:58 +0000 (UTC) Received: from localhost ([127.0.0.1]:52635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Y5-0005UX-M2 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:36:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Ge-0000YL-Cl for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0Ga-0001Ax-MV for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:56 -0500 Received: from mail-eopbgr130115.outbound.protection.outlook.com ([40.107.13.115]:51232 helo=EUR01-HE1-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 1gj0Ga-0000hM-9z; Mon, 14 Jan 2019 06:18:52 -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=2bCGZ9xGLiD0pNHQzxmoAv2T0u6SzbPGG+D9e6xTg6s=; b=LkgqBRQw+j97P2LQk0/7WPl7dj+h0AFQ/YDy42noQxiB1ivAIlpXTt/AyMd77HhDf5X2rieu2t/hU6wqN2XQVkywsAiDw+NxacEW9ktzEpSieuPlCHnVvXT9E5XqWhEZBtVwXZQPzKOjWjyjsGgZA4bmxm06NVz7XcmtFkB2kZo= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:27 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:27 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 05/10] block: treat BDRV_REQ_ALLOCATE as serialising Thread-Index: AQHUq/remiGYJv1umUyq9TYoy9IB/g== Date: Mon, 14 Jan 2019 11:18:26 +0000 Message-ID: <20190114111744.113188-6-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:CPPU2JppnCAPVLZoX8uWoDTQbHKJaLrq/PYxJp7y7KaWbUK5PjAI8sxNo+xjR8R3TjYvJA42x+s10rgjDotidAOEyIbRc2CEa1aczlr+mA5GLXnJP9hxR1/XHW9SrB5oL45YG5NKBLnwOKvxS/8pvHtv/Vw9TKEshBpk5Uo9IGM= x-ms-office365-filtering-correlation-id: e03ed20e-f717-45d4-6715-08d67a120127 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(14444005)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(575784001)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: EoO7tTv/YbAWP6AOYvwjPEGuTigKaoNlN15tH2/6SCURr47XZqzXWR6+GkaEdxip/j82i+CaPvCk/8MkM+7ikg+PCAv1/Z1/eGwJBV3SRoYMHU984jlKc802/6s49L9WZMMVp5neIvJ4pFlE9dkdHauwC3M3fdJh7YQOa8Uja8sxiAvekQR1QrT9x44wwICmFvwiM4a5x9+iIxQ52QX8xbeyEFFQ0Dn/BxqtAzNyn4mvwUEgNjKvfMMRUDr8Jh4LKe3nj6n1V/W5UxEnrFuvKg9cWsFrJOBoEIHe6DqkpoLPPgVRrnEBjD4Go6XVvef/Ab8XUwkkYsdK3DsJAEWM2MAoer+cih1klQlC1Rwbs4RMSf3dhFcjIBtiIUVwXJKnZA9DKXruBTHEXazRZ6TuTERs60y4SsxXm3pqKvU+V0o= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e03ed20e-f717-45d4-6715-08d67a120127 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:26.1029 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.13.115 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Mon Jan 14 11:18:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5439F6C2 for ; Mon, 14 Jan 2019 11:28:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42594286BD for ; Mon, 14 Jan 2019 11:28:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3385A28AE7; Mon, 14 Jan 2019 11:28:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8B7B286BD for ; Mon, 14 Jan 2019 11:28:13 +0000 (UTC) Received: from localhost ([127.0.0.1]:50867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Pd-00086l-0m for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:28:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gd-0000Wo-Ct for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0Gb-0001C3-9n for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:55 -0500 Received: from mail-eopbgr130115.outbound.protection.outlook.com ([40.107.13.115]:51232 helo=EUR01-HE1-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 1gj0Ga-0000hM-UX; Mon, 14 Jan 2019 06:18:53 -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=JZNL714D1rhrTDqCEe2oN5lm/1lzo9U73jcM/egEWyQ=; b=KPeB65UtsvFjnX2UYRsf/SvmvZOkaOpuheN3K/RGcd9qurheqUCUVDkaRa+QKVvP+rh0HG4dacHJ1oisQgnF99JFlUZyBiSZcLEfwZq491p0ErBYs4q+iobTGOgZKTLavvO43E3TVU8OJmGBPV4Ytwus6g7m98qw+LA4kvXpoSo= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:28 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:28 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 06/10] file-posix: reset fallocate-related flags without CONFIG_FALLOCATE* Thread-Index: AQHUq/rfUbi3weDVF06LqrbHeWpRyg== Date: Mon, 14 Jan 2019 11:18:27 +0000 Message-ID: <20190114111744.113188-7-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:xr7IePCzo8cHxS/Ow3mnA0Etp6M9+Ms4NcgPq23BGAv9xeC/8fHxc4hlnHzVdDb/+F2RYsHBQ1cH0Ju3MiAbYcnt8OvH02nSKsh6bzdc53ZJ5YhaP8U6RWHTOSLMfER9c3T5iHwdPZij497WYLXB8nr6ASF1A7qvAu51es3Oa1g= x-ms-office365-filtering-correlation-id: b3bc97e2-c687-466a-6cd5-08d67a1201b3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: PDDZyWRz2GiO/rWqHp+CtWQhKkp+rvROnqAeh5TqT/QySBCWsZbosBPNrne7J+Z2Lcw7p05QmHA8WQqHHwwYwWnFdSMs7BjKIn/29rCXVNoXzSaS2HPfuKxadGCOsjNvMJrG6cJQ/AWsLax24m3dmS38r973QOYnzrjeLezw4QSJiR2qBUFS935TeSnogGygsbNgYY1ykw0F1I1sgSGBh1OV1rYdtxT+Y9YHWl4iAAuXPydwaskG+kG7bXQqKNK2Z58Be2YU6sTHBZS3QKORspEklykCww7rDauILAVLdr8Aoqi6rWXXIf65rxc4sCKVGRsu5FSrNIbnn8s/Oe0zdEfQxNHb8YasvrUXDpghnWmXTCOgn6PUcuHQ2XM/lRW0Po/yovx9/VDXild03T/sMU+YkniEACeKk/Zwg0MMN3I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3bc97e2-c687-466a-6cd5-08d67a1201b3 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:27.0215 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.13.115 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP these flags currently affect nothing without CONFIG_FALLOCATE*, so it's not a bug, but fixing it makes possible to adjust supported zero flag BDRV_REQ_ALLOCATE regardless of configuration. 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 8aee7a3fb8..8d3ec96627 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 Mon Jan 14 11:18:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00AEF6C2 for ; Mon, 14 Jan 2019 11:31:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E589521BED for ; Mon, 14 Jan 2019 11:31:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9CF628AE7; Mon, 14 Jan 2019 11:31:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 76C0B21BED for ; Mon, 14 Jan 2019 11:31:39 +0000 (UTC) Received: from localhost ([127.0.0.1]:51554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Sw-0002NN-Py for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:31:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Ge-0000YO-Dp for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0Gc-0001De-6t for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:56 -0500 Received: from mail-am5eur02on0707.outbound.protection.outlook.com ([2a01:111:f400:fe07::707]:30621 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 1gj0Gb-0000Wf-OS; Mon, 14 Jan 2019 06:18:54 -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=7p8pdI2KEKYRCA2jeG9oV87BBVLdB2kAo651XMes8II=; b=OW69FyTQ2CNsmMuwV46gjKM2DJK71V+k1lWUTNkLEotPyUM/oyqijgGxhQnHExrmQkJ6p1t3WsZxUC+cjAaTR5tXlZJmipfxwaAXJ0H1aZiiN4QNeO9UQ3pQJHAxbq2yL1G4xwJX48ujFXu99qx5sFB3QYnbVCUceK/o9xcLWF0= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:29 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:29 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 07/10] file-posix: support BDRV_REQ_ALLOCATE Thread-Index: AQHUq/rg1oTKza7EwE2/Ze3fJmSAXg== Date: Mon, 14 Jan 2019 11:18:28 +0000 Message-ID: <20190114111744.113188-8-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:Ydwyj4EAmmW1RslFM3oSWyzyFf9NYfWy6HudOQs7j7XWwU55w1QdZV/npASE9ogsG8iR8w80xJz00slL8aC9BehBnb1Vs9nyxmTf28yV5e1UURGBS04EX5cUhM9OpZqnMHAfhqGWHRE0ewxkoXyjKmBKRHzzuMRRWuUput+DTts= x-ms-office365-filtering-correlation-id: cdc4281a-8e0f-440a-43f2-08d67a120257 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(14444005)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: fIQ0RUsSChaEdpVm3ewsVoFfwUzTfjq/qgTbgJNc1w/Va3h+r0GjRgcLzwbg20WsTf3/syUHbJk0lBWlHqk+ORF/R9GGYlReYbA24VidZ79pYCjNExud8wh9b9CLdpKPiITc2xdDkx/KVq+a0EUYsn2YZMXEnY3VK/lGK6buciiso0yHRIoudC69OvOAuOfFRAyedmCjMIVkq53i0fC1zImfqdFp1Oyn+DPQ8EtnNfnwlhs7qUGnCqVEJbGGOHgvtDJFIOVnuB00tEa7WomqbPTCETu4SEddDIZ6e0zNg/FvbfiayT3/Tve7dRjcggHE5fAenIoNUcVKtzuRCrfnT0qhuAULU+hlsMCsewGR6PfuKBl9dfdYEWSVUQFomb6T6tc7a4tt1Z3EftAAMR9DvyQWb44SWH2u3/2lmU1q5pk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cdc4281a-8e0f-440a-43f2-08d67a120257 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:28.0963 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::707 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 8d3ec96627..dac218ec7f 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 Mon Jan 14 11:18:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D9DE6C2 for ; Mon, 14 Jan 2019 11:25:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD202286BD for ; Mon, 14 Jan 2019 11:25:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC2CD289B1; Mon, 14 Jan 2019 11:25:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FF4F286BD for ; Mon, 14 Jan 2019 11:25:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:50131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Mc-0005bw-AL for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:25:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gf-0000ZO-Af for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0Gb-0001DD-Vb for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:57 -0500 Received: from mail-eopbgr130115.outbound.protection.outlook.com ([40.107.13.115]:51232 helo=EUR01-HE1-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 1gj0Gb-0000hM-LM; Mon, 14 Jan 2019 06:18:53 -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=5zA7BGCxx0SCWPCgXPesNTYExHXO4H8wDamckSODIOo=; b=QhYmnSfPTm5s0ZVxousYS3OUEBRnlBRgN9KNdH6syNF5KCErNMe+kLyU4tzxuNA68Ay5cOwDvzHybHv6WC3OiWtODmfE4kiNhdplLBMGuleM6jtzNkV2ggvFUp6UiCbfYxQ5BWgYfFFoLla+UntRcmmsjcL5NWLFdsFR6WhTHuc= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB2977.eurprd08.prod.outlook.com (52.134.92.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Mon, 14 Jan 2019 11:18:29 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:29 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 08/10] block: support BDRV_REQ_ALLOCATE in passthrough drivers Thread-Index: AQHUq/rgEPz/gC1bCE+GczvhLb6DGw== Date: Mon, 14 Jan 2019 11:18:29 +0000 Message-ID: <20190114111744.113188-9-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB2977; 20:d7HnD8Lap8OHTh3SBI3jJ5W0hRrcEqREcr7bC1nq0RXwShX8IPMppJAYoVorLEMUuC5DTEMHjQar86WpscvkpJFbYQWJX4fXdZtyuEQFOT9aIfBqdyN7YB3kNdq2nSdCtNeIlf9KLnLP1OYuWTq6ZN9bKQEOgzd2UDjOU6vyZSA= x-ms-office365-filtering-correlation-id: 301fd29d-3acd-437a-8b56-08d67a1202e9 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2977; x-ms-traffictypediagnostic: AM0PR08MB2977: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(396003)(136003)(366004)(346002)(376002)(199004)(189003)(6346003)(256004)(14454004)(5640700003)(6486002)(6916009)(8936002)(1076003)(36756003)(97736004)(53936002)(305945005)(476003)(107886003)(478600001)(186003)(2906002)(486006)(6116002)(50226002)(3846002)(26005)(2501003)(2616005)(99286004)(8676002)(11346002)(66066001)(4326008)(5660300001)(52116002)(71200400001)(81156014)(25786009)(81166006)(71190400001)(76176011)(2351001)(7736002)(316002)(105586002)(106356001)(68736007)(102836004)(44832011)(6436002)(446003)(54906003)(6512007)(575784001)(86362001)(6506007)(386003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB2977; H:AM0PR08MB4292.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gdu5rk+wCCQ7GX1/g4ShidcZHBKaDH3jrSmZdcnFPLXmc2ej80V+NyWcn0Mr+GahplgY8lYSYj5+TF2r8zPSjfqx7e7weKnq8UqWoPAFHOEtxv90VghrW6E2kCUvWx0Vk4ZPoYhW5kxo8s1M1p74piii/NWQitHeDa1VzWgKKQ2irWGKjEv/7DeOKHa+FWYwNG6zPXY85sRuR0q2uZ+fktPHCt/QHdutqE/SVEjubMncoTEqBVyRAlfMZSavVgJnrSzDyj2qWvY9mQ9LW9OrKpYPd/JVIHda+LaD11pu2ehkE3QstE+cqrKPBs+hkI9m93nRys7MBgaws6/jBPQftdPr5h/EzHvLtcMPC93eiw/XnDN7A88zuN5YHZFHT0VIx7fZxE0FjD4BQBLODTtlaQNyQD5YUdd7CYwhwTWO748= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 301fd29d-3acd-437a-8b56-08d67a1202e9 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:29.0529 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2977 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.13.115 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 7b5a5f13a2..057516acb9 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 Mon Jan 14 11:18:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 060621390 for ; Mon, 14 Jan 2019 11:22:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E603127F88 for ; Mon, 14 Jan 2019 11:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E419328B82; Mon, 14 Jan 2019 11:22:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07A2227F88 for ; Mon, 14 Jan 2019 11:22:35 +0000 (UTC) Received: from localhost ([127.0.0.1]:49581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0K8-0003XC-4L for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:22:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0GW-0000QB-P0 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0GS-0000vl-G5 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:48 -0500 Received: from mail-eopbgr00091.outbound.protection.outlook.com ([40.107.0.91]:54043 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 1gj0GO-0000hU-Ew; Mon, 14 Jan 2019 06:18: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=dJ6O4rngao+owJa5lV6xYubncllC24ApEOEpHwl8j1E=; b=e/JC/ukJwBYb2bpzqnyS+qYd2jOu263aRs33kza0L9RI9t9zn25xDzJwW6Whkc4pZvxOEDHTvbK/51HWbk7ppO6fyCjkiH2oeyrLMCL+lWRDMv+FCTYUQkGVP/qU6dmT0bTMU+4XKUCzL6xBhbVCh7sK41DZgbVvZ1nwxzzmeaY= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB3203.eurprd08.prod.outlook.com (52.134.93.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.18; Mon, 14 Jan 2019 11:18:30 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:30 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 09/10] qcow2: skip writing zero buffers to empty COW areas Thread-Index: AQHUq/rhhNTJ3rW/cEWwBsqX41ZyXA== Date: Mon, 14 Jan 2019 11:18:30 +0000 Message-ID: <20190114111744.113188-10-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3203; 20:LeR3Akk+JU5wgrLVsZf7KFNiwzRZMBbR0KLqvEpN8hPWmBG/ACR+pfSWfE2rc6cDc6vLFZZA1G0YdX1KpaqcuyK2z8cO01A049cxU0nP+i4D8blc/GSkA8ezvfqY1fYgoz2DoXxWeIM/0KhP/7XZSmKre4cikCp1MBEXe5t7uXM= x-ms-office365-filtering-correlation-id: 2e39e6ae-a60b-4ac8-fe8a-08d67a12036e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3203; x-ms-traffictypediagnostic: AM0PR08MB3203: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(346002)(39840400004)(376002)(366004)(396003)(189003)(199004)(36756003)(86362001)(107886003)(4326008)(478600001)(6916009)(6512007)(71190400001)(53936002)(2501003)(71200400001)(99286004)(106356001)(105586002)(102836004)(2351001)(2906002)(25786009)(44832011)(81166006)(26005)(186003)(8676002)(81156014)(2616005)(3846002)(6486002)(8936002)(52116002)(6506007)(386003)(486006)(76176011)(68736007)(5660300001)(14444005)(256004)(66066001)(305945005)(1076003)(6436002)(50226002)(446003)(7736002)(14454004)(6116002)(316002)(54906003)(476003)(97736004)(5640700003)(11346002)(21314003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3203; H:AM0PR08MB4292.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: xOdG/vWa6LIVTJz4s+Ed6Z8STpWuCs0wiz650p7PVUG3JcJvaXhje+n4+TAC7TekKxlhf9K5w8Eg/7taPMbpzZbxaiBfEJZX+b01COBU2LzEgjXtGQLqOjW76PJ0SJX36dbSfUOr4ZO6CIZ6BY2TWAyUbwMmGOw2zJw/fI8qnL9a4KLcbs9SusLD8qYNHgmi2VH2ExlLeN0S+0CH8kAsitEI/eKGHaSuNa6yEH9WIgblUZdROvztk7uf4bIO5iQlR5m0zANqtQL5Jrk1hNOD4xLGvs2q46SLBIMlpeKECa1HUWE7FMqMsBoCnFSqVGOi0e4Ump97IIyCMjfBnZIY9x3TjNcxWna8LSzwbeCsLEofxUh2TkaXNkWR5VEoDMcBjRhmXdFRMlvnnnJkyJ+xw9bwtXZN9p+1ER3Yg3LBSos= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e39e6ae-a60b-4ac8-fe8a-08d67a12036e X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:29.9285 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3203 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.91 Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Alberto Garcia --- qapi/block-core.json | 4 +- block/qcow2.h | 6 +++ block/qcow2-cluster.c | 2 +- block/qcow2.c | 91 +++++++++++++++++++++++++++++++++++++- block/trace-events | 1 + tests/qemu-iotests/060 | 7 ++- tests/qemu-iotests/060.out | 5 ++- 7 files changed, 110 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 438a1dee9e..dad4b1c7ca 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -389,6 +389,12 @@ typedef struct QCowL2Meta */ Qcow2COWRegion cow_end; + /* + * Indicates that COW regions are already handled and do not require + * any more processing. + */ + bool skip_cow; + /** * The I/O vector with the data from the actual guest write request. * If non-NULL, this is meant to be merged together with the data diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 30eca26c47..e5f936a82c 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..05a7cbebbd 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,79 @@ 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; + } + + /* + * instead of writing zero COW buffers, + * efficiently zero out the whole clusters + */ + + ret = qcow2_pre_write_overlap_check(bs, 0, m->alloc_offset, + m->nb_clusters * s->cluster_size); + if (ret < 0) { + return ret; + } + + BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC_SPACE); + 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 +2204,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 693c14c443..4243c3469a 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 af623cfd86..afd9212c07 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 Mon Jan 14 11:18:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10762253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24D8B1390 for ; Mon, 14 Jan 2019 11:27:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14CF528AD3 for ; Mon, 14 Jan 2019 11:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0661228AE7; Mon, 14 Jan 2019 11:27:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1DA6E286BD for ; Mon, 14 Jan 2019 11:27:52 +0000 (UTC) Received: from localhost ([127.0.0.1]:50799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0PH-0007nj-TR for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Jan 2019 06:27:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj0Gd-0000XN-S5 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj0GY-000174-SI for qemu-devel@nongnu.org; Mon, 14 Jan 2019 06:18:53 -0500 Received: from mail-ve1eur03on070b.outbound.protection.outlook.com ([2a01:111:f400:fe09::70b]:6069 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 1gj0GX-0000i2-6i; Mon, 14 Jan 2019 06:18: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=LxLvyWpV+tB15iyYgwjMaBcJEv1NUh2zFw32Qu65eMW7EHh0LUmbhtJC5Pfzzm24FMEik+n9rPHOvuLwgJPLLa1M0ZfkYLSDLUor0GhAreT0aamDHIg2WciBV4V0tKXLEYgkiN2CG6qTdjOMqHvfHc/dD6YM/UZ+O2kdi2dgLeo= Received: from AM0PR08MB4292.eurprd08.prod.outlook.com (20.179.33.17) by AM0PR08MB3092.eurprd08.prod.outlook.com (52.134.93.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.18; Mon, 14 Jan 2019 11:18:31 +0000 Received: from AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916]) by AM0PR08MB4292.eurprd08.prod.outlook.com ([fe80::d13a:1305:bb54:1916%6]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 11:18:31 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v12 10/10] iotest 134: test cluster-misaligned encrypted write Thread-Index: AQHUq/rh+JsWfNJSRUScsuM7Yl0lBA== Date: Mon, 14 Jan 2019 11:18:31 +0000 Message-ID: <20190114111744.113188-11-anton.nefedov@virtuozzo.com> References: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190114111744.113188-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To AM0PR08MB4292.eurprd08.prod.outlook.com (2603:10a6:208:13b::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3092; 20:FXarOPv5GnWgjuCJvfxTEkPG+962oBXneMMw54wA5NACmM/drPleL+gSa4wz1fi5HpQIWYtDWfNt5y0o3XFekIpUVq7sxmBjJHh0mighFPiMDFkhmSH99YHwUOlNMpux8IwrcmSBkVWKHOFYGNe3+Mz7yIDVCzxX2z2on7D9xMY= x-ms-office365-filtering-correlation-id: 24eee93f-4332-4bb4-301c-08d67a120402 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3092; x-ms-traffictypediagnostic: AM0PR08MB3092: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(396003)(366004)(346002)(376002)(136003)(39840400004)(199004)(189003)(316002)(2616005)(478600001)(11346002)(6916009)(486006)(8676002)(6506007)(4326008)(14444005)(256004)(81166006)(86362001)(81156014)(386003)(3846002)(1076003)(44832011)(6116002)(68736007)(50226002)(66066001)(36756003)(54906003)(71190400001)(476003)(71200400001)(446003)(5660300001)(105586002)(2501003)(8936002)(5640700003)(53936002)(6436002)(26005)(6512007)(6486002)(305945005)(2351001)(25786009)(2906002)(186003)(102836004)(107886003)(14454004)(97736004)(7736002)(106356001)(76176011)(99286004)(52116002)(21314003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3092; H:AM0PR08MB4292.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: C83cn2geY8ImoZtlBlnq5XIJgI4oylYvBAsZMTzQCTCOE9oSDo+/RhepsefNtpS/0CVFw5/mX3Jy/xMKiKW2t/ZowFPebSl5KgJwdGiJjaUNF1Cdeh2CDDKEbqjACFgn7LcJqHmDIfFQFwsDlIzIK0BozZeME6+qU5iL0Dx+RYBbmYK9rkE12ZUw3pIBND8xOX5KDucwAFO/ZmDjjWyX9O1Hu5mZ1Ov0KjxhKZMrP2xMJVtuRM1EjP0nHoCoPpMy86zu1Q0nRHUz/k7/Ir1OQv8ujhSDJUs2XSTqpZ4uimkDimHUYE05iaXuE90w0yxTTUKLycwPYdLB1YcWQBgpI+OPyT+wxcm7pYTAnzu6NH3BZC/BxZyHo3RlrlV4KG6Xs9AwrP3HeSDFWFfj9lvwDcaum3aQdI0HZuAl7BRGzHI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24eee93f-4332-4bb4-301c-08d67a120402 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 11:18:30.8872 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3092 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe09::70b Subject: [Qemu-devel] [PATCH v12 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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)