From patchwork Fri Aug 21 14:11:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 275878 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7908C433E1 for ; Fri, 21 Aug 2020 14:13:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82C9D20FC3 for ; Fri, 21 Aug 2020 14:13:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Ux0CBAKn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82C9D20FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97np-0000RT-NI for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 10:13:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97li-00056j-7x; Fri, 21 Aug 2020 10:11:46 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97le-00053q-T2; Fri, 21 Aug 2020 10:11:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIZNTyqkcxEbWMrMFvl5Z4A2gCLSaVtPhAA6IjGSageAi12ib8Bc2h4ljgjW/oBzNT2H3Ty5NQT3Y1hE+VJWQoHfRV2evGsUNktluUE9buYkYtt3Sft1ILT7lewWm5ssxh6Ri2erezNnF1CzRJH+FhkigZbp/hNzmg8rqCjvZhSfha3KtflOXU4SnG+zwZt+900me2b4DEyPxomfdm5yL4NuKsMlMTLQdz8c2UcynncuC7ATDBdGpfIOs8iV+2KJSfk24mi82E9ZZqkVyBGHygJEQskVbRIaFNGSNucpdiqsyrQICBG/ExqtZCPtK2zefNGgIarIYkd0r9E1d35SFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T6ADkc6uYMLabKqyv9ENA7/hX8HBJxK5upg5p8B/ZEw=; b=g7/CIBOEyA9BttwBp5n4x7UAUWyza9B1d3ch6dFsBLjZWG3b2pqJTxwgtbM08snirZfJHNomB7ob1v1eYuqjiBeW7e8/qwOQJDYDU4xi0PhtgRbbiwDFwoDCAb1zbhiGeTk0kUIirCw7i7qYpWUq4wFbhmD2Hlp2eBE4tHLCcRg4sq0kMx7sb4Kb6TU6cutxvG1u9XFZuTRWhl5efob86qNukxHAx0c0xdXue7eDMd760sFzoHXG5sRSwWSlBfVvfwyFnDxJAA6d8TFjP+BWpV6IXiiFb+znp5majKkPmygLizymPijsnNeNcgknP4x5kMRcQVZAE5sgPXIPhFm86g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T6ADkc6uYMLabKqyv9ENA7/hX8HBJxK5upg5p8B/ZEw=; b=Ux0CBAKnl+zOgWyAu6DEc//n48WzJg8qckvawh/PvuRy407LB3ICz2VzqUBirHk2fJCW+AGc553nyo/1Z0zf+GkajvmlwlnBM3W9IbtNjK55LUij+PqxWuoslgfiKk6WZ9tHqno+TzxbG574YmBDmB9DFHQH0qhE5YTIy1vEmA8= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:37 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:37 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 01/10] block: simplify comment to BDRV_REQ_SERIALISING Date: Fri, 21 Aug 2020 17:11:14 +0300 Message-Id: <20200821141123.28538-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:36 +0000 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4126218f-d288-480c-c881-08d845dc1e49 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jjldiDGEnMqe+I5RF2cmcABvHBHzIRm5UVUiG9v66g93PiWruTtjVJGCY+cN0UyXiZksDH1jTOwqYFcdR5/dbg1njnm388fXXaDI4rI+44HCBA53b7jpv1bzxzGVe8B6+wZBoXwNXi5FwbsH4M/eaQ3PzBgguM3tHf4qAUGaZu9bBC3sV3o71CVv9H1krdemmfh5soEjJw5T+RPvFnoOspP+A8+ru9vG5RB66kYyHEquw/TE2DPbLu9ib4oGlBF/VwuxdAOaBKKLn07MM5qXiTIgSDcZ/VQMXKM69SeinX2+g7E9lVlwqYeyKk4jhnz9Q/IpEGqnTXokZhJ2tV5d6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: fZa0M9J0oBIQ8B44TRw9V0LUAL5UnwRXWgFd6KWVBuzdFFP0VPjCXO2RahWpPp2eknml1wB0WkumUXWtJj6VGhrJjoSAXCiO3CXYbAy0Clv6qRwPjWy2FUPVHcVDBLBUVxusxOlN37mgsM5gUaNpL7u3KOu/4GBnVa65mwlz3yi8RHo7dvrwqn4gRP4qpMzYBBog0Fq4dQ1m2grUlhKp/bqd2TN4V9TuY5oaCb8WYou1Qb00mt3e1JSO1d/lBqHdEcfYmCoiFdRMe5EZGL5JG5bgZ99I7C89KH9k6SQ+V2oryDScl0CwNhg8on5fJMimm/DXBhx/hkeifGiOa0F9/NkL7CmHuJy7zWGP4V+VrMdDzljZwQ8BJnJODJgDi5S6IpwhHXy7RM6d9+jVUmLQMnQhfCoLvqqiIjjoDEF19ivCfSvYrOOyu/oKM/78gwYsXmVGAIVJARtsc1Tx5+7ROtuxRDnLh1i+UGTrlmDSUq3G9GYSE9Agyy6fa4RI58cxuQpTlUt/uOHbYvVNJ0krc3eA638L2p/gdsZx3tev+tyZuMyV5fo/kD5R0QgPCraDFK3uuHq0Zj5A1wN8VuIbFknQZ08XncQ+pyvgsHwfhqZqbebo8vSUR2uNsL6JvgrCPXI0iJs+rNBe58ulCoL83A== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4126218f-d288-480c-c881-08d845dc1e49 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:37.7393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JUQkbaP7+fEEv8oBRTeCHrxaG3BxNCYA6g3j7nU+Xcqx7DXjgzNKiyfMcExbT0EcRSwbDUsgMDQdQi9I/TleT8GeaWMSJGr+lIpoym2zwPs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass client-ip=40.107.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 1. BDRV_REQ_NO_SERIALISING doesn't exist already, don't mention it. 2. We are going to add one more user of BDRV_REQ_SERIALISING, so comment about backup becomes a bit confusing here. The use case in backup is documented in block/backup.c, so let's just drop duplication here. 3. The fact that BDRV_REQ_SERIALISING is only for write requests is omitted. Add a note. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- include/block/block.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 6e36154061..b8f4e86e8d 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -53,16 +53,7 @@ typedef enum { * content. */ BDRV_REQ_WRITE_UNCHANGED = 0x40, - /* - * BDRV_REQ_SERIALISING forces request serialisation for writes. - * It is used to ensure that writes to the backing file of a backup process - * target cannot race with a read of the backup target that defers to the - * backing file. - * - * Note, that BDRV_REQ_SERIALISING is _not_ opposite in meaning to - * BDRV_REQ_NO_SERIALISING. A more descriptive name for the latter might be - * _DO_NOT_WAIT_FOR_SERIALISING, except that is too long. - */ + /* Forces request serialisation. Use only with write requests. */ BDRV_REQ_SERIALISING = 0x80, /* Execute the request only if the operation can be offloaded or otherwise From patchwork Fri Aug 21 14:11:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 275875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E684C433DF for ; Fri, 21 Aug 2020 14:16:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2758D204FD for ; Fri, 21 Aug 2020 14:16:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="WalgxZzz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2758D204FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97qA-0005rE-69 for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 10:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97li-00057w-KL; Fri, 21 Aug 2020 10:11:46 -0400 Received: from mail-eopbgr10117.outbound.protection.outlook.com ([40.107.1.117]:9536 helo=EUR02-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lg-00054o-Ry; Fri, 21 Aug 2020 10:11:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eBrenY1rXGZ2MEfMSV6OKN462YBMhnakkCO8Ki/aR/6eDevVWhe9wiNoJFrldISHjaWgpBq4WQu9gL0ISKlaFrijedxprEDnI0+KRq/YgtNksNDycCFpLfYVTcCBJ/NeVzB+iL9bcHoVWZysQdY82I38HS5hmk5in8h/SAGRqG/hi+RGkwNLpb8PoZK4Whfa8+tAFjGIcTxy/9+lu3ZIvjIvqBgZPBKWKPYHbLS6bLSfdxiLMhf7oTxEIwnqxpZhIxFUfk127Lf+fnQRHRJRfjweuCDXpyIFjdD5zJr01PGdYl/SpjytQXNGKuSmjcHsRst113hLdrTZpJ7sMkeXJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aF2PaB+w+zYUXs99bK9Q70bwF4UMXw1gH6C9i0YbYm8=; b=Vurzm3fzn3MJo/ZNSaies57JsD++lAhGrTWznhqPgRumZh7oqpSlGddcxaL+IMM9bHFK/qtBHC3wwGGYQSSMYUOSmRDE4OX5Y60jMWL7lKtXRoFoCH4fAFib97aAAs0EDopGy5VY5DkjBjYqema5XXSWuFbTvjWMSUjnBPCsJogH+kZTLUKi2G42GN8gRdqnYIJhAEodxE93soJO1JJZ6HNkfE2zaeefGqE8WyME7Ek0EuMC/6g9HBJtvj2nNqpBlcZdEEnvCJowNcOHw1wsWYS47Fmj8gGHA9nidlyeAMLiSVB1KUBftCifa/xU0wkGYtKgonXLgeCKuW3lynQvxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aF2PaB+w+zYUXs99bK9Q70bwF4UMXw1gH6C9i0YbYm8=; b=WalgxZzzurya8fIdfx3DvCuZcFkFukATf4Y7zeQiwTafUM5rMg/mEjA08CCpv6AqIZry+wUn/bCui8R3UVdZWitgWZmAvJcAZlzfLJON5eqNu0PS0wW9U+yLO8LL+jc6sqjsY7VtWqIBlQBAjA9RzeIUr07TPpDZsPVCsjDub+g= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Fri, 21 Aug 2020 14:11:40 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:40 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 03/10] block/io: split out bdrv_find_conflicting_request Date: Fri, 21 Aug 2020 17:11:16 +0300 Message-Id: <20200821141123.28538-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:39 +0000 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bb97938-68a3-410d-85cd-08d845dc1fc4 X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eeTpQcwuVvTclXKzCrcGQUBYGGRfNcHMZqWWIs3Pu3mI6v2e7ZNsxKg5nBHWWZ5k1Du5KOr5hTHIGcueYla6SLRmLD82TzT60Sf4lufuTxaQI00WppWEMp7V8RceuK0uoRCpmQ1msLfsvYjwBHTtkIHCxy+tVep2CLrC/AAISvgARMcy4WL0PySXnYcVaD7/V1BA1CCHYH4EDHTt6MWgiMcuNq0n39d5UJWwW1i3AhNLtGJWGICyIcE29vN+VQ30Qi4yZ4u+pmRwLS/2mJQsEizHUY1BER1DCz/q/CTLmHaLPVvXvHwDn5lasikZHMiL8e2u4Ck3tyiQ0s5vlfjcWQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39840400004)(136003)(346002)(376002)(366004)(6666004)(66946007)(8936002)(66556008)(186003)(6512007)(16526019)(1076003)(6506007)(86362001)(2906002)(956004)(2616005)(6486002)(52116002)(8676002)(66476007)(316002)(5660300002)(26005)(83380400001)(6916009)(478600001)(4326008)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 658i5Zc3i3QAjs94p6CqjDQzZZ13N5AaYcq4ylfMn/arZ2AmYbJiPcs7Ipb1XXJ+sA3vcikxw4xvNn2PzXfoCbLn3pV3mCZZgItM3Zcfh0LqqRHdhOzRFRUTPmCgT42E1suayw7ein7/jrWtwhM0OYB//ZwRO1bJOHfJXjL1fS7tIPmFQ1MlUhGAyBoMXEC8d9g+Th6oOhiyv7Xx22/Ht9SyCyR95MJhmzsmZopXvwkJU9I/OEFssGD/pdty4bI6DHpFj2/db/4h6pQLdMdR+8BTk5AAyq2A5paWNmzupL+bE1MqeWBjyTtGhU9FK6/z+2LAc1ZlnYuSDzMgmYLGQEc3u3dJZ5p0nxj2Z81vLfeYXUHTuIIInX4+EL4j7E4f54S5c+1mAyNkBpOrsIkAZHjCFIQV253eJNYgRYmVqwqUzdBX+PXb4FGDtfsf8jEFsBLRyvb2dvZ0hK48cxZmQ0ogctEdj3vX2Fu1T0o5wCxqKTFVkOvFJR/w+hzIab+V9XEKDM36b7Izuaz56LhcXdOY4c9c35CVpKBXzuTv+Q9mWizBEj+Eq5xxSQ/FuAJDrY+o30OzKP+FdAxjEsGARQJUjUnqMOQl424zwTWpjjwAvKRnICGXfSjxQPmDgDwvXolpgVwxZhTXzsm++VnW2g== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bb97938-68a3-410d-85cd-08d845dc1fc4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:40.2573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VyTO1F9Dxc2u3tuSqC5kchlYyu1kuzd3nMNGIBjh0o7W5DspKWcx6Y1HYJY9yTf7yTy559aY+E3CNAuOXQ9IB/OrHa7t76dcGP3VTyCt+sg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass client-ip=40.107.1.117; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:39 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To be reused in separate. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/io.c | 71 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/block/io.c b/block/io.c index b18680a842..5b96715058 100644 --- a/block/io.c +++ b/block/io.c @@ -727,43 +727,54 @@ static bool tracked_request_overlaps(BdrvTrackedRequest *req, return true; } +/* Called with self->bs->reqs_lock held */ +static BdrvTrackedRequest * +bdrv_find_conflicting_request(BdrvTrackedRequest *self) +{ + BdrvTrackedRequest *req; + + QLIST_FOREACH(req, &self->bs->tracked_requests, list) { + if (req == self || (!req->serialising && !self->serialising)) { + continue; + } + if (tracked_request_overlaps(req, self->overlap_offset, + self->overlap_bytes)) + { + /* + * Hitting this means there was a reentrant request, for + * example, a block driver issuing nested requests. This must + * never happen since it means deadlock. + */ + assert(qemu_coroutine_self() != req->co); + + /* + * If the request is already (indirectly) waiting for us, or + * 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) { + return req; + } + } + } + + return NULL; +} + static bool coroutine_fn bdrv_wait_serialising_requests_locked(BlockDriverState *bs, BdrvTrackedRequest *self) { BdrvTrackedRequest *req; - bool retry; bool waited = false; - do { - retry = false; - QLIST_FOREACH(req, &bs->tracked_requests, list) { - if (req == self || (!req->serialising && !self->serialising)) { - continue; - } - if (tracked_request_overlaps(req, self->overlap_offset, - self->overlap_bytes)) - { - /* Hitting this means there was a reentrant request, for - * example, a block driver issuing nested requests. This must - * never happen since it means deadlock. - */ - assert(qemu_coroutine_self() != req->co); - - /* If the request is already (indirectly) waiting for us, or - * 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) { - self->waiting_for = req; - qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); - self->waiting_for = NULL; - retry = true; - waited = true; - break; - } - } - } - } while (retry); + while ((req = bdrv_find_conflicting_request(self))) { + self->waiting_for = req; + qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); + self->waiting_for = NULL; + waited = true; + } + return waited; } From patchwork Fri Aug 21 14:11:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 275870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1A21C433DF for ; Fri, 21 Aug 2020 14:21:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88A642075E for ; Fri, 21 Aug 2020 14:21:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="W2SRPA7f" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88A642075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97um-0007C1-Qs for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 10:21:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lo-0005Ml-GP; Fri, 21 Aug 2020 10:11:52 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lm-00053q-F6; Fri, 21 Aug 2020 10:11:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZnzBsACzyZAmSnaPKzCon91O0TTT8CgL8G27RJA89Cn9hWHExSfOqaA0FJh3H6NXYMQQslQZovnueaIgFFEWEitBCQs9CmPZVf5ZXpJQVqSKfDapw6ogdqmxqP+XtBQB1czni89a7R6e9Tf/+NfjmrsKRBzO22V/ZGjxghzw8MeQOSqhxeiIaXnouVOHajddxUskawcn8TkorFxMnxoClal4RVS7MFQNQ+t0Blf7HQWV+Zamm6mpglHIlTX2MTVt7Y7rj8tfEM7mLczpQwGHLtTJv2+y1O2VFJo17WVMs1Z+JFbi/9UYEyYbNwP4jilYvvfITaEmVQLVc/IzjcHVDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fuTbjm6gbDz6RyXpolpCv0/trcGhMj8sqU81ZszkNnY=; b=O3Mhj5T7EXT3iStol3fntB2UDI4b04jBEbOcPnCVNp262fAL25zbbXU2C413fx/xZka7ADUcC/jwNI4jHW/owe4J0i139FLxYKDp2+V9Ucul56XPtlJ/0KWmlQZd5px5slCscTxfp5SK/ywihGkajxwa4SBGqDTgkWDSupVKZhk7kgxt3DO5Z7xN9p7sZPRiITUmIArpWLzzlQrIwPdPaOnZ95m+2lohphR8/I0rRx+Kkb0U7IOOjzHrPyLUIgHcTOvgMZwExhrq6Y1FfjUONIkhNCeA2AkqezVKPnJZZLXun4ysuq2rUSTVi6dfCWdEUdO0tjcEIxaZ5joD/41vNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fuTbjm6gbDz6RyXpolpCv0/trcGhMj8sqU81ZszkNnY=; b=W2SRPA7f6F4wll5PcValPml/tGYgGx+n3rhfoB1uFv7a4eTWthaD9QGbXq9zAAm46ryVm+9LjBuVbCkK/HSIJ6dtsSUdjY9sIc+zS9npLrx4B72ZTtoPgWSwg76+H/TOmoNyqvrcfgQxkGgv/VDs2iB4t3PG2ciSuJUS9JExcW8= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:42 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:42 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 05/10] block: bdrv_mark_request_serialising: split non-waiting function Date: Fri, 21 Aug 2020 17:11:18 +0300 Message-Id: <20200821141123.28538-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:41 +0000 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5e0ecf3-eeed-4038-b135-08d845dc20e6 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rOt2dCXwBCpK+2mUcTQs/c2n+NT79wT6Dffene2UiQ/a1UeTiN4sdYbsHTLSDpLApmV2QZE/oEd/yObwHWjbJPqa/A+T7LhAcDKrhe4EOrXOCAqSkkl5beRzzEOTAIKx7CKWywqkXCQN4HEaJ3cwRRdTQIucmcvvJdFOIZzLyQRNGjbONJr+0cT/XGMh7AhsRLWDXOFTsfykiOYWce6A+C+6Wxpwk3qYmN0tlEhXIzMV0I5QK7QNl51FksHb4hFl0i9P3qHF8Iukoo5ezZizPs8Zxiu4gL2CYinNxZAwTlDczeZv0rDwCjMUdpv++kyWOQbW1BX3ClTJcqE97Bqkmg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: laqz9QST1KQFkgIayHkKZhU5KKhtuyaq30jtEObzI8oWXeK7MsUHXp4zeuPKrFZDfgVw1Fk/A0YA1uQGUFyvJc7fPJozUKioYHT621F8W6UT9U4KK6y5q9mtZRYBQlDw0VVLVOUhXkw74ludvN6duzo0Xq/M9w6Ic78wHXQ8C7fH3nnOwIDTXskictzJfR4n9JkL7aHtO9OhvyDZWU3Ibido5zJn9wV3YBe0PZD+ylQlQNRsoNOgZQSv8oSnp79GTXzOaloPOIuODZyBheDXoDa3n3vCRB3sr1asr2g1opWX5oKZxQ+O4UJTO0YYBnbx/fEob1v66K8wSoYWocFb0I6tJuRfVKNRv7QMv2tBtW2Ew70Ge1yk1rMTALZG6X827Pnua46kba8ROhUOf5s6WbKUqF3hlQqBOtiF3uszInnsKY9rOVF4vJcMMMmURwuekAGIsWNfAJd5sWdhqb4BMnfWEU6IZcTzaxiAevgktBytOUAmZQfQe90fAFeuRAkr8Em6m7EvHS8auIGSxHzei10fyfdBbzVGm4MduGATGyYL9Enu2DZJ3k78gR2noOfP1dTW9l0tu0ndTy3Su1w6psz6QCsA/uoqa1i1Ayr1bnBjSqqSyYA2fzN4fxZWEbRL0itQTbbGeLi+GLAXJKDbjQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5e0ecf3-eeed-4038-b135-08d845dc20e6 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:42.2157 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cFO/li2deGCeZ6ZxhaVjmjTR6I/T+pwsH/RmJSMSAQPyzgnqp+RUjWIb7cVLyfDwt2+uJZWohXKeqv1e9siTa1LPPyvj9aCR8s/NO4TWt3A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass client-ip=40.107.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We'll need a separate function, which will only "mark" request serialising with specified align but not wait for conflicting requests. So, it will be like old bdrv_mark_request_serialising(), before merging bdrv_wait_serialising_requests_locked() into it. To reduce the possible mess, let's do the following: Public function that does both marking and waiting will be called bdrv_make_request_serialising, and private function which will only "mark" will be called tracked_request_set_serialising(). Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 3 ++- block/file-posix.c | 2 +- block/io.c | 35 +++++++++++++++++++++++------------ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 38dec0275b..4d56a1b141 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1039,7 +1039,8 @@ extern unsigned int bdrv_drain_all_count; void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent); void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent); -bool coroutine_fn bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align); +bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req, + uint64_t align); BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs); int get_tmp_filename(char *filename, int size); diff --git a/block/file-posix.c b/block/file-posix.c index 9a00d4190a..560d1c0a94 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2957,7 +2957,7 @@ raw_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int bytes, req->bytes = end - req->offset; req->overlap_bytes = req->bytes; - bdrv_mark_request_serialising(req, bs->bl.request_alignment); + bdrv_make_request_serialising(req, bs->bl.request_alignment); } #endif diff --git a/block/io.c b/block/io.c index 36bbe4b9b1..dd28befb08 100644 --- a/block/io.c +++ b/block/io.c @@ -778,15 +778,14 @@ bdrv_wait_serialising_requests_locked(BdrvTrackedRequest *self) return waited; } -bool bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) +/* Called with req->bs->reqs_lock held */ +static void tracked_request_set_serialising(BdrvTrackedRequest *req, + uint64_t align) { - BlockDriverState *bs = req->bs; int64_t overlap_offset = req->offset & ~(align - 1); uint64_t overlap_bytes = ROUND_UP(req->offset + req->bytes, align) - overlap_offset; - bool waited; - qemu_co_mutex_lock(&bs->reqs_lock); if (!req->serialising) { atomic_inc(&req->bs->serialising_in_flight); req->serialising = true; @@ -794,9 +793,6 @@ bool bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) req->overlap_offset = MIN(req->overlap_offset, overlap_offset); req->overlap_bytes = MAX(req->overlap_bytes, overlap_bytes); - waited = bdrv_wait_serialising_requests_locked(req); - qemu_co_mutex_unlock(&bs->reqs_lock); - return waited; } /** @@ -882,6 +878,21 @@ static bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self return waited; } +bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req, + uint64_t align) +{ + bool waited; + + qemu_co_mutex_lock(&req->bs->reqs_lock); + + tracked_request_set_serialising(req, align); + waited = bdrv_wait_serialising_requests_locked(req); + + qemu_co_mutex_unlock(&req->bs->reqs_lock); + + return waited; +} + static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, size_t size) { @@ -1492,7 +1503,7 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild *child, * with each other for the same cluster. For example, in copy-on-read * it ensures that the CoR read and write operations are atomic and * guest writes cannot interleave between them. */ - bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); + bdrv_make_request_serialising(req, bdrv_get_cluster_size(bs)); } else { bdrv_wait_serialising_requests(req); } @@ -1903,7 +1914,7 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, assert(!(flags & ~BDRV_REQ_MASK)); if (flags & BDRV_REQ_SERIALISING) { - bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); + bdrv_make_request_serialising(req, bdrv_get_cluster_size(bs)); } else { bdrv_wait_serialising_requests(req); } @@ -2069,7 +2080,7 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild *child, padding = bdrv_init_padding(bs, offset, bytes, &pad); if (padding) { - bdrv_mark_request_serialising(req, align); + bdrv_make_request_serialising(req, align); bdrv_padding_rmw_read(child, req, &pad, true); @@ -2183,7 +2194,7 @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, } if (bdrv_pad_request(bs, &qiov, &qiov_offset, &offset, &bytes, &pad)) { - bdrv_mark_request_serialising(&req, align); + bdrv_make_request_serialising(&req, align); bdrv_padding_rmw_read(child, &req, &pad, false); } @@ -3347,7 +3358,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact, * new area, we need to make sure that no write requests are made to it * concurrently or they might be overwritten by preallocation. */ if (new_bytes) { - bdrv_mark_request_serialising(&req, 1); + bdrv_make_request_serialising(&req, 1); } if (bs->read_only) { error_setg(errp, "Image is read-only"); From patchwork Fri Aug 21 14:11:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 275873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63A27C433E1 for ; Fri, 21 Aug 2020 14:18:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13FF02075E for ; Fri, 21 Aug 2020 14:18:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="m9eGyscg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13FF02075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97s6-0001DR-9x for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 10:18:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lr-0005VX-St; Fri, 21 Aug 2020 10:11:55 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lp-00053q-6a; Fri, 21 Aug 2020 10:11:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ajQD4TudfbfqRSyxljGIqtEFaqrlG/TtlhPhlDaAEMbvU/7G5n37x73zeVNh4FKMJj7kZ9WvIDnl0YX1+GAu+D+uyzawHdmzbNfkDvnjr6HW/vu0igagziWrKw217MnDmn/QaOUMFJlcrGEI3SnmOE686N8H1rnNuYFTa7rZj+7+4F6sSdAleLMR7EiCStt1PtKgklJmaGbjOM38fN5TTYDdPNp6vpily/kTcS6zX1Jjz+HjFYrc0XLBPrrfeHbqcyhrL9Z5spzmsZCAjETdLRfiZBCXP8qijA7a2NUI6VMrXeC54RBY+1mcQxo+MyyHrsrcfWOpF9zGtismQv+OpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNWc3uvAHjhP7F3zdyGW6fCtrLJxdhDq6PVseTT8UEQ=; b=DcxZLYN7G90DrYney2v0ioUK2e22nGrl0TLwkEz448Si1sazM0Wxf+d3YWw4m5beFb2BKClfLXfvnX5guP35h3177dgKfc9ob4sxs/rvBoYicnaWHrcBWhC6QUTSyHphSMsgKGSDZnKfXwwbXiw9nQBaE3d6lPiJ+OSpp0CRPJzNOndEpWCQtk1IwvRwQPGv6ErJzYZbyGUxgsDaT5e/KXCSxWJLHlMqytiwvPEjtVyASe1Ny2FYPZcztB95fha7H7fZv67PFiRThJv0erJde9jEUPQ6UNS4qyqA+YgEBS+ViNYxu5bd2O95mW68lt+3EgenTqfcLqzX/DBqse4hkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNWc3uvAHjhP7F3zdyGW6fCtrLJxdhDq6PVseTT8UEQ=; b=m9eGyscgOkNvPS7Yi7BsWuZ6V8LroQvU3TO/zjoJNr/1+VtlEsHDuLh7oFz40TR6zaLMQ2/NN7udeA8CKxOkH0Bv0yHv+IfsO8iJ8TK7KaFlRsvtA3pL1p89UxIOW8dNwQf49aCeiI3/pdhcJifX7r2mSPOsvcFNUbDR+sLVePY= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:44 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:44 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 07/10] block: introduce preallocate filter Date: Fri, 21 Aug 2020 17:11:20 +0300 Message-Id: <20200821141123.28538-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:43 +0000 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f60345eb-6ba5-4841-f130-08d845dc2226 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7kWRmvsxZqDygG4XoakmQkwjZYeL2ktJMOwfR0Bh68tbpAluPuZo1rH48R2sklrNGoXMUd4Ut5Jnhir6KpklevMk9JqO7m7DfJOBI9SU4TX00y2J0SVi07ez9isksWmOGAMf9nnHR9Kg9QwGG4t5b95Ubi86Jwn6G7+5ZUTLZqAga8sBc7NoUnRVyzM5zA6HTYWyhbvl+KX6Y97C/GWbY3uO8/sF7oQrQA1iTWQ11XOgH+anjvelwl3KKOLRSFH93JlwX9hqwTDbALNwIWWlH+wqTcoXxjaW9r0HpiOmLnlzMeglFhiv/TbxYHavt0nM1oTTU/Hzbra1ZvqZjrCdEe4BQQA5oUB2+LK/CXGD+3uxZY2K0PpKGMyKSNIn853DUzY2Zoz8brBYMiGw7vadacZMal26KEHqRErAjE9636HID1BNQsSePN+joOs3TArS1A7fn13IXJJP4yLiYsTkOg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(30864003)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PAd+I0FRksEHXsKqsneL4SKKPjdTt7TwJwtOR0MHWooh2V6h9k2rL7YTtaJAdQUP8JjUxSN+F+Q0gjbQRimcvWPP944RwS7A8hYUT3iuRE0mk2HQ+1bQhlR9XmPmk8Vto0uPqiko7m+MxMgQqqgD7mpkqLu6niY2R4/6A9CQ2WOXMVGZ2Gep+6QCVrVuRC7JXpaGFtfLvD+DXqNsnEuTF2oHScqqu6RrDqbQhar8XJz3bqQRkr0UqRVAlbN+hRwC7jkuwOTBwJ1DoXtAkZiCx33aKRDegPjKIu+20OHspES+SOYsAwTUmNAysZMZJkVzHZFJV54FJnKfwd8tCu5f8EMVV3XQ5Y/JZQlt9p2Lm2S8J+dPjq5+3Dj1B8qw1aY1Su765njZYEJmCHpjN3wUkx0G9EoTRbiAnP7Sf1pSvDtD8F7w4oecZ5tCWJoQAKK8HShjluPbN+HIWpfGNiznXXideU5JcCzSi9Tf5VQLE4C2vQrOiGAPm4YP6xTDAU+WWsCUefXR5a0Vmjsj/ShmD0IN/8NSUJRU/WEDP46bJEJSvHFKkfTUCO9v73pTuhMmTTlRgrepc/AA3US3tjJnNUId6dcQ+Pi9u+C7ooQleOuFXu4wAX13x9TKRssBChWCL1sdUtD3y1AC+7xdZU8z1w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f60345eb-6ba5-4841-f130-08d845dc2226 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:44.3254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yge184z2aDToglg4xN4HOzWV9CfBnTwby31sXJqXLSJF+JUbYYZCzorhI0Pk1wEiGU+JN6W9DqchP0EbRBeNleGo7pjjCAzYFdVhkY9RG50= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass client-ip=40.107.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" It's intended to be inserted between format and protocol nodes to preallocate additional space (expanding protocol file) on writes crossing EOF. It improves performance for file-systems with slow allocation. Signed-off-by: Vladimir Sementsov-Ogievskiy --- docs/system/qemu-block-drivers.rst.inc | 26 +++ qapi/block-core.json | 20 +- block/preallocate.c | 291 +++++++++++++++++++++++++ block/Makefile.objs | 1 + 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 block/preallocate.c diff --git a/docs/system/qemu-block-drivers.rst.inc b/docs/system/qemu-block-drivers.rst.inc index b052a6d14e..5e8a35c571 100644 --- a/docs/system/qemu-block-drivers.rst.inc +++ b/docs/system/qemu-block-drivers.rst.inc @@ -952,3 +952,29 @@ on host and see if there are locks held by the QEMU process on the image file. More than one byte could be locked by the QEMU instance, each byte of which reflects a particular permission that is acquired or protected by the running block driver. + +Filter drivers +~~~~~~~~~~~~~~ + +QEMU supports several filter drivers, which don't store any data, but do some +additional tasks, hooking io requests. + +.. program:: filter-drivers +.. option:: preallocate + + Preallocate filter driver is intended to be inserted between format + and protocol nodes and does preallocation of some additional space + (expanding the protocol file) on write. It may be used for + file-systems with slow allocation. + + Supported options: + + .. program:: preallocate + .. option:: prealloc-align + + On preallocation, align file length to this number, default 1M. + + .. program:: preallocate + .. option:: prealloc-size + + How much to preallocate, default 128M. diff --git a/qapi/block-core.json b/qapi/block-core.json index 197bdc1c36..b40448063b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2805,7 +2805,7 @@ 'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', - 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', + 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, 'sheepdog', 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } @@ -3074,6 +3074,23 @@ 'data': { 'aes': 'QCryptoBlockOptionsQCow', 'luks': 'QCryptoBlockOptionsLUKS'} } +## +# @BlockdevOptionsPreallocate: +# +# Filter driver intended to be inserted between format and protocol node +# and do preallocation in protocol node on write. +# +# @prealloc-align: on preallocation, align file length to this number, +# default 1048576 (1M) +# +# @prealloc-size: how much to preallocate, default 134217728 (128M) +# +# Since: 5.2 +## +{ 'struct': 'BlockdevOptionsPreallocate', + 'base': 'BlockdevOptionsGenericFormat', + 'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } } + ## # @BlockdevOptionsQcow2: # @@ -3979,6 +3996,7 @@ 'null-co': 'BlockdevOptionsNull', 'nvme': 'BlockdevOptionsNVMe', 'parallels': 'BlockdevOptionsGenericFormat', + 'preallocate':'BlockdevOptionsPreallocate', 'qcow2': 'BlockdevOptionsQcow2', 'qcow': 'BlockdevOptionsQcow', 'qed': 'BlockdevOptionsGenericCOWFormat', diff --git a/block/preallocate.c b/block/preallocate.c new file mode 100644 index 0000000000..bdf54dbd2f --- /dev/null +++ b/block/preallocate.c @@ -0,0 +1,291 @@ +/* + * preallocate filter driver + * + * The driver performs preallocate operation: it is injected above + * some node, and before each write over EOF it does additional preallocating + * write-zeroes request. + * + * Copyright (c) 2020 Virtuozzo International GmbH. + * + * Author: + * Sementsov-Ogievskiy Vladimir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "qemu/osdep.h" + +#include "qapi/error.h" +#include "qemu/module.h" +#include "qemu/option.h" +#include "qemu/units.h" +#include "block/block_int.h" + + +typedef struct BDRVPreallocateState { + int64_t prealloc_size; + int64_t prealloc_align; + + /* + * Filter is started as not-active, so it doesn't do any preallocations nor + * requires BLK_PERM_RESIZE on its child. This is needed to create filter + * above another node-child and then do bdrv_replace_node to insert the + * filter. + * + * Filter becomes active the first time it detects that its parents have + * BLK_PERM_RESIZE on it. + * + * Filter becomes active forever: it doesn't lose active status if parents + * lose BLK_PERM_RESIZE, otherwise we'll not be able to shrink the file on + * filter close. + */ + bool active; + + /* + * Track real data end, to crop preallocation on close data_end may be + * negative, which means that actual status is unknown (nothing cropped in + * this case) + */ + int64_t data_end; +} BDRVPreallocateState; + +#define PREALLOCATE_OPT_PREALLOC_ALIGN "prealloc-align" +#define PREALLOCATE_OPT_PREALLOC_SIZE "prealloc-size" +static QemuOptsList runtime_opts = { + .name = "preallocate", + .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), + .desc = { + { + .name = PREALLOCATE_OPT_PREALLOC_ALIGN, + .type = QEMU_OPT_SIZE, + .help = "on preallocation, align file length to this number, " + "default 1M", + }, + { + .name = PREALLOCATE_OPT_PREALLOC_SIZE, + .type = QEMU_OPT_SIZE, + .help = "how much to preallocate, default 128M", + }, + { /* end of list */ } + }, +}; + +static int preallocate_open(BlockDriverState *bs, QDict *options, int flags, + Error **errp) +{ + QemuOpts *opts; + BDRVPreallocateState *s = bs->opaque; + + /* + * Parameters are hardcoded now. May need to add corresponding options in + * future. + */ + opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); + qemu_opts_absorb_qdict(opts, options, &error_abort); + s->prealloc_align = + qemu_opt_get_size(opts, PREALLOCATE_OPT_PREALLOC_ALIGN, 1 * MiB); + s->prealloc_size = + qemu_opt_get_size(opts, PREALLOCATE_OPT_PREALLOC_SIZE, 128 * MiB); + qemu_opts_del(opts); + + bs->file = bdrv_open_child(NULL, options, "file", bs, &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, + false, errp); + if (!bs->file) { + return -EINVAL; + } + + s->data_end = bdrv_getlength(bs->file->bs); + if (s->data_end < 0) { + return s->data_end; + } + + 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_NO_FALLBACK) & + bs->file->bs->supported_zero_flags); + + return 0; +} + +static void preallocate_close(BlockDriverState *bs) +{ + BDRVPreallocateState *s = bs->opaque; + + if (s->active && s->data_end >= 0 && + bdrv_getlength(bs->file->bs) > s->data_end) + { + bdrv_truncate(bs->file, s->data_end, true, PREALLOC_MODE_OFF, 0, NULL); + } +} + +static void preallocate_child_perm(BlockDriverState *bs, BdrvChild *c, + BdrvChildRole role, + BlockReopenQueue *reopen_queue, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) +{ + BDRVPreallocateState *s = bs->opaque; + + bdrv_default_perms(bs, c, role, reopen_queue, perm, shared, nperm, nshared); + + s->active = s->active || (perm & BLK_PERM_RESIZE); + + if (s->active) { + /* Force RESIZE permission, to be able to crop file on close() */ + *nperm |= BLK_PERM_RESIZE; + } +} + +static coroutine_fn int preallocate_co_preadv_part( + BlockDriverState *bs, uint64_t offset, uint64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, int flags) +{ + return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset, + flags); +} + +static int coroutine_fn preallocate_co_pdiscard(BlockDriverState *bs, + int64_t offset, int bytes) +{ + return bdrv_co_pdiscard(bs->file, offset, bytes); +} + +static bool coroutine_fn do_preallocate(BlockDriverState *bs, int64_t offset, + int64_t bytes, bool write_zero) +{ + BDRVPreallocateState *s = bs->opaque; + int64_t len, start, end; + + if (!s->active) { + return false; + } + + if (s->data_end >= 0) { + s->data_end = MAX(s->data_end, + QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE)); + } + + len = bdrv_getlength(bs->file->bs); + if (len < 0) { + return false; + } + + if (s->data_end < 0) { + s->data_end = MAX(len, + QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE)); + } + + if (offset + bytes <= len) { + return false; + } + + start = write_zero ? MIN(offset, len) : len; + end = QEMU_ALIGN_UP(offset + bytes + s->prealloc_size, s->prealloc_align); + + return !bdrv_co_pwrite_zeroes(bs->file, start, end - start, + BDRV_REQ_NO_FALLBACK | BDRV_REQ_SERIALISING | BDRV_REQ_NO_WAIT); +} + +static int coroutine_fn preallocate_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, int bytes, BdrvRequestFlags flags) +{ + if (do_preallocate(bs, offset, bytes, true)) { + return 0; + } + + return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); +} + +static coroutine_fn int preallocate_co_pwritev_part(BlockDriverState *bs, + uint64_t offset, + uint64_t bytes, + QEMUIOVector *qiov, + size_t qiov_offset, + int flags) +{ + do_preallocate(bs, offset, bytes, false); + + return bdrv_co_pwritev_part(bs->file, offset, bytes, qiov, qiov_offset, + flags); +} + +static int coroutine_fn +preallocate_co_truncate(BlockDriverState *bs, int64_t offset, + bool exact, PreallocMode prealloc, + BdrvRequestFlags flags, Error **errp) +{ + BDRVPreallocateState *s = bs->opaque; + int ret = bdrv_co_truncate(bs->file, offset, exact, prealloc, flags, errp); + + /* s->data_end may become negative here, which means unknown data end */ + s->data_end = bdrv_getlength(bs->file->bs); + + return ret; +} + +static int coroutine_fn preallocate_co_flush(BlockDriverState *bs) +{ + return bdrv_co_flush(bs->file->bs); +} + +static int64_t preallocate_getlength(BlockDriverState *bs) +{ + /* + * We probably can return s->data_end here, but seems safer to return real + * file length, not trying to hide the preallocation. + * + * Still, don't miss the chance to restore s->data_end if it is broken. + */ + BDRVPreallocateState *s = bs->opaque; + int64_t ret = bdrv_getlength(bs->file->bs); + + if (s->data_end < 0) { + s->data_end = ret; + } + + return ret; +} + +BlockDriver bdrv_preallocate_filter = { + .format_name = "preallocate", + .instance_size = sizeof(BDRVPreallocateState), + + .bdrv_getlength = preallocate_getlength, + .bdrv_open = preallocate_open, + .bdrv_close = preallocate_close, + + .bdrv_co_preadv_part = preallocate_co_preadv_part, + .bdrv_co_pwritev_part = preallocate_co_pwritev_part, + .bdrv_co_pwrite_zeroes = preallocate_co_pwrite_zeroes, + .bdrv_co_pdiscard = preallocate_co_pdiscard, + .bdrv_co_flush = preallocate_co_flush, + .bdrv_co_truncate = preallocate_co_truncate, + + .bdrv_co_block_status = bdrv_co_block_status_from_file, + + .bdrv_child_perm = preallocate_child_perm, + + .has_variable_length = true, + .is_filter = true, +}; + +static void bdrv_preallocate_init(void) +{ + bdrv_register(&bdrv_preallocate_filter); +} + +block_init(bdrv_preallocate_init); diff --git a/block/Makefile.objs b/block/Makefile.objs index 19c6f371c9..f8e6f16522 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -44,6 +44,7 @@ block-obj-y += crypto.o block-obj-y += aio_task.o block-obj-y += backup-top.o block-obj-y += filter-compress.o +block-obj-y += preallocate.o common-obj-y += monitor/ block-obj-y += monitor/ From patchwork Fri Aug 21 14:11:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 275871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 771EBC433DF for ; Fri, 21 Aug 2020 14:20:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41BB9204FD for ; Fri, 21 Aug 2020 14:20:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="TMPMgZ0j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41BB9204FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:32858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97tg-0004yt-Gd for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 10:20:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lu-0005b8-1G; Fri, 21 Aug 2020 10:11:58 -0400 Received: from mail-vi1eur05on2115.outbound.protection.outlook.com ([40.107.21.115]:44416 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97ls-0005AI-4e; Fri, 21 Aug 2020 10:11:57 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXl7H6Nnt+JSG+ouHmHc2BWdqURkNfVt0IncBWtGrNqwa77VySc/TpIZo7b55Fly88B70kbDZMWZ5eIiAP0hFPVCLENGFZbT8E5eYInb83dIxeK0Jrvz/uQ/ONTZVhEiGSa0SRybdWOMbmI1PDwwIRp3Mt0Qr1rSB3YssdyUiIlBaKJn2kQcmXCu+0o6f+kqFrlt/Ht0gMWbgJ9/Pi26eGv/+vfCBVNX+VjDkKpP6cC46I5HxvxzY18Yrw9LcNu703qGgCelwUnalV4jUnt3o3ZQZSuzhHolPxS3/+9mC0XkK9tzDu3l6TMMMFKfX+kuU4uccVNVJYI4zgDlbznkMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O2MXAeW/RMI77KkOtkr88BkwvA/NnR/QKKS6KgN4M0A=; b=IbDtApT+sJFFYKwQ40aG/tICSAhgdK/BphsGKb8IGMmfcrotihT1lZS26uRIUqntMl4DKo9P5jOSXqMRfivXs+i1+XOgdH7yjoARLGRmXsBMjOTQjlJIewpjPe1gs4gcTBCwWUQfC26fEc7ibAXI0dJqqovSjkvYhrOS5nqhTDPQwRfUKRO3L+8VKayZ7ckIe4z+evlYeR3REaC+GfBWD7e2zyagsgf0BiYcZ8s68ftbeYzO5TPntCGloqZHapOjSWfMRD6l3hGhEhkgVmd8aAolE9OXurTd5hmWaAA9732MaGrfEEFwx18rMCXZg0NWKC35I5CMrNdQ7D/lxf2Ilw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O2MXAeW/RMI77KkOtkr88BkwvA/NnR/QKKS6KgN4M0A=; b=TMPMgZ0jw2pyLFcjHQh8tl/ZfE/HbcXrAEnzNoI330nqEQPR0z8wEEMDDrsrpqxuxqsZTA9hNymX5jM4cMZ5hJ1yBqJYoYYZlXkB2dsmpNMuM/i+tsp2wQhMsmPUSMdt3cTZuXXs008JYnbOyNYq6dcxMluBRHBQ9wCQ+s9JJjo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:45 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:45 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 08/10] iotests.py: add verify_o_direct helper Date: Fri, 21 Aug 2020 17:11:21 +0300 Message-Id: <20200821141123.28538-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:44 +0000 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3dab13f6-0088-43d6-1960-08d845dc22f5 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1388; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ffrMMg98Tg1uBfggmHO3czBh2RjtvpBQE0dUA9uj0EujgUzzWbTSFRFe7rffrBaVn+R/wWBrMWZXklJyF6Pur5dTbWlIdZeXHI85dtoKc4Pftxu9BDKQvt63Ry68s5ckg5qSfJaJ0Sdw3dg29Qzt2FqFS1LsEcDGRtAU3uoVBs89/K/Dqn9mTgaXKqCsll6Ze0FW40rkjYggezbklmVw+HCVYSqahWq/dErB5kiLOUYhLo0wgUPwLhbLhcQPoOzNxkUdUJ+c97iTP7YkNIw+J7Ztc195Y6aY8zDopq/EClfUnUqW8I/S8XAykj2gVTTfercE+R2ZZQAq/C6jAREKuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(15650500001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NOLU7VLL2PLqWXG6c0wjUd6ZKGrfEHu6WPhwiWGz/2FhUQe6935awrTbpN+zwdecILhWCYJ5oyVH87V4wbPGKcN9eYMmb2qI7U5zquZTBN7Kw6ZmAOC7IPsxGBqYY+OEf5/nq6/JcCm47/AOlAoIlBS7pf2HN5ZIkgDopix8QsTUtucmU6ZDtuF4DxbfDrWbJv/Vb66NNFrN84U3AxINNq6znoai+XK6Mn2BFAN5IumHm0yM0vL6OtOv3+nCnLQ/mqxm6Q++QRz7xjmKyQiwB/ktJabP2mPcU8AOf8M4NbNzcNL5sAPq40jDTJKLWTfCfX7gPA3juHuz+GPH9H8diORQFY38gvdXbQVNZz7vAQ74XkSdYC0X4eUUzc6X7a3yJpb4w6kNbCP1R57GAp9YKHIfuPStvQYGjslGr0UlWzA3+wnS1GlEfJ062BE4XNc5ebgyj+VYjygvvurRmp+FvQ7VZrSuSNRUPY/HXPav7f2i5tdbHU4xvgb1IJ+IoiOEbiYXfBC4t4HvnmFnlAkcHbCSGYGBTkZv5JINtzqhs/MwSjEEbzd/YFwuvnKErWU1jjZESGyvIBoBL1Q8N49uJjEahlft7khCOZhgqtUuXf0yv4y9O3d0zDgLAWICJQJuwP7NTDiOeHbRg2aePDYK+w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3dab13f6-0088-43d6-1960-08d845dc22f5 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:45.5779 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wiXorVrtaOQMnTGD3wZyfDVF5ET7wdX1MIY2DH2yNW/cbxueb6JHKXySPpQ5M/Q9BmZiJZzKt+TXaPrCx/j8aCZvmPcQJvw8DpqcRZ5KOnA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass client-ip=40.107.21.115; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:51 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add python notrun-helper similar to _check_o_direct for bash tests. To be used in the following commit. Suggested-by: Nir Soffer Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 717b5b652c..7f1aa187a9 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -29,6 +29,7 @@ import struct import subprocess import sys import time +import errno from typing import (Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar) import unittest @@ -1083,6 +1084,17 @@ def _verify_aio_mode(supported_aio_modes: Sequence[str] = ()) -> None: if supported_aio_modes and (aiomode not in supported_aio_modes): notrun('not suitable for this aio mode: %s' % aiomode) +def verify_o_direct() -> None: + with FilePath('test_o_direct') as f: + try: + fd = os.open(f, os.O_DIRECT | os.O_CREAT | os.O_RDWR) + except OSError as e: + if e.errno != errno.EINVAL: + raise + notrun(f'file system at {test_dir} does not support O_DIRECT') + else: + os.close(fd) + def supports_quorum(): return 'quorum' in qemu_img_pipe('--help')