From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656520; cv=pass; d=zohomail.com; s=zohoarc; b=kzNC0rNypc2FolRBkKCdtohaYwxAFkIOVimeLtHCeaXATMFAIH4yWQHnzmyKsq42nnDMxF0pPsHJ5JR2FQKu9HHjvsi19kZ/fNKBneT+ozWqDXvNcp5VhB6so+1nMu79bAvPfKknEDSTp79GvJ4Hhu+hscvVL4ejiQf/ikMS/Ao= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656520; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6m8rQuUx+OzptYRz38VBXXuVMUS36aKjqrnLFpM4dVE=; b=HlEGDEKKcOk4Cr4v3s2sDTJddB6cLocHDqSF+NO0SZmOSr4oBCiFP+QF99UUw23YHtXXO0Wb5Bs2mATaM8uUZPma0ZMLACVTObi/KSeRu82By4C96XV8zprr1QmghUeayXyWT/I5CjQohTZDKlEO6NvQx6pfOyz6K41J6plA45g= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656520027834.1029177360715; Mon, 17 Aug 2020 02:28:40 -0700 (PDT) Received: from localhost ([::1]:35826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bRW-0000Fr-SB for importer@patchew.org; Mon, 17 Aug 2020 05:28:38 -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 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 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 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; 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 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D 0x40, =20 - /* - * BDRV_REQ_SERIALISING forces request serialisation for writes. - * It is used to ensure that writes to the backing file of a backup pr= ocess - * 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 mig= ht be - * _DO_NOT_WAIT_FOR_SERIALISING, except that is too long. - */ + /* Forces request serialisation. Use only with write requests. */ BDRV_REQ_SERIALISING =3D 0x80, =20 /* Execute the request only if the operation can be offloaded or other= wise --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656303; cv=pass; d=zohomail.com; s=zohoarc; b=mfCrBH4d2ScOcFbiv5ekns0VNGJvxObPO55/gx8t1EqKRZ2RNWZcpE90VHCeA7wypgHitn42/U3JnJSm5NAT0lCMgktmph0ggUZkeO36OROMcLFdZiY45yVKKFWFNHDYODy/mwrlp2gsZrFUg+ncxezjQkpjyCJjtqkAv2d3lEk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656303; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Zz3PNqV/8x7xs9tFUITxLc+oyViWGfRWLvj/N16jTtw=; b=Rct/5Ue8av2PPSQQ/wccpyLHyIhp1gt930IDMfCihJfQV4TzSuYn8UvY4xBaOXz4T1dk0Kh0S/vh/6y1VzeGTwAdlVpecsrvXMdLgC4/P/g28eq2Z2u6ZyEWPrWcugnK1oE4Ue42Kt+IVvnGsvMN+yKAKNXH6a93JpRQIqkFD94= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656303339733.925903940772; Mon, 17 Aug 2020 02:25:03 -0700 (PDT) Received: from localhost ([::1]:44822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bO1-0000x3-EF for importer@patchew.org; Mon, 17 Aug 2020 05:25:01 -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 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 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 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; 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 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D request_alignment, and now we serialise with align =3D 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 Reviewed-by: Paolo Bonzini --- 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 o= ffset, uint64_t bytes, BdrvTrackedRequest *req, int flags) { BlockDriverState *bs =3D child->bs; - bool waited; int64_t end_sector =3D DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); =20 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)); =20 if (flags & BDRV_REQ_SERIALISING) { - waited =3D bdrv_mark_request_serialising(req, bdrv_get_cluster_siz= e(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 =3D=3D req->overlap_offset && - req->bytes =3D=3D req->overlap_bytes)); + bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); } else { bdrv_wait_serialising_requests(req); } --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656474; cv=pass; d=zohomail.com; s=zohoarc; b=dRq3M+aZdWVEvPg6UPszHHnZ/14YnHY6ARte6HlJAaveNTeQQJ947uMmq0rjx0cPjp3Xbj2xsq6bJMuqACaD7sD6MEbiSGaVJVHIL/lLwenXIXZI4USl5GUoGS8n32gJB+ScxH3tYISZcZBLBQIVoQUyWcgpJIUNeaVnxbYpRsg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656474; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iXDFfNM+00P/Utkg9VuRM+rFJ70ahGKT01i9Dd15Hrk=; b=YIrsSu0xf0H1RTDNdNhIMej2ER+lgLM9NGVc1nCSpS4vOeIs3ADki2oRORg9mcgWW0+OLCZSQ/AlFFO5/srgZ7uwRi7r/O5D+TkRgryW8NriCqWF269HvdZuobAhvD3xePtjQHFDyMaTSJEJa0JjgBaoMsXCKf+f0Oz9OI8NOPg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656474025543.4383728998085; Mon, 17 Aug 2020 02:27:54 -0700 (PDT) Received: from localhost ([::1]:60466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bQm-0007HQ-T6 for importer@patchew.org; Mon, 17 Aug 2020 05:27:52 -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 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 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 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; 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 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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(BdrvTrackedReque= st *req, return true; } =20 +/* 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 =3D=3D 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() !=3D 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 =3D false; =20 - do { - retry =3D false; - QLIST_FOREACH(req, &bs->tracked_requests, list) { - if (req =3D=3D self || (!req->serialising && !self->serialisin= g)) { - 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() !=3D 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 =3D req; - qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); - self->waiting_for =3D NULL; - retry =3D true; - waited =3D true; - break; - } - } - } - } while (retry); + while ((req =3D bdrv_find_conflicting_request(self))) { + self->waiting_for =3D req; + qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); + self->waiting_for =3D NULL; + waited =3D true; + } + return waited; } =20 --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656575; cv=pass; d=zohomail.com; s=zohoarc; b=hpwPsoy4T7g4aHqzAOfbfXnp8XVrqcdi8Aui3vaDfnL9yqGAYb0Oy0zDWHvQ50cvTPgN8N1cfbG5u3RWhN2fYT+H+8L0hNzm491/vfK8uOsKdlYuS8nNEUeVCGSEup5CPqk7jjYjuJpiAFVwDUd71Xh2laGNdUPtoa2t5cMj4ms= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656575; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vUbozMxC2ZtImR2CWdhGJ9Kdgdp0GlDc6J/ZRw8K1PU=; b=JyxdK4c3MD89MfB1qI115hUOTMvmV8Rl1DgtqrQab3z6RM7w57NlGSXVMRQMoXW2fVJlp5fOCq8RVZP4NGYSJC572CRvUqr0w8wttFyfJMa68yFNvzTfFD4Q9WxsCSpCs7jFK57Hec9g6VEbCdLn1lCatBHrOyOnzzNeJ/vio8A= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656575159277.1124826219791; Mon, 17 Aug 2020 02:29:35 -0700 (PDT) Received: from localhost ([::1]:39720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bSP-0001rU-LX for importer@patchew.org; Mon, 17 Aug 2020 05:29:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFn-0007jN-Jb; Mon, 17 Aug 2020 05:16:31 -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 1k7bFb-00087Y-Mh; Mon, 17 Aug 2020 05:16:31 -0400 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:06 +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:06 +0000 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:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UTNSVknADI1SA7f/jG1oSA0fHnn5VOt0Zwfap5WGFoiOGRVFS5TpXHgxYsHle5l/G/+bZ+M9tNZUB5xTQFCZks8725FnCMu9B21lEbXArK9V5MB+mghb+0daitXdiL4xsSutGe6J2H5PNv9qvCyQ/AnS+Gb0fJsO2Gh809Bld54nYE5N8XGPzfgGe1d0WO8BLZbDJ3vPYDIEtHSqobZ6VY3D1bhcX8dJYgHJNw8LNq7uWPcJNX9UyRC4apMxBVEcFSXc/b+/92jBxTGXvWwx4XnP7gyUT35uyPiexeH36m3SgaJ8vPrrDjrJJIwmy8vF8EzMhBmVGKfBU3bhUNpz4w== 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=vUbozMxC2ZtImR2CWdhGJ9Kdgdp0GlDc6J/ZRw8K1PU=; b=lDYOeKeLdgDfqQi7eRYHrIgQ1xghHcDnzGF0x1wieGTM08bW4ekJU7sRZ2zrzcaki0KICTgLebdCH+z9TCA2bZurmskXFpj3elYj3ByGYG4+44/Gk8/yofCGrJUwLw/03O3BYSgWOWOCQxm4nNyVL4Ve4lc9KXJjw9s7p2+IZEDrzDgZozZqDlJONLiMNAuRc/AVqRZtYuTfPy6j4+W0Ibd0bryuvU262AlwHqIlhKu2mMJRcebC9AbZLpy/ieS65Vhi7RJmSEBH3o1k0fdV0Tza5oTVSs9Zsfl8h6bEhzodHPXgTpUax4p/NL5QX89NZgz1AGxexa2+hWeopdAr+g== 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=vUbozMxC2ZtImR2CWdhGJ9Kdgdp0GlDc6J/ZRw8K1PU=; b=RciKEEpqBDVzxDkr9UrcqtNP1yA06Tt4+EiRELIqwJv5eK6YJDtednXLE7XqlmxZa/3lw1Q4OwdSvAHUWdRCh0rKVPWd6vjptJCj0vTjVCgNcN5bIA/mf2utLnvz1xxBcmVWPEd6Lhm5UFBOHMmCXoFz9/zETOp89QhK6xOx6KU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 04/12] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg Date: Mon, 17 Aug 2020 12:15:45 +0300 Message-Id: <20200817091553.283155-5-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 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: e15fc30a-5286-4535-6fdf-08d8428e2bc8 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tYIZnKFIEZik/ELNffhxfek9uovG27AgaFqejg8oxfNuRZdvGORQkmV+8s5FXps9HZsGLOBm1i5E90kmD+MMvylJqEsqy4sDOS6KjiAdLDoGeK/ODrCNDA+VYrTvkloCB/eR7RNPfQ6pjoMG8Yj1ctaUKTSnFmK5iVFJhjIu/ZZkBYC5An6sxT2lM0KsVTk1OLjeqq2tW+X/AZtrlQGDrkkYA9SQa0XRgYe6athEH2Co5vHTikQXS5LbWCb7YPIXEhGxmvYlQVu/kKdsTzY2IaxPVopCSqO/RcJj7fakWOWXCYmmxxG3K/zmN1qAKi7yWtVlB2PCjpKx6AJ3VHlTWQ== 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)(45080400002)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: KpsOHNFJ7dOhoaAO5RyhwIr7zw4/XWjqwxlNgXkOl7vhFDSS+HiKeTbGlTh1o4kVWJ4+4aOt/uPqJtgWU7QwkN5rCeHzdhfH335Yvz/G21JZtN6Ys9XBEGkCVJYPkoPocoqmBekpyDhkCJ92miT/UhpIMQ5lmJHTDGf8WM3IQHrOT3ULBcqF4C/bohODucTNkpUimIiGvjjIZBnN/aejjYDHUEwQghz+gh9Qlk/4oYtOrR7POBfZBIeWRmIs0KN/bRk65oi636vnuDQjZ61wMUL11ZZQIMCqNOrmzD3k5PvFugaLU3/kOVwCyZs2MPI4YYPgWoUflaat/qlJry19+OF4f3RaS8unhcR8ht2vDmW76r19phBZKPFKzbMYuKwo0tXXkJj9Xw2FAx+tiGNblHZiGSZ0Qrw1zR9MrN9OsSeMuZ6Y8OPt3j1f6r61vegCBYtXwqqoPvSfrIBX7TitR0lMeOPWkLA5WYG1FUIRJUsEL1wlP6o/DJ0uPGukevvzbpzWevd8xQvpQDSMvdwV5aiAr7Ks1HDehepzAY+Q8QFh0nbMEPqbpig37PHLCSK9TaGU+YS73MyJgudx3/S2gRbgx2xmWS2ZWglY3niBtMsQtdWAgn30D6eghdRDEFugytLwNTLWSQk4nhUS42RB9w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e15fc30a-5286-4535-6fdf-08d8428e2bc8 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:06.1983 (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: ZCNd+3e40qYPooBvghwIQGFPaQyEqp+HIRGDg1CFb+kCFXAfg7igXds3ExKiMTvP23LLOtu3Cp5ZQRwwxkXXCKuGnt5dn8cirVxUs4jQGNc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=unavailable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bs is linked in req, so no needs to pass it separately. Most of tracked-requests API doesn't have bs argument. Actually, after this patch only tracked_request_begin has it, but it's for purpose. While being here, also add a comment about what "_locked" is. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- block/io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/io.c b/block/io.c index 5b96715058..36bbe4b9b1 100644 --- a/block/io.c +++ b/block/io.c @@ -761,16 +761,16 @@ bdrv_find_conflicting_request(BdrvTrackedRequest *sel= f) return NULL; } =20 +/* Called with self->bs->reqs_lock held */ static bool coroutine_fn -bdrv_wait_serialising_requests_locked(BlockDriverState *bs, - BdrvTrackedRequest *self) +bdrv_wait_serialising_requests_locked(BdrvTrackedRequest *self) { BdrvTrackedRequest *req; bool waited =3D false; =20 while ((req =3D bdrv_find_conflicting_request(self))) { self->waiting_for =3D req; - qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); + qemu_co_queue_wait(&req->wait_queue, &self->bs->reqs_lock); self->waiting_for =3D NULL; waited =3D true; } @@ -794,7 +794,7 @@ bool bdrv_mark_request_serialising(BdrvTrackedRequest *= req, uint64_t align) =20 req->overlap_offset =3D MIN(req->overlap_offset, overlap_offset); req->overlap_bytes =3D MAX(req->overlap_bytes, overlap_bytes); - waited =3D bdrv_wait_serialising_requests_locked(bs, req); + waited =3D bdrv_wait_serialising_requests_locked(req); qemu_co_mutex_unlock(&bs->reqs_lock); return waited; } @@ -876,7 +876,7 @@ static bool coroutine_fn bdrv_wait_serialising_requests= (BdrvTrackedRequest *self } =20 qemu_co_mutex_lock(&bs->reqs_lock); - waited =3D bdrv_wait_serialising_requests_locked(bs, self); + waited =3D bdrv_wait_serialising_requests_locked(self); qemu_co_mutex_unlock(&bs->reqs_lock); =20 return waited; --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656601; cv=pass; d=zohomail.com; s=zohoarc; b=dMmtvP/n+mQUAxsixxbvKj7ceuMvSEyFIODtSXcAt0NNXs/Z3T1R6nQGxz7vVQMkmUN0wofZmNF+fGc2zH38Roj9qmY+On4aj+VeNRiu2PKnFAsWwMuY0k269olihEO/d/0I6mVK5Qtv9s/VTVWQy9OeWjY4WQFyY0xT++JZ7yw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656601; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U7IEKRgVOtSDJFcE6H6Cui/rat+AChaZmS1cN/FnBVk=; b=NjiOFfuY/UIw3rt1MXTaIFa3w1/Jx+vX2Lq4VC99cQyTSrwBKboKLIg3p0Hrok2u7zAI97GkY0FwKlBFqMSCCJlVm0hIlLp0xkJZEcx8Wl9+tdgopo/0QGNMmlfpgWA0vYFAA6Vtb/1/VdHi2lzYEIlamm2nKGpOAQfSViKm3AM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656601554864.0003445133262; Mon, 17 Aug 2020 02:30:01 -0700 (PDT) Received: from localhost ([::1]:41564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bSq-0002ay-3a for importer@patchew.org; Mon, 17 Aug 2020 05:30:00 -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 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 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 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; 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 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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_pare= nt); void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_pa= rent); =20 -bool coroutine_fn bdrv_mark_request_serialising(BdrvTrackedRequest *req, u= int64_t align); +bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req, + uint64_t align); BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState= *bs); =20 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 of= fset, int bytes, req->bytes =3D end - req->offset; req->overlap_bytes =3D req->bytes; =20 - bdrv_mark_request_serialising(req, bs->bl.request_alignment); + bdrv_make_request_serialising(req, bs->bl.request_alignment); } #endif =20 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(BdrvTrackedRequ= est *self) return waited; } =20 -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 =3D req->bs; int64_t overlap_offset =3D req->offset & ~(align - 1); uint64_t overlap_bytes =3D ROUND_UP(req->offset + req->bytes, align) - overlap_offset; - bool waited; =20 - qemu_co_mutex_lock(&bs->reqs_lock); if (!req->serialising) { atomic_inc(&req->bs->serialising_in_flight); req->serialising =3D true; @@ -794,9 +793,6 @@ bool bdrv_mark_request_serialising(BdrvTrackedRequest *= req, uint64_t align) =20 req->overlap_offset =3D MIN(req->overlap_offset, overlap_offset); req->overlap_bytes =3D MAX(req->overlap_bytes, overlap_bytes); - waited =3D bdrv_wait_serialising_requests_locked(req); - qemu_co_mutex_unlock(&bs->reqs_lock); - return waited; } =20 /** @@ -882,6 +878,20 @@ static bool coroutine_fn bdrv_wait_serialising_request= s(BdrvTrackedRequest *self return waited; } =20 +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 =3D 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 o= ffset, uint64_t bytes, assert(!(flags & ~BDRV_REQ_MASK)); =20 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(BdrvC= hild *child, =20 padding =3D bdrv_init_padding(bs, offset, bytes, &pad); if (padding) { - bdrv_mark_request_serialising(req, align); + bdrv_make_request_serialising(req, align); =20 bdrv_padding_rmw_read(child, req, &pad, true); =20 @@ -2183,7 +2193,7 @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *chil= d, } =20 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); } =20 @@ -3347,7 +3357,7 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, i= nt64_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"); --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656407; cv=pass; d=zohomail.com; s=zohoarc; b=hKs3IH0vERYLoRZFz1hXbQDRzaJRqrvrxDddr/5OEa1VK/K9AaDR47JgFABBd0YZatTW6/aOF+FAqFg8Job5lxnQOeS1hmh2u+IAS9DD3ezg79+1W4QYQeyGPhfMXEyKaul61xOIHBMnaFGRssx46LA1XgqKHbGYklNMKNYq1vQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656407; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=STsNsYSp4m/2BFKyBhY32OikkKbUUWixHdJcLYaK7rc=; b=dDb1eXnTzgEFBNWZpmdhWEXN6yvbdbHL07whQdFT/iXxqivW0v2ZFmIS4+UOyAcKvjkF8zDB3ZQeDiwI3R1dkZdWWMQnmXU8baDzWj0+50tMYx5mOYjQyxE58ITVbanmm/04IcgYJIFB5cQMuzofa9wcyL0CQiFr++b4JjbrQS4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656407367486.80060648964206; Mon, 17 Aug 2020 02:26:47 -0700 (PDT) Received: from localhost ([::1]:54104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bPi-0004jL-37 for importer@patchew.org; Mon, 17 Aug 2020 05:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFn-0007jO-JJ; Mon, 17 Aug 2020 05:16:31 -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 1k7bFf-000882-0L; Mon, 17 Aug 2020 05:16:31 -0400 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:08 +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:08 +0000 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:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JaH1oIr199P6DF1L8BZLfqTDzmQgZbGJx16aCHILOb4ShSZeA1cfgN69UsSxK0l9r6IB2tmkKXd9r/pTcleY0ZVUylCgKCEoy07u480uel4VNH3biLjZTSZVkCaLR/Uz77SOKpzxUpPLlMDCGvdenlvz891lrdrlm3vihDLrf6svEhx7yV6Y/FnIMfufPTg0q421HR8/2w3x8XQno50FcOoxHEkPI76tkcf1r5dtIZ6A0HmisrsrYtWnEjYRu7ZfrU/hb/AHt0wGOFtpiVhrmB3xr4SvU/DnR+Wuw17tvU+ok4Rnb0SI4FeGJzw1RaxggsPj1wy2O59pGMIhoDKcqg== 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=STsNsYSp4m/2BFKyBhY32OikkKbUUWixHdJcLYaK7rc=; b=ZW+CcB4j/Fn+QUS1pj9x/aWuJRxAqkOniTgS7DCwuVnBiqBXDj7diFngN4aKCCzgVSW0QX+xjvgOsGacR7azXEJP184e8TyTbNrlAE/JocVamxvDheKoQOwJR3ENw8TGT0H4XfnS7TVTBdyyE0Z3EvpkCOuCXK18wIqm6EHgGjgHDetdNF9RV2oeOksNPKAc2YQFvMfP38mjumxlvKDtseKlwPB5Ts5pC4YSgr1a26nMUAuiZ0gaCsSwM2826pkd6D3Fb9dFoIBiI693gtaTEUaVAX6nhCuNH/nlzyG8LhDjYxDyPc35vgW80JOwFDcxOw0M/IcsZkgD5TXHEyEihA== 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=STsNsYSp4m/2BFKyBhY32OikkKbUUWixHdJcLYaK7rc=; b=UECV6iqbK65GxTQ0csuJbklIjrtPmxszkY+8UqQGLWPBQJ+YsQ2jPmAee92vsvGeqdOvkNjQYX6ldkWbC8G15fcePdN+9bYllfDJS4Msg1GpQYR+yYGHau3QY4n70sGkF6pkU2R9yl7H7ACZ7mkAHSW8/xITqspGxvclWqwB2Fk= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 06/12] block: introduce BDRV_REQ_NO_WAIT flag Date: Mon, 17 Aug 2020 12:15:47 +0300 Message-Id: <20200817091553.283155-7-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 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: c7ad6977-a334-434c-b9d6-08d8428e2d17 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:669; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0E6YDVLjY36xGn3I9YMylH2Ruo62D210Ycc92W3WD4Fb2X7G7evbVALx/xXs9BbYX0WlLByEZnov4OEFH57QSV5CWgMdNBEsDYyttXKJBEWqqggSdGj3zflmB7XWAhZBjdSHW5BdxZuxblc9/D+ilFQyincUcdSjX0A49Ywe2A0FkvbSqALRRLYV17BVybZaNh7DrCQ4ZDOaxSP9rj80hayuToDbGveFxWKk7Fo/+DnTOpCsQv7g8vJ6KibgMSb57mXt+yIIcDm0RUGBMKmcQsVBb+tmI5l2e1ioV/rAqtbo8nVrlcax4XlVy49hstwcpEoBj4O1sScG3ospUCR5WA== 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: WoN6jBL3cs4GIGJqXooN86pw5rcMJm4jUiQMaGAwWdtW7MjRjM5EOh/5DVFgoQER1u6IQqAN9WzQoN0KfHSz8PlABhrgp05LHrUJfU1PTSJiv62s+mY49xk40eL5FMWs3tDMeTpUrF1sIWvJimTryCMEXFf42wdARa5zpq8cYOaqLqW45G9HVnxLE/GuBOSRxd22FM3HYhRw5QywXaY/fercFqXB6c81khUpYat5NSPJf+yGP2fHbtHSomRX0L1xT4Dq0fWaN0Pzu/A9h08X1r+D1ZOOeZGNNq8hPRJ7AC4MGQvE4bs1FHcbZPXnywZtbC+gS8/Ztcs5AgcRs7nHMpKm09mtQXg6l88CD6R9IQO/4wtMS1W9BAXqYIvkjKR1W3qsrrPAHM+qFZnDpgHntEWQQ/kczDQag3gWIW5TuLS088P60e18IRZIm2JpRZJyKEPeSBELYwz81YKnlFP7zpE5Y6kogcahUWjNP7gcKyPO4l724TOvnhH/2fJyGs5+T0CETVNrHprLVVzR7HmJtQLoFLTn0cdnzqQVCYMckSlXFJJX/kqhuoPgMVObUVsGheYGgy8onNRCncDBqn2+OXpZDvD80JOF6XEaYAnZsiSYhF1bi94vv9ChxgX/pLDo/wuYIlx6TXmaI6zrXRheSA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7ad6977-a334-434c-b9d6-08d8428e2d17 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:08.3817 (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: GqkLyVYh3l5VE4MLjJbpD7F4ygHkBoY7yiQe5wxEgDW215WTL7t59e9A4QXtA4ZZR3Ezk9t4AtqGyf450DprCdINms1f1V25kdFyMRirtvU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add flag to make serialising request no wait: if there are conflicting requests, just return error immediately. It's will be used in upcoming preallocate filter. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 9 ++++++++- block/io.c | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index b8f4e86e8d..877fda06a4 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -67,8 +67,15 @@ typedef enum { * written to qiov parameter which may be NULL. */ BDRV_REQ_PREFETCH =3D 0x200, + + /* + * If we need to wait for other requests, just fail immediately. Used + * only together with BDRV_REQ_SERIALISING. + */ + BDRV_REQ_NO_WAIT =3D 0x400, + /* Mask of valid flags */ - BDRV_REQ_MASK =3D 0x3ff, + BDRV_REQ_MASK =3D 0x7ff, } BdrvRequestFlags; =20 typedef struct BlockSizes { diff --git a/block/io.c b/block/io.c index 96b1b9cf5f..fc6d44d302 100644 --- a/block/io.c +++ b/block/io.c @@ -1911,9 +1911,20 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t = offset, uint64_t bytes, assert(!(bs->open_flags & BDRV_O_INACTIVE)); assert((bs->open_flags & BDRV_O_NO_IO) =3D=3D 0); assert(!(flags & ~BDRV_REQ_MASK)); + assert(!((flags & BDRV_REQ_NO_WAIT) && !(flags & BDRV_REQ_SERIALISING)= )); =20 if (flags & BDRV_REQ_SERIALISING) { - bdrv_make_request_serialising(req, bdrv_get_cluster_size(bs)); + qemu_co_mutex_lock(&bs->reqs_lock); + + tracked_request_set_serialising(req, bdrv_get_cluster_size(bs)); + + if ((flags & BDRV_REQ_NO_WAIT) && bdrv_find_conflicting_request(re= q)) { + return -EBUSY; + } + + bdrv_wait_serialising_requests_locked(req); + + qemu_co_mutex_unlock(&bs->reqs_lock); } else { bdrv_wait_serialising_requests(req); } --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656456; cv=pass; d=zohomail.com; s=zohoarc; b=E3563VdX802ObaIbUZ4H/X2w7TuPJWTD2yT+6qSeUKkhDRqfZxaD+Ex8FQCGbYhLfPmxsWTVG1NgivJCKgREeo75AkESr9BrbQ9AEpqH1HdeYOBED+mnblcntjryHQuDACvYnMfx4Flls2sjM5ahZerdKFnGja7bN/sp9IYSPS8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656456; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ojcrD30xcoBbg/eU7bGkSW1+Du7QCHM06Z/v3H7s23w=; b=ET3frk2eAHh3i3mEBb77HDTeZ6WNiBZlX2t5THPYQtC4Zgz7wfIGsoeZ17NjtegkCjqDylkiEuwMoI0ZA8EqzCWCA+BihjsQb69wcgB3T1ISqOesgosBLNFyfitUcHrjXrl4zzxx7dq8YVIsV+QSohDOZEppjpQxotPeYaN7kWk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656456209828.9888550574726; Mon, 17 Aug 2020 02:27:36 -0700 (PDT) Received: from localhost ([::1]:58996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bQU-0006hc-IV for importer@patchew.org; Mon, 17 Aug 2020 05:27:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFp-0007oa-TA; Mon, 17 Aug 2020 05:16:33 -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 1k7bFg-00086n-KK; Mon, 17 Aug 2020 05:16:33 -0400 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:09 +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:09 +0000 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:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HgiP42ZRjmc4ads4qEKtBcSWImX1an5LLJJCjwT/RKIkyfSlZav1SOM1FpEXHPD49Td11G3RmmqySoTvQRnjZVzZUzbwwR8UXNBl2WpwVAB+ZPUYR/Gkq8KpeqQDGUUc11s9t1qgGzkuVCy9yN7cQDN4yhDj5qE+DuEYTG66Zpqfw269e3EZqDtKbRrYsQzSsZu7+iEskWKrtgKNRulbxnRpwG0h8uJyBFFolA8ERFltYuC71Qrb5hja8/uRb7j6cD8NUYPCzYhzGHCQFoMOOVqmnzx0r49b/twZMmbDN8FIQ/uXxdBLqWUKm5pPE1S7zMPVWOoedamYWfbioyHQAg== 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=ojcrD30xcoBbg/eU7bGkSW1+Du7QCHM06Z/v3H7s23w=; b=nbIIZP/Szho+XUuovPcvZIUJvb0fyasW9TLKNxDviPW2b/iiSFMuXFIFRgE6QCmQlbx7ifCjsvotn9gGhTegpFamJVgmJznqQvH9ih3CQnhhUnYo1AG+MqogGrMxqqhiRnrLl7c5phnIraZ4WiIxkTYbcMBOr5qphUa0uQeeR65WxWJcYa6X3HhAlCiwEnOD4SzZA3flfpgK9B+uSfxtk57cekFAg1czvt/Y+7YTqyrRoOAnyfPY8hre8xq0P6bOR0QcE41DCWzNQ0bxS14/yGow4d04nTXnHaQgavmykymCQmcOcrXF50g05PTTXPrajDu5oLjAs+01FhV653frVA== 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=ojcrD30xcoBbg/eU7bGkSW1+Du7QCHM06Z/v3H7s23w=; b=Li2qn9LEUVuBCX+pFKKNV8ivMOVbLwGCrITjObUrLq1tw6RJPnWP16e4/1Yel47za2pRGgUL1th+x1cNsdts+A/pmO6CjQqb49zN/nKl99kRggdJboXx0Sewx3FktpI4RCAMnPHWk5zl630IRWtM7RhZUpO7UPM4hCh2sRW5TgQ= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 07/12] block: introduce preallocate filter Date: Mon, 17 Aug 2020 12:15:48 +0300 Message-Id: <20200817091553.283155-8-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 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: 67dd314e-01d2-4c68-70ec-08d8428e2d9b X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: 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: uGmV7hGuvnefuvHM1OPU4/Y9fq5siyCMxMBmwrRyLecFZ5ZU0NWLItLVmtqxkHhwqtd2qBPtOmRMtcmbzlmctEO7jcDdJcu0X+VrXvxyhSkOXeQK/vf3OmFCPAsLcD3W8z0xIRrbGQt/QM1cMpVH+aV+g0dnflBgzH04tm2CDy1ixBK51b2d0SWeznC6z6IDXKAvAJoJ5tUXDV92KQvMMAwsG59ljVlwKThQyuQtrgUzyu/DfJG2Y0FH3TDkFff6JKal2g2unzJwXprTLze/h/zIzyyuEgZxlydU/VS/w/mLNP7sNjyS8YVE1KhiChG3xisSlf9MSNaldqlmEw0ciDOi/U825ydMlWM9/Utm4Zxw6SkxI7tQtWEs6NPAUpATMPparNQrXhCEBtNfF1vWnS6YDDpRJz2aLTne8i8N3MI3BF+twYeW1S6uY452EEm21hL8pIUymjorzX6yDh9H0g== 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)(30864003)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: vLr6fhC/8UFqJajb8VAVyUjlogmy1TFleLjd5lRtcDa3V09P1L4GM1/DWMkKe0hgU9fusGW+JgSj6M7YQWmMuSM7QM7atK4BXao5Nc7+mpZF3DtzDUCOuicTcy0158hLh9QWQPKzmQrcNHNlHdhY14l+nN+dov/w/Y+l6mN3BCSrXpgdnfICKKuTHaVwIv5M5u652cTnGMPDfkdbhdGSIfLmWyWQpBdlCUHwXYho8ploMz8XB6S1OTBEsgtPtil0R53jF+OY0WXSxYvnhEv0sPFMRbLICTRN70r7IGTuuQFF1ll9HBS3zER+lgcy4EDuG/9vSJBOVgNFVN4mjImTKQBQRHbRtUgoU942IBl2pGClxxGVFHEYrcP2RvV/U1VQTei6FBKmRxBc2rvVMzQ+BqaJTFScvFmWZVFMYbXsiik5nnj3vGdRJg4H7nFm2mbVJ7ABQUkIrxSCItCwV8sCurxY3LFyvYcj2R6mfgkuUXtnw6oSgSfbnlWrzHWHRQuFF3GPW7aYLSgzxkBeHtZ3U1FfpX5ynzGt1iwpNrFQ2UJ7m/23Y7VOBWcxkyMxPYcJKRrIEcGBRt8yXxVWrkEUKEjDqNTrv43ylnWjqQNU3KlrvVbcm1THkJRabheB6QWKLdEIdX7MSj+KThaTznmenQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67dd314e-01d2-4c68-70ec-08d8428e2d9b 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:09.2887 (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: C/Qm27mwgJ2urrw4mbOpR6vqjXljpzCVD6f0Tecw2+D+6Cgk5ZcEgcLZUpLTGs/mriqnC7oSTSlQ9ulDCJmOan7ZolC4HW0MmZqJX4clI08= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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-bloc= k-drivers.rst.inc index b052a6d14e..5bfa4f4116 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 pr= ocess 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 runn= ing block driver. + +Filter drivers +~~~~~~~~~~~~~~ + +Qemu supports several filter drivers, which doesn'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', 'ft= ps', 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscs= i', 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallel= s', - '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'} } =20 +## +# @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..6dbad8a0a2 --- /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 preallocat= ing + * 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 preallocation= s nor + * requires BLK_PERM_RESIZE on its child. This is needed to create fil= ter + * above another node-child and than do bdrv_replace_node to insert the + * filter. + * + * Filter becomes active the first time it detect that its parents has + * BLK_PERM_RESIZE on it. + * + * Filter becomes active forever: it doesn't lose active status if par= ents + * lose BLK_PERM_RESIZE, otherwise we'll not be able to shrink the fil= e 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 croppe= d 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 =3D { + .name =3D "preallocate", + .head =3D QTAILQ_HEAD_INITIALIZER(runtime_opts.head), + .desc =3D { + { + .name =3D PREALLOCATE_OPT_PREALLOC_ALIGN, + .type =3D QEMU_OPT_SIZE, + .help =3D "on preallocation, align file length to this number,= " + "default 1M", + }, + { + .name =3D PREALLOCATE_OPT_PREALLOC_SIZE, + .type =3D QEMU_OPT_SIZE, + .help =3D "how much to preallocate, default 128M", + }, + { /* end of list */ } + }, +}; + +static int preallocate_open(BlockDriverState *bs, QDict *options, int flag= s, + Error **errp) +{ + QemuOpts *opts; + BDRVPreallocateState *s =3D bs->opaque; + + /* + * Parameters are hardcoded now. May need to add corresponding options= in + * future. + */ + opts =3D qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); + qemu_opts_absorb_qdict(opts, options, &error_abort); + s->prealloc_align =3D + qemu_opt_get_size(opts, PREALLOCATE_OPT_PREALLOC_ALIGN, 1 * MiB); + s->prealloc_size =3D + qemu_opt_get_size(opts, PREALLOCATE_OPT_PREALLOC_SIZE, 128 * MiB); + qemu_opts_del(opts); + + bs->file =3D 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 =3D bdrv_getlength(bs->file->bs); + if (s->data_end < 0) { + return s->data_end; + } + + bs->supported_write_flags =3D BDRV_REQ_WRITE_UNCHANGED | + (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); + + bs->supported_zero_flags =3D 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 =3D bs->opaque; + + if (s->active && s->data_end >=3D 0 && + bdrv_getlength(bs->file->bs) > s->data_end) + { + bdrv_truncate(bs->file, s->data_end, true, PREALLOC_MODE_OFF, 0, N= ULL); + } +} + +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 =3D bs->opaque; + + bdrv_default_perms(bs, c, role, reopen_queue, perm, shared, nperm, nsh= ared); + + s->active =3D s->active || (perm & BLK_PERM_RESIZE); + + if (s->active) { + /* Force RESIZE permission, to be able to crop file on close() */ + *nperm |=3D 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 offs= et, + int64_t bytes, bool write_zero) +{ + BDRVPreallocateState *s =3D bs->opaque; + int64_t len, start, end; + + if (!s->active) { + return false; + } + + if (s->data_end >=3D 0) { + s->data_end =3D MAX(s->data_end, + QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE)); + } + + len =3D bdrv_getlength(bs->file->bs); + if (len < 0) { + return false; + } + + if (s->data_end < 0) { + s->data_end =3D MAX(len, + QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE)); + } + + if (offset + bytes <=3D len) { + return false; + } + + start =3D write_zero ? MIN(offset, len) : len; + end =3D QEMU_ALIGN_UP(offset + bytes + s->prealloc_size, s->prealloc_a= lign); + + 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 =3D bs->opaque; + int ret =3D 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 =3D 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 =3D bs->opaque; + int64_t ret =3D bdrv_getlength(bs->file->bs); + + if (s->data_end < 0) { + s->data_end =3D ret; + } + + return ret; +} + +BlockDriver bdrv_preallocate_filter =3D { + .format_name =3D "preallocate", + .instance_size =3D sizeof(BDRVPreallocateState), + + .bdrv_getlength =3D preallocate_getlength, + .bdrv_open =3D preallocate_open, + .bdrv_close =3D preallocate_close, + + .bdrv_co_preadv_part =3D preallocate_co_preadv_part, + .bdrv_co_pwritev_part =3D preallocate_co_pwritev_part, + .bdrv_co_pwrite_zeroes =3D preallocate_co_pwrite_zeroes, + .bdrv_co_pdiscard =3D preallocate_co_pdiscard, + .bdrv_co_flush =3D preallocate_co_flush, + .bdrv_co_truncate =3D preallocate_co_truncate, + + .bdrv_co_block_status =3D bdrv_co_block_status_from_file, + + .bdrv_child_perm =3D preallocate_child_perm, + + .has_variable_length =3D true, + .is_filter =3D 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 +=3D crypto.o block-obj-y +=3D aio_task.o block-obj-y +=3D backup-top.o block-obj-y +=3D filter-compress.o +block-obj-y +=3D preallocate.o common-obj-y +=3D monitor/ block-obj-y +=3D monitor/ =20 --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656657; cv=pass; d=zohomail.com; s=zohoarc; b=kHDbxSE9/EuxxhKFvH3wMc/wIXDgW0QsGqv3rRzsIQvdaMWFP8g4LgJJiTg1OWeQtr4yc1b44xnO4BMTrn4rITgwHHSHI5GEEdLO1THajupHu0KtMzwG27LKbx7xZfyFzV0Vupyp15JWsMtTL4j6eR+F7rMKhzhQk9n9zANaiy8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656657; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DMfHzmMeHtZT622efOgGcxNrYL11mltfChN96w+RTM0=; b=h2PDRgnc8ajmQL+1+iZDg61DETX2Fx1Pes1pAe1M0kPrkprr1w0Dzovt2WR4doKWxRP5ZxcM1frU8WkcC7UWTbI+uKEnAxenJMO0458sZZr8ceIEcCztKQc+EzDKaKBCmIWgWtPsI7KYYBGg/Kp0YubcyJXIo0+w0qGdlkqep18= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656657684348.06258477947904; Mon, 17 Aug 2020 02:30:57 -0700 (PDT) Received: from localhost ([::1]:44258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bTj-0003lk-TL for importer@patchew.org; Mon, 17 Aug 2020 05:30:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFq-0007r3-R3; Mon, 17 Aug 2020 05:16:34 -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 1k7bFo-00087Y-8x; Mon, 17 Aug 2020 05:16:34 -0400 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:10 +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:10 +0000 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:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WsBr+O19PKOVLdTPc+9HhCyvlR69HsOjj+ZKz3fgGriPyT387VQVZdREQajVKGqZRI68j6dqEWFV52FjyfllPRvM6T9acjBptuMRVvXazqVsUiYU5tAMU8WvcTr7jWy19nRLP4ReLcXgNAsNd2CDij1EoKxtD1TO1c9PIjLhvxnXTpWIBEW2orcwHMCKvvHH5ZhKrvrgRy1QrM7s43ysW9IIymCtcM2Of6oSKs0Bi+AP3d4FBMRQD8EIWkMk7rbJ00AScVSrK4nUYPLuSmfzKm7i0bfmIKJpHl/9LNB7ax7OG7jec6jxg8Xxq078sdSwE0DwwrfctNISwAq7co267Q== 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=DMfHzmMeHtZT622efOgGcxNrYL11mltfChN96w+RTM0=; b=FEfZGtDa9vMjYgcy+VZ5wHDet8lFE0Iaq46TbmmRqIKO0raGsBNnihSl+wWi7xSMHl6nIhvgNvPaIKptX3/p7AYP3PdsOLqBKIYuaTHz92W35dL2b1l6N4jWqTJYIxbdO+hHY1nRp+aGqwfsmNcjSbZFkmATgw2xT/D89dWNiAK23NcKsbZgcUorUE5/24UqBgwqKO69RfexqXZRPCJMdzamerbKW1hUC6FFYUPtsZOvEbUsvMoUjdqhhsnwu9VI3BaN0VfGFWXJ+8NU3vFsN0bDbL2pq0K0F5bMQ2Ajpce0x95jcSBJsYHtyMDUk9ehXYtZ5u6WU5f8FKsCQ4Dz4w== 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=DMfHzmMeHtZT622efOgGcxNrYL11mltfChN96w+RTM0=; b=eEnbuC/I20/QWdz9Dw6Gmp6AdjzAL8FYKeZhvA2rLhPTQrr5W+Qja3+C0F0aT0Xa+T5OXtud8WhcIQm4yDc5sJzB7XfuYaCcjhbct2tXcLzfxqnAX7CKsIFOGk5kBBN0xDEfDFowJFfAg3SB6kms2DymCnW2VvxMuCJkEjRUuPo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 08/12] iotests.py: add verify_o_direct helper Date: Mon, 17 Aug 2020 12:15:49 +0300 Message-Id: <20200817091553.283155-9-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 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: 8b95748e-bf31-4893-019d-08d8428e2e2b X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:510; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LfuVI4HrXuAFPqYU47dktusZHvaB5obWM0grT9wkJ+1OrntdPqYnUoYO/sgLoRkkWsRI3OtcedSFS0ta+m4627SR+GbIZ55b0wfILWgxs9m37Y8b73j0cwfjpVq+ClZlZg5x98jdEnPk9sBUFJ7sQjaj6VCZtrhrcNT3Z2clyb7eUlWB1l2GF4iO1i4MkgTVskLRsir+iNyQdXySn0Oz336L0ZyK4e4pJX2Mj09aLqKCbEj/8EgU7T30no1NcAn4tC1i3hJXHZGPq1OwPJDyAEZLvxZybSIyrPl8biIjHgC0V5cnuLptjYF7XWDy2CbWY0xM1L1iPvByilaLXm+yJQ== 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)(15650500001)(8676002)(8936002)(478600001)(36756003)(4326008)(6916009)(316002)(2906002)(1076003)(6512007)(5660300002)(4744005)(2616005)(66556008)(66476007)(6666004)(66946007)(956004)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: OqsvssIayP9heS2vzWuxzA/yyKGgNhenWFoabYoxR0psYxAP/vPbAARyvOiJrhRIBD3QkoWikS1qmxsuw4xTKFJNCf+z4tz4RK+oTNfSykz+pX0wp7fmJVeW9L506XPI/UyKg6gOlT59+m7ZKyBy/YFRsi2qelyU0bxluiRer1E24JQEN4PzIYi4E1AJENs36PtIrY40NNy4erwRfRV8uKkw4nMJoHgNFz3Xwn4waVUfIDCL9x2dYVG4hkIwFJZ5CinDSKRHLewOOJvP56YXD8/1TlgZL2fKQTrhlIumeRB1rHaJbyTQyEvmKzgScxbCD7Nk0666GN3Xad9OXRNGjeiOMB5BV+sDQtUAH63YOQahLoVPxwy41A8KPtQA+9wEJiLsaaGYF+1CsVEBirYb560D18YLPVs7JH1VGjkvEnfox19uiAx53VPZsropq4RLLVW96m8yYB7sqmrKSe/sNsskoPpTqJbmXA3h12D58lxyKQGn09kmi7CfoCanVnqB81vGlbzA0vO0mrTDxOM2HmMZtrrFVnXDhSZus7HcM2tENQ8K/j74w3Otn6F+AsDuoTd9OfHYG9KTBqEYbXKU+vBjdjf2JuEiCZsz3QFZmdZw88OAU7p9kKn6f6rEkfMqag5VdL355Jn6xxVnMQCf7g== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b95748e-bf31-4893-019d-08d8428e2e2b 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:10.1708 (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: ufZbiPAmZWtn4ST8rbpbzgzsDLVLWLx/+Rw1/TIuGW+F9Zlk2hX3OgmDox6KFLaGl5G8jrE8VHIM6U1FKxNZgcDIudU957RVf7nHg+LyK9w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add python notrun-helper similar to _check_o_direct for bash tests. To be used in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 717b5b652c..369e9918b4 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1083,6 +1083,12 @@ def _verify_aio_mode(supported_aio_modes: Sequence[s= tr] =3D ()) -> None: if supported_aio_modes and (aiomode not in supported_aio_modes): notrun('not suitable for this aio mode: %s' % aiomode) =20 +def verify_o_direct() -> None: + with FilePath('test_o_direct') as f: + qemu_img_create('-f', 'raw', f, '1M') + if 'O_DIRECT' in qemu_io('-f', 'raw', '-t', 'none', '-c', 'quit', = f): + notrun(f'file system at {test_dir} does not support O_DIRECT') + def supports_quorum(): return 'quorum' in qemu_img_pipe('--help') =20 --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656766; cv=pass; d=zohomail.com; s=zohoarc; b=gz15u1QB3YwwG3kavGhms6z/EQrTUluIH2tU27olGOV33euc8P6tvw6HnsgKAONjLlGBSaKVaAfu6z3eJYKL0/2rrbklWzKr/elfQ5BDzh52Pd7sB7bNdjCsAFeubkCZxVd+2oaYgRC1JdfIuOXAnNvT/4uQSJ1Os4S9NV3UNVA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656766; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6bSewKwR/qJKi8k6AuIIWLyv+oN8eJ5a/HOfOESNKN8=; b=Gi1QdHrslzwTUKM7WetEDFwEKPJyrdHo3AKnloULxqjKszrynDBIycOY6Px8RHFrqdP9d/W0GadjOO405gjefhJMahf5Y/5G6jB9aBRRDMLbqYeGseVeeKiU8fhl+Z4eB0UcOMwNk1e0NF1zW5Ga0dnYvVGfdPW1nWXaxursKnU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656766672382.83701563191346; Mon, 17 Aug 2020 02:32:46 -0700 (PDT) Received: from localhost ([::1]:49774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bVV-000645-Ab for importer@patchew.org; Mon, 17 Aug 2020 05:32:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFr-0007sQ-F2; Mon, 17 Aug 2020 05:16:35 -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 1k7bFo-000882-7V; Mon, 17 Aug 2020 05:16:35 -0400 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:11 +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:11 +0000 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:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZnetS6IqkNKjMQxZuR5gfmOh2P6/ovQmDonqf7KgNlzr8wdVvVQ/a89ZPgkJ9GXlXpxbDN8TB5uo2BgbZ50RcTMg/dCNACqtl5yOSCVQRg2sc6nMqCcIA8iAvqXELtuy2potId3ki3emJAzjiymwf6kPbviRE6WtCxLnsr2jwz+Cj+Z9xzE2oFIrXNbvuoTIMsZltbKwZXZrbCtgbQe3ZpY+fqd8G6U5gewYCaEuJs9vktsMmC416s3/bVe6Toa2pTdfprinGUpEp/gaByEbaeXTpTUIQnvd4bSw8ERCWTLOeY4kjplO3WSF5JaMrP9d61cWjOn9C9jH3XR6NBSlYA== 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=6bSewKwR/qJKi8k6AuIIWLyv+oN8eJ5a/HOfOESNKN8=; b=T7qGzh0MT1EvzMQG+Jr3MW52T7niMxsRVpQYtPhRvYA2SAFxfDj7cPQzeh1gDQJqPgPKJaFkzLII8wDPMgAsbOXT+mbasQZgEMY0O2l6pYIPGLXvSpzS7Fkp3/DyDirLZj1YkNAQGEjK9JrqepHbEGcdF0caB4uoPH7wPs2yFbMVM3V4l24D9sngPTd5o+PClWDBTEYebdPO/6djDgEUQkUN9u0p+FJ4KIj6ZjXwwv/j3KMZrzDLG3AwW3IKieDi4p4thEzTEAGTC1n4/yso8jETKp0xroSrZwxkULmpEYij8wVLqXHKouI9aNdK2W2O90ych2aOWNRsU9d7khGyEQ== 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=6bSewKwR/qJKi8k6AuIIWLyv+oN8eJ5a/HOfOESNKN8=; b=fi6f16LBAqwNBmCmhOhZkW+52qIJn9ArzTSBndv505kNIeepsBZqNAGoNAzksGhfx+ss2H5ZCpDh3/YH9n6hGpQBaqdNLaR2aETPEl/iDxhDSdOWLtb+d6/BG5OjIp+AlNj5471o2tosXdrTiM5DUU45pPfTcIUyl2ncBZI0RVk= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 09/12] iotests.py: add filter_img_check Date: Mon, 17 Aug 2020 12:15:50 +0300 Message-Id: <20200817091553.283155-10-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 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: c0424e49-6224-4b7c-a507-08d8428e2ea8 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:393; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DwYGtTR9VKtxMPKm3jD+cspMRt7wHfG7tVoGvQebNGnsE/nqH0Z+v00rIV+TI0Wq82OTBWrLQ+XjqbZoG5q+KkGdLp6yFH9LO/LTvqgwFm+mT2EZrHfsJXHTzSaHEjOUcZ389w6mL+s7Akc1fTuM4vOYQ7Wm2lW/EpP+MHll9vOlE2i6UzCH65J25fWMEwfvFCNi+E2TFFUcE/pc9pkILYiA5zIrSWnS6bZ4kSYjFDFOhSNQx/vVH1ADyRe8UCa4o3hEgYmWtTPNL38wOhLiOFgEbzF2sVZRiEXi+i0jyGdnQ1/GlFfYFnzkuK8lDlfKrMlbXpMlxq6pk4TFKDdGng== 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)(4744005)(2616005)(66556008)(66476007)(6666004)(66946007)(956004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 8K6nbw4dnJEjJe+6mtB93uwl84TNzdxzp0ouNnwYaAtnAoL1MPxqkqzMFqil8v2ZUT9bUY641EXSAsmW3VOy05DIxqoSYgqiQ9xpTjd2QdJWT9cOXEaLBf+0U/Op9Bry8u+Ida0s4W4x8q+mKrqdcAbJHnNbbw34r76THpOWKTAdIe5itWjPiy03VpcNhtVODkC/QJA4n+tXDYvHmSRRVsUTHFA7bYFn4iqiWSi0jRWt0tp3LjUJkYY/n0Fo9P4nIAI6fu5HXqzjP94Oy533+W9J3D4gJIyVpPkGT2+B3gLFTP2aocdMIiuEnjcx8ZeJzJM5oQhtaWqMiSXS1g94H2ZN3cUii4+ARonun/0mEIzhOzCpWVez3YUr5cATkBw98GIUoVWwe/LRRrNy8SJqyyXBNdfOKwrJpQTsA6ZAZdaRuYrYJy1FPXMOXFqSRjawcmyDRWDgEbHQYrOylRpWe6vk2AuiAB847nvEIRoFFZC3dLHWODzsmXPZvmkW4Mp0yBt02WTkTisFafyeXFj30yVoxCHQG0+yrssiSGqW6y+BdphQVZ9Wec0lovwfjin9vNrT79TpY98fagZlIWn14MQjvZ3wPRg7fquTCL77icOa5+rT4jB/O/hVcADan/ycB7L0J4iNVvyZUmZoOP9X+Q== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0424e49-6224-4b7c-a507-08d8428e2ea8 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:10.9723 (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: GRqDnYh9LzmmbA2ODagbyBBMFLF0XzxIMa28vlTHONC0npGw3rgad77zrEZtytbJr4DvMHWAo8VeDVxZ4Yc7EWR8Q5ALK0VXCYS8AilUdCU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add analog of bash _filter_qemu_img_check to python framework. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 369e9918b4..ef3da4ee61 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -402,6 +402,10 @@ def filter_img_info(output, filename): lines.append(line) return '\n'.join(lines) =20 +def filter_img_check(msg): + msg =3D re.sub(r'.*allocated.*fragmented.*compressed clusters', '', ms= g) + return re.sub(r'Image end offset: [0-9]+', '', msg).strip() + def filter_imgfmt(msg): return msg.replace(imgfmt, 'IMGFMT') =20 --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656701; cv=pass; d=zohomail.com; s=zohoarc; b=lTNfVEtH/dNYxR3VhUwtbY1+hEE5CcX/V+CBXCfy66QGy8n3CDGL8TJjxG0MSEFagB4r1H2l21MtkE7ynerEhA2iTknTuqTBmFe2GDalztAVqDuU9pTSpGr5vXgv2iWja89FJaybkh4hsGCXdyajLEoU5ukBOikf02XgjTAN8og= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656701; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V8WR2ArAGOWsaIurcI6UsqgkUBJiqiJn+0b+w7wC3HM=; b=CiTX2cOgDs6/3kmysnG657GXA0iU/m99rnC/DRy5/VJhyG9BQNikIUyti5IB6QWu0UXYNREhdgI7GAQTC4MZ/pn2qfdwj4vwFixdIH3obULRDabwN1YGzc+8OZnu5trR1hjgQaAYTARLlUPo97p/+erKQlPlbStMgSjVpHxyAr0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656701305681.6609147958242; Mon, 17 Aug 2020 02:31:41 -0700 (PDT) Received: from localhost ([::1]:45870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bUS-0004Qm-7y for importer@patchew.org; Mon, 17 Aug 2020 05:31:40 -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 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 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 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; 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 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- 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=3D['qcow2']) +iotests.verify_o_direct() + +size =3D 10 * 1024 * 1024 +disk =3D iotests.file_path('disk') + +iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(size)) + +opts =3D f'driver=3D{iotests.imgfmt},' \ + f'file.driver=3Dpreallocate,file.file.filename=3D{disk}' +p =3D iotests.QemuIoInteractive('--image-opts', '-t', 'none', opts) + +log(p.cmd('write 0 1M'), filters=3D[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=3D[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 --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656509; cv=pass; d=zohomail.com; s=zohoarc; b=bZS9JdRsO1L874aUHulsQgbLy/sBbmV1z0MzvwKnkWdOcqjl19dCJd/4VVTEVwz2NERWwYGh9NpxKCl3p3zSCqIQvFjIfwsfPrZErLgHU+6VR9Yy1TkBNKo8irn/RoZRwlKoUJDRNBpKXdX2/UbsAfD9gngBdjZ0xNBx7r7nYbY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656509; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NIFMzK3gNIiORpm5I+2itLEztQCdodDNvWwcDAQTN4I=; b=isb6BHgWJ/LeDiB509iCCD0EiWtp6ns2G7Amibe7NOPY8hnBkpyyxwOwUZz/bIIi+YMepZJ9HJo2KOiUh6wBCz/iQ3+zwvWa1f1tX+54myI9AEfepveCBXVu0CPO7e8EwFsJBekh2CqOcYfBnSAJCvL2RMT+/YTRKbV103nieQs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656509752535.4540561149134; Mon, 17 Aug 2020 02:28:29 -0700 (PDT) Received: from localhost ([::1]:35116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bRM-0008Pg-Eg for importer@patchew.org; Mon, 17 Aug 2020 05:28:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7bFt-0007y8-Ii; Mon, 17 Aug 2020 05:16:37 -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 1k7bFr-00087Y-H9; Mon, 17 Aug 2020 05:16:37 -0400 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 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:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E3xbSew50WxIGJ3MrGR8GLzkr/M/f9foB85RUBvZVY2sxoRJHsKOiLEbtlPIi0BGff3NKvQ8+SEPdcU9K03S9ywYL6p6q9hf4dHGZqTmwY2ZFeEyy2qp3ILia8NZZep13pWSGk03dSwDV1uq1xRWXtClbXASO3CzW77E2jb+19Y5brS/h0CYGdFUZs+0k0r4YViSxlExgx/lPygag9741RW+HsI82wYoCJmKql9V1sWR6OGYPnUCCw/RK8HYOU/n9BKr9kLI/Q5+upbPkv79gUTFsBsrYczJgm8VIPuFUH8Vj3tmRxj+BMujFB2v7twlfvwEGQ/P+taVEc3UDssrfQ== 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=NIFMzK3gNIiORpm5I+2itLEztQCdodDNvWwcDAQTN4I=; b=SN1MnO3lJLVkgrE1+Wcr1oDFvsIwoqxwrHA3DiYvxBPpHEodQnA2rpep6zOgPJHUTxFmA/69LpmxsVTbX+gVMAzcQftcq2tha9FQRSRQiB64pR4Ya3xhphNKO9rAZQfBNuSQddI3iGgjuyWrCivuCnp7bDFJFpYeVOFuFFYV2kK88Nx8wxrIcH+CtNSRTMRV+y4SHWw/Wqy5yhJVXuWXrkFjfB1LFBxNaj6REqqFT0E6+hkAftzhepivOEw7/CZ+5O0Ove1SStmFWSCjIKO7rZ1p6MvIGZ0valUD1nNI+K2zeLMzJBCSUl0SvaOLKLb0JIfL/pzenKSJ7K8YFeKsEQ== 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=NIFMzK3gNIiORpm5I+2itLEztQCdodDNvWwcDAQTN4I=; b=OhRd9dcUUKjz98Ri35+6y/INotq1r0rOSH2ZOBPVEFSmNIxRVUeLc0TrQe/BzPOHTB9LVVMZ0IDe+cQNloCJSQtu87w+Uf4c9uVErAFS3K7dSWwyhSMHnHfaRtkOM+G0lbPMPzsHVzFbr2+JfFQjpFnXgJVur+2I2JHQSrzGFUs= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 11/12] block: add bdrv_is_file_on_fuse helper Date: Mon, 17 Aug 2020 12:15:52 +0300 Message-Id: <20200817091553.283155-12-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 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: bc29c0c5-9943-49c4-e2fb-08d8428e2fb8 X-MS-TrafficTypeDiagnostic: AM6PR08MB4852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:269; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pcF8tInxAj6b+mobInF5j790dtb/oDOx0PBD5o3p5Icof4DgQUsFDQph0KANkaT7xsd01YKiAZhA8hJSxB99mH1sW2gyWuGUb5KHuzL0dOHOWheCX0ezpDoo10W5bb/X8nwWrWnCXOmRJHGhmy1n3mC6uuw/pdSmNuM/VGMOS8YzvkSHDzfZBFjF7Lno18la/OI+CUuN2Vkb+C1ZpRbdi3NVjGIFzmVNX6d9NK2Um8QXrPIySU/35bP9we/sR5r1G+AuSGKEt5Skm7CeFidLggliK0bMRj/l7s2PeEJZaQMRxK6bp7nC20I7F+CCWcNb 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: c+YDlGIWAXiaPVHMTErhtVBMlEAIzm8z5hLOYq9nl+7X7iLcVaP7WYwq6giLoG1ZHfJMwUgXhqNscfK/G4IhTA1mTkt/eubKfSR+9XNBgNaT+okQtcOXzOyw0p/YtkkINjJaKHzesy3a3L7kXbE3KlBNmRMDGLm1tVli3sxcod4gColznQKDM/iLXm8dCrhiuLvNs+NRJpbcgNGD///kgvKahrncQ0InuqF/+fuWj+Vh/e2K/78STgJxH5byP+/I0xceiz9ghymmNMuzOPoNd8/jIDbHco8UdJraDW+PoK600WJiTmp4EcKJl1Tegi25TcoPveDrbPDZ6UuOHuYy7Ekkb6wX2N6Q+DiNVzrJD1FVEYDPgCmuUQxDU1aSV7uBGTcP/WcHQMyHByJnfioc1nZ2RGtYbjBkaMIV1RRrdi0Q+HsgVhXPYyUarfGuZT0PAmpARcnlbPTmL4e82vNyWq88q3xWrRr260Ohxq1NyI5WgnfkLz/jC5GOtShOxv5qV0LlAYY6koSKkzDs7QFPGcgF5mGz5dNFIHQGELDgwxKQvpAVWnw7WLsAkttbwp+1z04n/M7MohsGtGm9aHPoHTiNzCQqIuRGvjDC+eMvH4kSBYzvZuBjJBA6jfh8WAke8cfDknd6QRzl9Kl8jQ9xWg== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc29c0c5-9943-49c4-e2fb-08d8428e2fb8 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:12.8371 (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: IbFHE4C+WJLG0EkRKJg9bJWDwRKRGjc1yfQYPFRvTjM6cpTTx79f3BW0r8wgaikXkarNbsMndKi2JZEHvLmbYEeW9F+3p7yzpxWVXymaGeg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4852 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a function to check, is it a file-posix node on top of file in FUSE file system. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 2 ++ block/file-posix.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/block/block.h b/include/block/block.h index 877fda06a4..51e957f6fb 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -787,4 +787,6 @@ int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uin= t64_t src_offset, BdrvChild *dst, uint64_t dst_offset, uint64_t bytes, BdrvRequestFlags read_= flags, BdrvRequestFlags write_flags); + +bool bdrv_is_file_on_fuse(BlockDriverState *bs); #endif diff --git a/block/file-posix.c b/block/file-posix.c index 560d1c0a94..4100b8dc89 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -324,6 +324,27 @@ static bool dio_byte_aligned(int fd) return false; } =20 +static bool is_fuse(int fd) +{ +#ifdef __linux__ + struct statfs buf; + int ret; + + ret =3D fstatfs(fd, &buf); + if (ret =3D=3D 0 && buf.f_type =3D=3D FUSE_SUPER_MAGIC) { + return true; + } +#endif + return false; +} + +bool bdrv_is_file_on_fuse(BlockDriverState *bs) +{ + BDRVRawState *s =3D bs->opaque; + + return !strcmp(bs->drv->format_name, "file") && is_fuse(s->fd); +} + /* Check if read is allowed with given memory buffer and length. * * This function is used to check O_DIRECT memory buffer and request align= ment. --=20 2.18.0 From nobody Mon May 13 02:18:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1597656855; cv=pass; d=zohomail.com; s=zohoarc; b=HUch73OFI5JLn9NVTrFS7vex6mKbl7KuNArsAS1SMfAKiY3onKpEGI8zJKJYo3cmeV22RNR1VLgz0qVqPT+0b0fA7XP0H6khmskLac8v8EXEIceYRWOlxKpSwpqmiuSMPBMechC6h0mUpxwki4u/Okcxaxw+iw/tBoiGOUtwCAQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597656855; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9umXax7o65jnZOIGs4fX9mg1dWtR2FDxxk8CWQKo7B8=; b=cQUxNQiFL+vUaCHQ3mnJ+cJgbmLOYKr0vhJjUbca408iCWrQzuCFfLo5FQZEIDJ2iDmdyqbY+L0QwBdPvzGNBIXnDQCijUalhpgjGrDc8N2k1BMHsHfpX9kILziaBuNKMiGtziIEeNmgDlzpghRkViCGA61hA/P/s5waoM+c4Hw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597656855184172.13832465376925; Mon, 17 Aug 2020 02:34:15 -0700 (PDT) Received: from localhost ([::1]:54314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7bWv-0007uR-Rj for importer@patchew.org; Mon, 17 Aug 2020 05:34:13 -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 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 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 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; 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 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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=3D/newssd3/z FILE_OPTS=3Dfile.filename=3D$IMG COUNT=3D15000 CHUNK=3D64K CLUSTER=3D1M rm -f $IMG ./qemu-img create -f qcow2 -o cluster_size=3D$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 *opaq= ue) qemu_co_mutex_unlock(&s->lock); } =20 +static int qcow2_vz_insert_prealloc_filter(BlockDriverState *bs, Error **e= rrp) +{ + QDict *options; + BlockDriverState *filter_bs; + Error *local_err =3D NULL; + int flags; + + if (!bdrv_is_file_on_fuse(bs->file->bs)) { + /* Nothing to do */ + return 0; + } + + /* Assume it's a vstorage */ + options =3D qdict_new(); + qdict_put_str(options, "driver", "preallocate"); + qdict_put_str(options, "file", bs->file->bs->node_name); + flags =3D bdrv_is_read_only(bs->file->bs) ? 0 : BDRV_O_RDWR; + filter_bs =3D 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 *o= ptions, int flags, return -EINVAL; } =20 + if (qcow2_vz_insert_prealloc_filter(bs, errp) < 0) { + return -EINVAL; + } + /* Initialise locks */ qemu_co_mutex_init(&s->lock); =20 --=20 2.18.0