From patchwork Mon Aug 17 09:15:42 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: 276350 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 A9CB7C433E1 for ; Mon, 17 Aug 2020 09:28:32 +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 78D5E2072E for ; Mon, 17 Aug 2020 09:28:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="dweBF6Hj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78D5E2072E 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]:35826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bRP-0000Fr-Ow for qemu-devel@archiver.kernel.org; Mon, 17 Aug 2020 05:28:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFb-0007Vf-89; Mon, 17 Aug 2020 05:16:19 -0400 Received: from mail-eopbgr140107.outbound.protection.outlook.com ([40.107.14.107]:49892 helo=EUR01-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 1k7bFY-00087Y-H4; Mon, 17 Aug 2020 05:16:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lS5EVBYJsDAh1rZgS1dWmiFiUWvluZOtvwkafAKUQaeR6VjDKOwkbs6WCXROwojpEGYE2aQJkovKvoO6APluuSis8ICNL0vhuMbNAiyrXYoL3QGN1Nho4sFlRYdKVNQBongJil5HQJLy2DKJzHVHXt6k5lFeiy7b/pNS0eFg7S52tUHgd8lpohypfbZ/S4zEaO4/X58PEDQtU572fHwd0iIYh2aFPwELGz9pgGcEYD2v2Hz5WrNrG216Z8R0j3OtGEn0NiQl6GfawlVu6ig63sdfnSV/AGBLNKgo7/z4jYOc+60fV1Ug4II1xdFhxKWrdeq5vxLTCstUnGFeyQUejQ== 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=6m8rQuUx+OzptYRz38VBXXuVMUS36aKjqrnLFpM4dVE=; b=VNqwXR51Q3vqI1Pv6Dtqtw1zzKE8kjnoZw/7aUmG4X18E46kmDJRgqNJF8I9lnG5J3//Qppau/CiunFGQt4JwzDLZJiVqchPHKXKQAy3njg0EoxE7OrFYMW93+TJbhCwroXI+0ZuQGxaGz2giY0dZV5iZOUrcaVfWzkCoTz+4GdfchKWN3yEsQkBta/WVbErv7nD6/qJEyCGBJ0UX4G72fXCgY+bhkXFS7a4CgMembkAWI9kaZWZQBuNb2pR6XLD5xgiyJZsidU0Bpm1fLdxaC3jeKMhETIkjJHzfIQIp7mOBfuImWMdp0MrN/DKkAyah/6LRH+N+8uaUCIoHVOyqQ== 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=6m8rQuUx+OzptYRz38VBXXuVMUS36aKjqrnLFpM4dVE=; b=dweBF6HjgLZDHXxVAHbw3l1nULlCrnbmn3Mt7kHe4kf3rwglSEf8tiOMECMtRHVjB8pEFpIZvk/GulexTWJ1PF/5uHTjFJhbQ3NuApgYhwFfthQAdIOo6TL734ZSlv/hSoGmLLdLJ4fAnMAbGdVk0pgwraxkWsqzdCQiOE8HTUw= 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 AM6PR08MB4852.eurprd08.prod.outlook.com (2603:10a6:20b:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.23; Mon, 17 Aug 2020 09:16:03 +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; Mon, 17 Aug 2020 09:16:03 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 01/12] block: simplify comment to BDRV_REQ_SERIALISING Date: Mon, 17 Aug 2020 12:15:42 +0300 Message-Id: <20200817091553.283155-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200817091553.283155-1-vsementsov@virtuozzo.com> References: <20200817091553.283155-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) 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.174) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 09:16:02 +0000 X-Mailer: git-send-email 2.18.0 X-Originating-IP: [185.215.60.174] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d00f7bfb-b85d-43b7-6e6e-08d8428e2a44 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: 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: ZVUbTuHCTW+oahQhYgZqWcyT0ei1ZmyIniMESc1ceOkGWSEB4vginJfVrSutPCC7d9t76wCti+xCMisdEiKE+w/KwDVJBw2nsrIkCQRqRY4thzbIsoid70I5o1RR4jfKfINmnayla18BLes0NGpjoNsn4JqoTxWKCxiEx1MEm47hBcnHzyvc7iiqSPxiM/npQx0xdx6NdgnuuGW7wc7CRSyNJlE8H6oJuqmHg9xzTOIKRr9wdC8wNGOWO6vbqHWbPRZsVY6IM3wD7o4ygeqZaX96PPVIJPjSNZ/SfiMH0M8FbYtKuyg8DOmgg6jN4pmxZhXEw9QN2lmf2i7fk4TzNA== 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)(366004)(136003)(346002)(376002)(39840400004)(396003)(52116002)(26005)(86362001)(16526019)(6506007)(186003)(6486002)(107886003)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Frl5gTU/lgg5BC7oCIay63Gqjwhfj9l87nbSdOjWdGUwizUFXBrRKhT1NmMtkCSxQxEGS8UDkzMZa+XRHQH84MF2W+OJuNMUWUWz9Po4uIxkfQ6QiyrTJlGJInYz+ipbImFocHnKCUAohYxLb7W0muJsNv+eew4PyJupwsvyhO7tPre5y/NWEHpZ3CAX2Sy7v4kd56fILuoPYts90pTwS+ORvapyW29tHR2vwf5MYwY3O2EWtsUqnZjwxobmQ2EU5dag7iyo31sSG8pFP17YfkmU3HJno2Lo9WweSnPsM+fMbZWgKquCqqN4PbfXsgb1ygO9j9FwmSRKVBHqJdGD3iT63V4DwT3NWaGCoow2QOglfhxob28jd7BdBpO3N5HY6LTFHppqp21P5vOf5J3/0uIw9MPMxUylOx3lu0nUmpMJ7sxZPYNSoWzIVr711PyfSRslslX6hV7GZ2wBTabSuPbXufHqO/sex34dxLrSVOOUtNiUZPiIxwVWJKbhcWuv0elhjkg45GJTX8fbr1QmJOw/h+eawogYI4n+WASsa4usgR+CAPdwSYEPZYom9xxnfJXZ6K3NXUsJxVIyLrD9u5H/YiqZDSJcuDbclALDipXmenRhO4BU4IgJbapwqgJDW46xCtSvtFFUgpbxNppG8g== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d00f7bfb-b85d-43b7-6e6e-08d8428e2a44 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 09:16:03.6395 (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: wgUfPLKdywfTXACqOh6LGTlGQMg8/adLWNu3pT9h7Q12kZqAGeUrHG/eyEifQWbislegY5oyiHDNd4V5dhBj1HILpU8M0e81O28OxcJ3hUM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass client-ip=40.107.14.107; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/17 05:16:12 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 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_LOW=-0.7, 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, 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 --- 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 Mon Aug 17 09:15:43 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: 276353 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 EAAE3C433DF for ; Mon, 17 Aug 2020 09:24: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 B461C2072D for ; Mon, 17 Aug 2020 09:24:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="BgHtauMn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B461C2072D 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]:44822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bNx-0000x3-Ui for qemu-devel@archiver.kernel.org; Mon, 17 Aug 2020 05:24:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFc-0007Yw-7Y; Mon, 17 Aug 2020 05:16:20 -0400 Received: from mail-eopbgr00134.outbound.protection.outlook.com ([40.107.0.134]:17743 helo=EUR02-AM5-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 1k7bFY-00086n-Rc; Mon, 17 Aug 2020 05:16:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fK40/xz2tj3JnEkwg3C7b87Ozclb3xuKwW6Qe96XBm3s4wRPdYlGoiucx/e/QLpLCmQvCbAj4C2X7Qw1aCG4uY0tI76KsP737eZUFuK1ENWvSbPbZxs5wfw2gP8+QvwR9A+nFAxvx2u83cFQqxXY+y8d/A4iA5UrX2/hJWXZufqVycJyW24NG7OgjfkPr9HjqeCvaBijxn1l27UIN+YHGTEKPFbptZtiiJi7rl4UuNQ6ZMmfKAxg392kFwV3x2cPSnrxB14gUvhZhwF8Bd7Lwo82qFAq5N44Pu3x96gUWeKIQNSJo2Ws7E/1Fi20XZQdgRbD8/2xgccVckxFzCAEuQ== 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=Zz3PNqV/8x7xs9tFUITxLc+oyViWGfRWLvj/N16jTtw=; b=BM1JQzvFpVOYMDXh7c0Gd36A0YGgG2PsRqqfiHTNxXgq3AjjaHg7ZwtOEAAttOe98Zdc+uKETnaT7Ikw/sfPG+e+SQ0HtLMosE2oIWLEcyfoicSpfBq0pShxBoNpt4YmXsPchmVNPe5Cg8BBejxdykx82/OpEnNpQgeknVT1ICenCxFlSWJVU098O42UoxTx6O7y9nFRxVQxAz48kdbu6wSMrTTz8SKCwn5O7U9JgLhe7WLGTh8gHJlW/ptaRRPExs2Kayo+Vsd+2OMqNsi+DqYSYY0tufDqkwdMGAns6quHSHqB4dgcrNq7Q6lKMmuyZF5rJ5YzDDdZD8gpVJx5KA== 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=Zz3PNqV/8x7xs9tFUITxLc+oyViWGfRWLvj/N16jTtw=; b=BgHtauMnNisOQKJB1cAe1dmZ7v1Z+vBCUKl7Td5QYRYAr4WdQDbBsJ8MbSWBRLC32n5oNcamjRWvhWlybqJUMbCFgUe3Xk0fXLUeYIhwokEMOKFMXGLXKkuhwJyYL0iqceIFR4ScLDNQF1t+3F0qN1QQzf1aYl934sbVboeFO6Q= 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 AM6PR08MB4852.eurprd08.prod.outlook.com (2603:10a6:20b:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.23; Mon, 17 Aug 2020 09:16:04 +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; Mon, 17 Aug 2020 09:16:04 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 02/12] block/io.c: drop assertion on double waiting for request serialisation Date: Mon, 17 Aug 2020 12:15:43 +0300 Message-Id: <20200817091553.283155-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200817091553.283155-1-vsementsov@virtuozzo.com> References: <20200817091553.283155-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) 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.174) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 09:16:03 +0000 X-Mailer: git-send-email 2.18.0 X-Originating-IP: [185.215.60.174] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 664b7d9d-6606-450c-d7c4-08d8428e2ac7 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cNl9UXz8snqf/XzLhLselE+DLVsddtj318JW37/CQyMvG3yRBOa6gyGEvPLJAb0CWgo4UXZUqWhnHnoOduwZTBGYZMsSks9fmMryxJ/KeSE3r3mxRJgZMOB2VLApFcO4rn9+xkRMHSwhGczOv95C1cYutID2/Xj+XoGO1TWKOV+0JwfoSRpHJSMZfFwPo9YvkB8S/l3TPsRntqr1uZxWkSNBZxGP8Q/XYfZzPJop/s33iwqpcWgxVhsdoYAUKARYTdmF/KPmxl8zFQ4y7p6jJjrRwzZtVCMewEGOBJqG/vyiny3WIN1IH7BXSy6nCVrnYLzDhR3ouzhaQDtcXj4SJA== 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)(366004)(136003)(346002)(376002)(39840400004)(396003)(52116002)(26005)(86362001)(16526019)(6506007)(186003)(6486002)(107886003)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: XEuwD2EsrIkVOZrPPvgxOBZgvYrvtwnYm7F3mFrypUbD3NVD9szIdBN+DF3UYTo/471XYFaCCq6PVW8jvSsiGhmvXJ480nDBml6+uZMlONoY3spCT+Ci55Qn4Pm9g1qhkwV0NVSoaHl6xzZ7X0SuKjVuyULrqa1k+6Qy+ZxoVTQs7luTx+RTvAeKd1jz8XomF+2WfVC2MlFtKDWwd02RHypX/toZxiTstyNHxTfDWTqak4jhdKPboQiWUCJYjMfZWJBIz5J24yMBl4J4e43mW5xwsEcMyeTbfLq9jbsnh1IgRgFUU/EKw5GJqMTW8qgYuchTj5vusfbIOsvqGyM/BTZ5u7aVSwkXs61uRcbe1LsyA/+eQq+3yAp6Xeg70kLhpHMYc5dhAEFrpVX06I5/kmCkPiEPqj79ZXFIrvbzO8qka/ODX5CEEvIAEZ5ROsN8uEByik3DwTApUZyQ77VNEZyTYz/p36D0u4iza6KRrgJAGTHBqWLcCr7lTBOksq9gKk9rhjuRfiPycnCLj2v9/rS9xNgdUtyl1mBQR9woxxc6fg4KPKN+uriOPgIqGAkz+T/hOeIFoRD6s8FbPHeu/yR4rVWFVwTZP+kKwWnipvs3nTlAgM0bpnVMyktlOyihK1+FBLdxaDhnIW/JC1nVAQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 664b7d9d-6606-450c-d7c4-08d8428e2ac7 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 09:16:04.5067 (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: Nc2qAHr8IY1P23drsAzYzYupKlv9SkSnXvVLZ4devrLvkz4ZbVa5B0eriyswQe9P6PpgUM/EyeDEuGN6+K1lZTEXlro++Wc58Cc7av41fPU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass client-ip=40.107.0.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/17 05:16:04 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, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The comments states, that on misaligned request we should have already been waiting. But for bdrv_padding_rmw_read, we called bdrv_mark_request_serialising with align = request_alignment, and now we serialise with align = cluster_size. So we may have to wait again with larger alignment. Note, that the only user of BDRV_REQ_SERIALISING is backup which issues cluster-aligned requests, so seems the assertion should not fire for now. But it's wrong anyway. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/block/io.c b/block/io.c index ad3a51ed53..b18680a842 100644 --- a/block/io.c +++ b/block/io.c @@ -1881,7 +1881,6 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, BdrvTrackedRequest *req, int flags) { BlockDriverState *bs = child->bs; - bool waited; int64_t end_sector = DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); if (bs->read_only) { @@ -1893,15 +1892,7 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, assert(!(flags & ~BDRV_REQ_MASK)); if (flags & BDRV_REQ_SERIALISING) { - waited = bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); - /* - * For a misaligned request we should have already waited earlier, - * because we come after bdrv_padding_rmw_read which must be called - * with the request already marked as serialising. - */ - assert(!waited || - (req->offset == req->overlap_offset && - req->bytes == req->overlap_bytes)); + bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); } else { bdrv_wait_serialising_requests(req); } From patchwork Mon Aug 17 09:15:44 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: 276351 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 B9AF0C433E1 for ; Mon, 17 Aug 2020 09:27:50 +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 843D22072D for ; Mon, 17 Aug 2020 09:27:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="FpCL4Wvn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 843D22072D 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]:60466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bQj-0007HQ-Pe for qemu-devel@archiver.kernel.org; Mon, 17 Aug 2020 05:27:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFc-0007aU-VC; Mon, 17 Aug 2020 05:16:20 -0400 Received: from mail-eopbgr140127.outbound.protection.outlook.com ([40.107.14.127]:35534 helo=EUR01-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 1k7bFb-000882-5k; Mon, 17 Aug 2020 05:16:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=arNrKFZEkCXjSkx3zubj9RmTLFFCEvjUFPaVzbPD0l1+CqefdlhOiAclIQdmHjiciP8ggaL9g1V7Pihgx33VZKJdH+Qv/8D09EKuiFx/qdW6V+5o09BmOGOTDF/SiAVIeAKyD+cOEZMrLIbNCbp0H9VpOdwdMB4yo1PeP3olb3b5f5uVYpcSNi1+tQZUTgys0Petp08hw0bCybACPLScug/ROPAJ2wPMzCF9ANgr5UeAKpJbHZSXJnVow8FQmYJv02juoSXdcBOuIkDcqPkwDzFYoAnhDOxIkIPgbhLd71JKdSS9EKDv8K/sFShQH/ew51vRy/y9hFizVr4xn8oSSg== 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=iXDFfNM+00P/Utkg9VuRM+rFJ70ahGKT01i9Dd15Hrk=; b=J5OHiI+HbK9YcXl9oBwIy67dg3vgk5uvSF8kK/YBzfytAvwKyWxxQfdCnbDPcQc2RNnQCAYR1q2MAbyH6MF0PCrmRLpUoqDR/DcjsssgeO3QqGYECj8NxdOtEESlzXB1+krNyghs+06W64Q272x8bncZ5Lb3lAMX99CSarCHhbb+cF/F1itm7XoZbqGXl14TBgkgOcvd9wSthAc12i55POFW6L7kpNb214NqoUM3FQZTz+tb8YWDcbD4NFKehwiDKpu0wlgjvx7oGbMiNSQ49Of+SowaKnl4RAIsF3nyunocbgCykWKloC+A6U7aFhUIJg4BF2shKnsxtR2OQR/JxA== 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=iXDFfNM+00P/Utkg9VuRM+rFJ70ahGKT01i9Dd15Hrk=; b=FpCL4WvnwNFXjzPnImCmYSyp2EspiIOQepnsBVoDiWhbw8BLP68oHG8PleaSDgK/wTbXGLTExqzb5x8p7+bOAW8Iap/80VBs3+HfurIweFVPcmg4YKQXufM2o9b7T1FbUXqciK6G+PS9K1VPQ5t9RV9CSvvoUZ14D+3YUZzWhrc= 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 AM6PR08MB4852.eurprd08.prod.outlook.com (2603:10a6:20b:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.23; Mon, 17 Aug 2020 09:16:05 +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; Mon, 17 Aug 2020 09:16:05 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 03/12] block/io: split out bdrv_find_conflicting_request Date: Mon, 17 Aug 2020 12:15:44 +0300 Message-Id: <20200817091553.283155-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200817091553.283155-1-vsementsov@virtuozzo.com> References: <20200817091553.283155-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) 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.174) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 09:16:04 +0000 X-Mailer: git-send-email 2.18.0 X-Originating-IP: [185.215.60.174] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a735f2cd-e167-4540-477d-08d8428e2b49 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: 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: POdF5Za9g4hoodApX7WqGq4noRhs3CoxwseOOZ9rV6IzTatc4medjGhXYT1usx3BT2rzxzUvMXTA39rfyNd77Te4IrO5BYyHe2ZeSLSK25CmwKBzH6hCAyu8E6v6jpSfbESGYWnIwHcgDGGmvqLaxHse+NaJLEWZ2ODqbubQVLj8Z9ZBIGFuzJHUlXjID1pWxU8Az0Dx5xzlNqmYg4SpkUz3C2XBxjOndNyBWBt92xdNXoulILS8nUSHkp/Ji16OmayD1QNCFQNutW0LUf/COiutEcqQoC82belOpj9bl377MD+6fjZ5uhX40o4L5uuNd6AmSfIftLNp5e1wRj4WCg== 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)(366004)(136003)(346002)(376002)(39840400004)(396003)(52116002)(26005)(86362001)(16526019)(6506007)(186003)(6486002)(107886003)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 5NAHUiEZcvhUXFLCPpVVXDibSkexs6G+KasVqdmC1nN6jq86eRUka2PutxdByeTq7S+a7D7BkDvRexltw1Zy4Mintt9c0V83W6KOZEUGU+XfE1c4exf3S5IT0yk1x972uqI6QKY+lhsa3iK2YftUQjPt2ZY1FsYZAShE24ONxGva89MzCUpwVthYZXtz46vrqDIH72UQgmtvP3ZSOAaPKud12HidzSjFT6j4E38PM0cEpC1yGpZGCSyEXqiHVY+hyFNcerwKmsC2fm/Qcrsc2w2d7abzUmI9oBVDEg4StmqEQ0o/njIjwW9Awi9E1T0qq+CtHXzWlbiQtgpJcbTEm8/DzpM+SrigAFZSoDBfCrMnNNOeRHwvBO1+Up0X7ELcuCilSJB54kemxx/jDFyCoPUPrij0wwk2h1b8xC6gY1ANCEKMyt7n9xIW3JmxoE47CvE4Nfclxm1VLukIZ2JbG4K5CdtQ0PnIUHCwG7LDg9elxPDSngtApH8IlQllyEdKENwWkQ68h+x/njUCyQn+oL2kwIy/VYnaWPvjl08qdJThV/vMmjN5HySN9EzEEAHp0lpLDXwPGUM1+WmcMpGfIwiPk1Lpee8qBmt5qfb+RUR/M8MQhhKHgVtoGyl3FdmId++4+3YrvW+yvtF5o9DkTQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a735f2cd-e167-4540-477d-08d8428e2b49 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 09:16:05.3241 (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: frAU6cCqFaUYHMag/Q4+Xb/qSe2d1oK/Zt0LLVgMT/Qu8HJrAjoJwRORul6SsE592HmqRKIzPIRfhJGnAXbCU5XI8Dd4kcwAkdlPfYe5GZY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass client-ip=40.107.14.127; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/17 05:16:17 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, 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 --- 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 Mon Aug 17 09:15:46 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: 276349 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 2257EC433E1 for ; Mon, 17 Aug 2020 09:29: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 D1E6F2072D for ; Mon, 17 Aug 2020 09:29:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="s4pGAY47" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1E6F2072D 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]:41564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bSn-0002ay-0B for qemu-devel@archiver.kernel.org; Mon, 17 Aug 2020 05:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFg-0007hd-0n; Mon, 17 Aug 2020 05:16:24 -0400 Received: from mail-eopbgr00134.outbound.protection.outlook.com ([40.107.0.134]:17743 helo=EUR02-AM5-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 1k7bFd-00086n-VU; Mon, 17 Aug 2020 05:16:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lxazwGmwxuzldJO79KxPVf2HE2Bmq5JsAhueYx05HXXp/S9v0mRHkfp/ejHFzZeKEbk2UdWuq9etlnhs/YJR8X5Yu5NAIAcDS8yK5s4EZEFyzUdZ3CqhWQAhh/AQVBeShevnENgqMQqQqN+D+eVcYdqSdsJ5jPfdhAIj89fE97/RfEJV1hsLoPcTNjQMEFATgVsiC396F61ysL/ZA1/YTvaJQHQVekO3K9Uz0ZZ9WFZARsacAD/yS6f+TsPcNaQV1/pfkqvB9dey6oB1+WXYsykOMKVulxy8uhi1M9yGCHxaG65aTD2t4LJsWC30XP+MN6bQQeHivIX+X257gFWJSw== 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=U7IEKRgVOtSDJFcE6H6Cui/rat+AChaZmS1cN/FnBVk=; b=LMvhvYr7M9qYQaX2zRXVHQRl0JW9CAqOjmP7PnFUlA0rvNBS3xi+ZIhrvC8O0TRs87d52/Ioz+w7wTRX35ApqZb5QbhFS/CMbdIq+TAwDAVTvw65E+uuu0TZmWFCTmgEa4DugJXGE3jsBQQi++syCUptXTXEHkonKcBxBzgytGv80CETQYqrrjvvKGvTVm3Yec/ntg4cMb7yMvaV1z4kgZqS7xm49kI+ig6As2wtJkGJtH4A4L2cYqAHx4QS/4LXSf4sN7g0px2/1TIkF5n2i9sYN0SEqjjWOq8N7jv3JdJS8LG/oxbMptkVncWhVekgt1qKZxXFisNBlTc+v4WnNA== 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=U7IEKRgVOtSDJFcE6H6Cui/rat+AChaZmS1cN/FnBVk=; b=s4pGAY47nlmbmD8BNq8XYirc4SR/zHD9wamU1u/E5trg019u/cctvW7BAQkjCGx//yaOffILaZ6wqe/mS5d44oTZ1kIxoVynkx6u+JLPqglfH7/KXspMTWeSSJFU/FC+qNblPy7pRzCFT5YkseGb1fdd5UDJcY8zkqlM03Y62hQ= 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 AM6PR08MB4852.eurprd08.prod.outlook.com (2603:10a6:20b:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.23; Mon, 17 Aug 2020 09:16:07 +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; Mon, 17 Aug 2020 09:16:07 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 05/12] block: bdrv_mark_request_serialising: split non-waiting function Date: Mon, 17 Aug 2020 12:15:46 +0300 Message-Id: <20200817091553.283155-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200817091553.283155-1-vsementsov@virtuozzo.com> References: <20200817091553.283155-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) 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.174) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 09:16:06 +0000 X-Mailer: git-send-email 2.18.0 X-Originating-IP: [185.215.60.174] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0b407c9-6c90-42d2-3007-08d8428e2c92 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: 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: dbgHYl5PptfCbwXiOUeJv1iOd3fqcpbPeNzqWtAPt7F9D6ajI25fyMWP7F7cJAECwlWiDYhFNxdU2DVJN3vC0lwyFX9CE5TxW+jK6tVYw03O81DGpX33lGOule1xrvIwbO+19kYNuWywqWEIBkXBhUyrIJFu87s3y4CZhgrtuXPJDZ8NSvbaQtUir9Naf3leoCjltx3r7HgaqepGuwqqCqFXUasaW99W4DyCLS/Gcz2sGn3W0n86KJb8XXyyCZug3I/+IsZpi9emSBAR2GV+I1uFL74Ope1o3qqpB2u8QvzeqL5n4ZNsZFiIxjqaYRpbXghwXUbiL2I/yZqg0xhE5w== 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)(366004)(136003)(346002)(376002)(39840400004)(396003)(52116002)(26005)(86362001)(16526019)(6506007)(186003)(6486002)(107886003)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Ch+u5RhtRtG3cAvyYihbMt7CTTul4ZGz3COO2sjcDmfmJCntzet9wrJc3s7HvyqZpAwrx9ckuaFPKyIX9OFjHLnIILV9RVXs9uUTu3rVVkXpFIDwbE7zoZwjwoTBJXkcMbPdW3m50YJS/0m8pPIZKh1GmtYAr3GdzcI/4V9U9DUdO9XnNizDfvKTPD7+iexAQxbIRrAMkxNUb3pO2ajJ5he9k721/i3aiulpPuUOzWU+V01CdSSPi6o6qkfNbyR5cNX5NDaIS3Ak4XgWtKaX1pNLe/KHS1BhShqMmLg58nmeJQzIS1VNdmk1OPEyCgG+mdVDqB5isjXxzz2kxt7CuPq3gErw/zzGWxf7BKoz8VZ8cSU4zSaNupLSReVHna7KnJgaZEVs28+efIGHnKuCsn1Btz8KeWjwHwv0VaGeNAdIjXd/HS4kwcI1WltJXCGWRvW5v1ylwWMQaOM4onmt6PDe1F6f5gTrTPuY0bY+bwQ2k6X1mxV5hp1QvBIWuap8qZ8MRQbcuPofKPbJXAs6z6IYG+4fTLELVsPMVlVQdLXTIwyxMVTGuipeFuL0WG+ZpzhUzgQim5KsaAXUsg50O/q4qKye9rITOWJ8eYowwktaN4Wc7FpII3U6Kgg9RgZc3pmGme7Y9HpuqBvFXCKjQQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0b407c9-6c90-42d2-3007-08d8428e2c92 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 09:16:07.4667 (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: MOiw+OCqR0gjkAggvXvhDb/sw2+LI17bgCiZyRE4+5pxT6it8zIeYzUdJJTb1C6rbGM1mSE2/WPt7rrKQocHlCBmDxTYvwAwp8u4VykQAVw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass client-ip=40.107.0.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/17 05:16:04 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, 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 | 34 ++++++++++++++++++++++------------ 3 files changed, 25 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..96b1b9cf5f 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,20 @@ static bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self return waited; } +bool 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 +1502,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 +1913,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 +2079,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 +2193,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 +3357,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 Mon Aug 17 09:15:51 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: 276348 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 6B0D9C433E1 for ; Mon, 17 Aug 2020 09:31:34 +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 35EB22072D for ; Mon, 17 Aug 2020 09:31:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="wm43KZ+L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35EB22072D 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]:45870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bUL-0004Qm-Fs for qemu-devel@archiver.kernel.org; Mon, 17 Aug 2020 05:31:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFs-0007vN-HI; Mon, 17 Aug 2020 05:16:36 -0400 Received: from mail-eopbgr00134.outbound.protection.outlook.com ([40.107.0.134]:17743 helo=EUR02-AM5-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 1k7bFq-00086n-HO; Mon, 17 Aug 2020 05:16:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDAqh/w5b0Tb8k0sKv/6GrSl+KZqIFVYORaxBaKs0R4dAPKHyIzgo5941M+bihDxh4d57HUm8HFs+Lq3lWNaBvZbLWCqtCNmP/UqSXTPLxB2VpqPoT7/eDkQacxcMKUM4kt7L9ECE/+1ZenNgayp+3XvaTAM4RlQbvzfWOngT03fbOXCCLYY4m0wskAHs3EtCNFb8oRt2lTxH7VvRBvM3DwOq1A+735VV9HFXRlUaJyM7E/0aZ3v7wGklmAKCUcC5GLCQR0HTVQOihkK+EHxScjPGrOUnMSCQiDjFFwgIDwsfVLmB0qvZ648yjTiQsqEqSrHZ6Vqk95HfCwJfJepYw== 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=V8WR2ArAGOWsaIurcI6UsqgkUBJiqiJn+0b+w7wC3HM=; b=fDk0MW96wS0vg2C8SfYJYOCRpFL4Hcr3v4W4omnzQbMKdSW5M4X6jA52GoF2W/fK8JzYaD9CFl4uSJKyuunZNFvX5TaG4zI5FBewJrUBpTOD6qFnhryolNgcv0vflRoSEHxQ8ggSucgJhJAEGgzAxcot/kAnfLjsYQsueO61M12Ni+022oCCJME9dIkFFRzEHU7dgZ4yA23WYtPZ9cLGrqTcTIfF+RHeDCzLafvzzE/kLemfaCiDJbjzuXJyOGGFOV7D9vLTebSjObxP6MRL+8eyy3N3RCooFHIpgp5siQs0+0qB323/UDeDnaAeH9r/2W2OfrgSBBxU60rEeo0sWA== 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=V8WR2ArAGOWsaIurcI6UsqgkUBJiqiJn+0b+w7wC3HM=; b=wm43KZ+LBJ6XJwwnweJE+VXw68L0Y0V9fh2QBnf5kysAOoLPKGFIa+dSFH64/18EAn4HvJyCXVS2oM8sYc8pRD+nlqA+5ofChud867wWbJhqaAgvVerOuUNWEUoZTc+yrc6d+9Wwww9GzJjXqttOTEfCx9Fbz1Oiok4db/EYRdU= 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 AM6PR08MB4852.eurprd08.prod.outlook.com (2603:10a6:20b:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.23; Mon, 17 Aug 2020 09:16:12 +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; Mon, 17 Aug 2020 09:16:12 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 10/12] iotests: add 298 to test new preallocate filter driver Date: Mon, 17 Aug 2020 12:15:51 +0300 Message-Id: <20200817091553.283155-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200817091553.283155-1-vsementsov@virtuozzo.com> References: <20200817091553.283155-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) 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.174) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 09:16:11 +0000 X-Mailer: git-send-email 2.18.0 X-Originating-IP: [185.215.60.174] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16adf9c3-f97d-4b1f-8379-08d8428e2f38 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k14DEO9FFIEkHaMPW2UIU5OHikdYYjI+rrlMzRCwZbNMDwsNLGFmaYula7m6lwsPelwBYEU/kBIPTZZWu50cN+afx0sDBRAojO69q4VSHh7Q/m3qzgqD2s5tq+HC0B12FinZZ1wDRf9kWzErsMFVkt0KglHD/92AzW4l+CaoYHwJNNREtgjaIYKLhsh9YjFZuYEa7e+6rm9DtLnWTsSllVo6h4u0yj+2BdBbuspZiFptzAoxRGfBwyTTdwx7MS9V/o8COmMhQlMAyyxdrDvukzv81Dov10MOTdFjjjHdvaBEUKCmoVrMh8CxqZIqBSp8M30Yf0l5lxyJjroyYk+4OLxybyRxaAM0pUr4LeLsxf1QHGXiSTKQxhjk8TGhdTjCRpo/sTd1p8VZJvJ5wuvdGJ4n/nsVv6W1p8NZuAw7BPhlPkDCWzQ6fRpbDySnaXVsprTn7BQlLhJ9SjegpJ/uNYUCkLvYyYC2jm7+9FbUq/U= 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)(366004)(136003)(346002)(376002)(39840400004)(396003)(52116002)(26005)(86362001)(16526019)(6506007)(186003)(6486002)(107886003)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001)(2004002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: DjNa6oaH60jhu+R1hQ1CpfZZIGZxlGUVQCBZW7TcEXYu0KNrC+xi13/IzXeqw2gc3eR24dXcznOPfmN24a0umgUE+DDqYJ2bZk0Srt+/+z67KwS+/4sHmK1t/1b3yF2nAJVVmU7IPPJbWjxCBMjDaxTyJAcZZl0xuwRflA6puFt9S63mq+/FmhKfUnaaIodAP9cSco+GPPPDhfVnaCxOXWju03Inarr4d9XIiI8QK5U4NNyjKXHrmlWk1LP48eG0ije5M7Tnfg9JA4qABhZ8L+X3EdYBXdWc3K8iGsbwEDJ119smK641VqwXIHLB9XiSitTiyYDgIj9aaA6FntAINg13wom/gZ/kS0Q64QqziRC85uUC38kRfzuAy8Tf0oMJCFR2ir9VsN8UNey30gpCB6jPcwomFaXsJDaGEeq+RZdWw9llcMXKSYVnXOAOXJhNd4fUb2ECrzjqdC4X0a/8JrCe7utQEfs8+TA2jSBbAoxnJFJImEl0hJoAbVXDbunaWaHX15wScfl2wRxtI/+gPpprXnJVH8AW23DKkJc99DU7xgX0KuiQguKD2SgvHifn3qVSSMhgKM/e0+sA57DmwVGDSNkESBMMFYCO0cSVUo8C15LHHFa10Seg5PGWlTXCSpueOQj5N/BJhbOCWFGudw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16adf9c3-f97d-4b1f-8379-08d8428e2f38 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 09:16:11.9440 (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: hmpADsVXE0+LeNRsfjEpAblN1fBULrhA+SsImIceiVWLNuXJTPdwl4F7UsOBK3HLks9JwnKT3SfPKginuhXZDSQj8X14h/Hn365VwYpKhpM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass client-ip=40.107.0.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/17 05:16:04 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, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/298 | 50 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/298.out | 6 +++++ tests/qemu-iotests/group | 1 + 3 files changed, 57 insertions(+) create mode 100644 tests/qemu-iotests/298 create mode 100644 tests/qemu-iotests/298.out diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 new file mode 100644 index 0000000000..4f2087352a --- /dev/null +++ b/tests/qemu-iotests/298 @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +# +# Test for preallocate filter +# +# Copyright (c) 2020 Virtuozzo International GmbH. +# +# 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 . +# + +import os +import iotests +from iotests import log + +iotests.script_initialize(supported_fmts=['qcow2']) +iotests.verify_o_direct() + +size = 10 * 1024 * 1024 +disk = iotests.file_path('disk') + +iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(size)) + +opts = f'driver={iotests.imgfmt},' \ + f'file.driver=preallocate,file.file.filename={disk}' +p = iotests.QemuIoInteractive('--image-opts', '-t', 'none', opts) + +log(p.cmd('write 0 1M'), filters=[iotests.filter_qemu_io]) +p.cmd('flush') + +if os.path.getsize(disk) > 100 * 1024 * 1024: + log('file in progress is big, preallocation works') + +p.close() + +if os.path.getsize(disk) < 10 * 1024 * 1024: + log('file is small after close') + +# Check that there are no leaks. +log(iotests.qemu_img_pipe('check', '-f', 'qcow2', disk), + filters=[iotests.filter_img_check]) diff --git a/tests/qemu-iotests/298.out b/tests/qemu-iotests/298.out new file mode 100644 index 0000000000..baf8f8425c --- /dev/null +++ b/tests/qemu-iotests/298.out @@ -0,0 +1,6 @@ +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +file in progress is big, preallocation works +file is small after close +No errors were found on the image. diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 025ed5238d..ac4772b43f 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -306,6 +306,7 @@ 295 rw 296 rw 297 meta +298 auto quick 299 auto quick 301 backing quick 302 quick From patchwork Mon Aug 17 09:15:53 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: 276347 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 40EACC433DF for ; Mon, 17 Aug 2020 09:34:12 +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 0A9DC2072D for ; Mon, 17 Aug 2020 09:34:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="f0ytYKyg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A9DC2072D 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]:54314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bWt-0007uR-Bu for qemu-devel@archiver.kernel.org; Mon, 17 Aug 2020 05:34:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFv-00082s-DR; Mon, 17 Aug 2020 05:16:39 -0400 Received: from mail-eopbgr140127.outbound.protection.outlook.com ([40.107.14.127]:35534 helo=EUR01-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 1k7bFs-000882-4b; Mon, 17 Aug 2020 05:16:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YMCFrolTsS+Wnd2YrBd0ndDGShJm4YBVFCWbAN2CpRpOa/pRGLrr07ZNQJ16bl359LygTtoOwt2cGKTjvB35ntscBvppJVIs40hHlL9gzZt6pcAwrmUWs5LIldz/QbTuMtBpiDe4c+aLeXF+3YJ2/UlKbLdB6MufF+Gxvl8JPFQc3mOQ7KQqco+t+sB8rnQLV3ZD2/2JNQobTnazOQtXl+eOlbytKy0JbiNpftbCgM3iLNSFPA++aQpIfYPv9Z6oHylOmxdnJE7fGooPALf/2rv2IXitZQUAel2jX0HZVpw78cErXBuUUMSRToZ77xboScy7B12Wi0r6F++ZJV5BRA== 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=9umXax7o65jnZOIGs4fX9mg1dWtR2FDxxk8CWQKo7B8=; b=hYBGlxB4kWjMZt7bwBjsPggIP1lTz0FNZy3PAzSL+8TNsdJrHXdxpDXye+5LzvFFPDZlwP8BNbjNYBF09KPjeTG/zGTsPq1iSqLQuq3xyUsuQ4YyfwJOgyiAQHXiW9WIm3RsoRO3azTnwirFjWLXWD7xyJbdd2QB77w05Y/P7grjo0xIgIIiPiMlih/A9eV8bfpP1wgvqNua9FgnUrXTBru27x2FwfnQ7YmhHckWxqljuWQj6UmGdLMWsy+IA9JTJBXOtCa/6zxS39GupAM9s1o2HRL/lMpXVjNQPJkzFV+d5FqYUa4fKWuNH+1djRk93jCXYEIGt8B/tUmbY98HdQ== 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=9umXax7o65jnZOIGs4fX9mg1dWtR2FDxxk8CWQKo7B8=; b=f0ytYKygTZ4i+3lSIk5OlxMBV3/LTlnlJTSmsBktEXfbLwx9RohMMJwarQELIFZuMjihDXSe/XarBJEjTJEbLPXDtOig9fnQqsGKYsNLMfNkkabCusoKSRV9PYX4Qdv3rGhCJ/vYJi0cR5bNEENUBtt992xOFmJTGFdXiTyFvXA= 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 AM6PR08MB4852.eurprd08.prod.outlook.com (2603:10a6:20b:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.23; Mon, 17 Aug 2020 09:16:13 +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; Mon, 17 Aug 2020 09:16:13 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 12/12] block/qcow2: automatically insert preallocate filter when on FUSE Date: Mon, 17 Aug 2020 12:15:53 +0300 Message-Id: <20200817091553.283155-13-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200817091553.283155-1-vsementsov@virtuozzo.com> References: <20200817091553.283155-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) 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.174) by AM0PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 09:16:13 +0000 X-Mailer: git-send-email 2.18.0 X-Originating-IP: [185.215.60.174] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a351dfca-edaf-43d8-bafb-08d8428e304a X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:147; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9+fTdxWIfkf/FKu21duaEEOoO5fs5hDNrmHMz1t/yD404NncxgUzzdYJYsNnk9fNgkluE7562gEJXneQEX3aM0x2TNyA2Mh4sPlNsR+5ZB5xhD88uwyrkr3AXUVKMaoJ8IdXCQvrC5ltxf0C0zYz2FK5jODQ1o0p0HuXyGCR2e0C4YsiX+WU37Lj0R3sWm9Vj94E7bIH/p6/kUFy4/8mlkQFIQ7u0rGotuI+wdDdjyGzC+HhGwILBo6q9ldH4ln0zZD9hySaujOz4KumD6A6YUWzpbTIf5VYdw5LqZgNdGvANwQ4qaZktjfUfjIcn4Lb4skpGag0wy8/nCjPfaJmUQ== 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)(366004)(136003)(346002)(376002)(39840400004)(396003)(52116002)(26005)(86362001)(16526019)(6506007)(186003)(6486002)(107886003)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: nPc2WCf96fFFr6tRi9bqKiJ2GGClIveXqenZKcWzfac10p+cCBQY0+pRkdaSj0pyRpWXiMvf2oNHzBoHXncDZDX18f3NNBxLD3yRnFPnLhiO6bi0R4d/+peZbqE0e0ES+UMexyNDA6oRfyisziEZoT+wetPH6gP63B7sY2Ul8DHdgBGUB+HvezC6nKt1o2wRzEb4b7MfVn+laOj4a0GgEopZRU2G/afl9so+j+2J9Oh8/FLidpTQdnQ+PiCux5haHu14etyMIF4sLGQTKxTMPQ/jmRrJyVh98SvctdfnIDP/kiW3W40xAfBspFbbsg+ICOBIfhiRAN4ER/yvqIZzTztvxn1woqCdGJaRxjR0ziA8UuawdzGhk6fcEhRieHAERu1RiNW2BIqrijiI8g+Ymd6k5FNnTvfDVHUSDjJCLpLPvGUCEWoXrrRuBa5NRs72M4ZMIE9NWpNLrinQ/pdf3LLZ7r+Wel9W6Rg/X2vLL1Qyo7VzeRzvP8BKnO5fmFtrHTMf+k99m4WsY1nlEjZM81Sm3VNKxzHCeOKT4rxRXcZrnluNp2gtwUxjS3Xp9cD8H3yBgZab3zBfBu6PD1OpxB2gaXTTMEkFGeWVzLDnkLhSpClmg/tY7tzTfu+ygYn9YwdlwlRxVs+OnF7SPIxq/Q== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a351dfca-edaf-43d8-bafb-08d8428e304a X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 09:16:13.7790 (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: Ni+EczDfT0UQ/RFcrUgP3m3KsLqkHLDhjpAoTAOLMGBOssi8X5cuX/55rQ7vh2wi2Dhldkdu+DX8Wpoc0qCUS0aPH3ChIaFNPuC9TwumJXM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass client-ip=40.107.14.127; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/17 05:16:17 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, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" vstorage has slow allocation, so this patch detect vstorage (I hope, we don't use other FUSE filesystems) and inserts preallocate filter between qcow2 node and its file child. The following test executes more than 10 times faster (43.2s -> 3.9s for me) with this patch. (/newssd3 is mount point of vstorage, both cs and mds are on same ssd local ssd disk) IMG=/newssd3/z FILE_OPTS=file.filename=$IMG COUNT=15000 CHUNK=64K CLUSTER=1M rm -f $IMG ./qemu-img create -f qcow2 -o cluster_size=$CLUSTER $IMG 1G ./qemu-img bench -c $COUNT -d 1 -s $CHUNK -w -t none -f qcow2 $IMG Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/qcow2.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 6ad6bdc166..f56507158e 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1868,6 +1868,40 @@ static void coroutine_fn qcow2_open_entry(void *opaque) qemu_co_mutex_unlock(&s->lock); } +static int qcow2_vz_insert_prealloc_filter(BlockDriverState *bs, Error **errp) +{ + QDict *options; + BlockDriverState *filter_bs; + Error *local_err = NULL; + int flags; + + if (!bdrv_is_file_on_fuse(bs->file->bs)) { + /* Nothing to do */ + return 0; + } + + /* Assume it's a vstorage */ + options = qdict_new(); + qdict_put_str(options, "driver", "preallocate"); + qdict_put_str(options, "file", bs->file->bs->node_name); + flags = bdrv_is_read_only(bs->file->bs) ? 0 : BDRV_O_RDWR; + filter_bs = bdrv_open(NULL, NULL, options, flags, errp); + if (!filter_bs) { + return -EINVAL; + } + + bdrv_replace_node(bs->file->bs, filter_bs, &local_err); + + /* + * On failure we want to remove filter_bs, on success it's referenced now by + * qcow2 node. + */ + bdrv_unref(filter_bs); + + error_propagate(errp, local_err); + return local_err ? -EINVAL : 0; +} + static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -1886,6 +1920,10 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, return -EINVAL; } + if (qcow2_vz_insert_prealloc_filter(bs, errp) < 0) { + return -EINVAL; + } + /* Initialise locks */ qemu_co_mutex_init(&s->lock);