From nobody Sat May 11 15:06:15 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=1597414010; cv=pass; d=zohomail.com; s=zohoarc; b=Z7lfCVEpannBVkxf1zZjbDujFmZLzS3DeASQoF02h0aKdhnGEEl4FaEoRK5/0OA4rmr1dY2SiaWrCny9ZpM1ZcuxM+XOYlTVfXADjX5GyT4HW4nTuZlS0SF5Or8pgGnsyGcmr9JFJc4ptu8Zdwa/dndOZfQwNnnKpFMnSpVrJRQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597414010; h=Content-Type:Content-Transfer-Encoding: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=0180ISePi4giOfxzrK8nRtVyit0YCa4z0sQ/annAsEE=; b=UN2WybEvmSBxfgJzesKuPKWJLnEqLGTahr+5NFhfBtCsAXBVUyJ0evv7iCP00Kk6CYoWLS78zl+gFM2mJrieYy69BT3Xgo5Nf/BbXKxUAzKV/Ve4haC9R8zvAWbcgnaaMg74vKiRFEsVdLXDeadkjJal/8OEnIUW8iO251bEZGY= 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 1597414010037471.23931373090136; Fri, 14 Aug 2020 07:06:50 -0700 (PDT) Received: from localhost ([::1]:37356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZSV-0000ef-AT for importer@patchew.org; Fri, 14 Aug 2020 09:09:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZO0-00018O-GV; Fri, 14 Aug 2020 09:04:44 -0400 Received: from mail-db3eur04on072e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::72e]:48915 helo=EUR04-DB3-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 1k6ZNy-0006dr-3b; Fri, 14 Aug 2020 09:04:44 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:20 +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.022; Fri, 14 Aug 2020 13:04:20 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mE7U+KDB7fu0yz703Uj4HuIS79kx+CdPPFM0qo5n/dmDKpXnNgA7sIgWFQ3BmbD0P+uck9UQWBl2jd5lic4bt+RSTp+0xmD3jFPXFEaicsK5SicuZLkFy4B2Xlj2G6djk65fpU7k4Vn0UATMgg7a6dLyH68ilAnu7V9o11wYS6rRshohHlvh42t9v7nPOHSzaaYp2VdZ8RMO/NOc2Nv6E5BixtWrNP1fHX1tQPrAf7QHOY4k60fP73gtep5OXFYhdBDWYPgGGyrmwfSp5SiNhFzcuGqh3s7muzdBV1zw6ZQ3y+fy15v2+Vk35QCL++FirCsnEZ3P6CXVABY7O1J37Q== 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=0180ISePi4giOfxzrK8nRtVyit0YCa4z0sQ/annAsEE=; b=Nji/zPIleq6dA5Ve9nBj/DrLVu1uOvx0xV3VhFsne5zh/MKJ+s1nytuVh95wu8Qy0wfq8FOvOSyPKxZnlTccQC3G42+foQQFYuxACItvr4PX9mkIVJA5sA/2Jb1bHfu4fgDnSYGRtW+WvG2e2cInVg9pk9N+aR3uxIVDzoUFavdLcd9zaTdT4+hT+IHcYtHiqNLcvC131Nn2wCBY481UBzzdIPuPSTpY4PnJdLyEFkvOvKtN3q4r36udGiXDBIQntp+siW/d0xf+yoY1uwiMtk00VQu4CBuVeiImu44TI+MSZxk+MAMqEs1zJT/waJhDaqz5vSTyFsOecVWVZzQZGQ== 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=0180ISePi4giOfxzrK8nRtVyit0YCa4z0sQ/annAsEE=; b=DOiGUsmhp07K5coy/x2xdXtiPtUsRPbnq5imCdgOMVDWQjF0kEW/DVu56B4NHQ0STxcP0rBQHLiP4Yb8N95NEoGjcLAlq2h4JrDjAzao23Yz60CJzjtgDeuNsKX+FvA2k3ZSmuhwHaKvpCe7mXCgdQElKAkNZDCsXvLCpy1dDAo= 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 v2 1/9] block: simplify comment to BDRV_REQ_SERIALISING Date: Fri, 14 Aug 2020 16:03:40 +0300 Message-Id: <20200814130348.20625-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87bf6765-fd2c-4d06-1ac9-08d840528eef X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: hyEbepTJ84HO4Qts5MazCuNx7AAu62yAYI/GwZoSYCXcOE1vvo2X7pewo+O06wcSxJ/UkL8Y1yY+L93gd597GyMuBRsgFqwZ73JKF0j6YA+dL3/KZgEnxviNnIwpBcr91+2gsSzernZpRz/8EblAiZRxH5Dqy4KApaMqZ7RJ1YC2A604CEWrppXHU63RmEeabfoouYwQTCJ98PaVE+G14zUG2IWZxEhBhS+7GT6I5Zk5aZeBizdeGX5e2iAo6D3zogPSDyREDczEhghE0PyFCsIm9moxhUDFwxghAgrorjyVrCiYHcAg9m/SJ6Wd3ndnU8qNO7kEibdQloO6nuDlqw== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: oF0KXHCrF4gmS1QLl1HB4+QwCzmtkQea/RUMvG/cMMzkVMV5otZ0TeJurSUjcQPJOcBuzpdEwpfkBsPYZiGY1v5SsI94anJ+Jp15Wc/Hz2m0pX2sDd4zG5Az9CLzgmPiGvZTPi5aNg288GPWQAP4R6xXjSpYVPjDFEeonX+5z7jPucfBaODcGwBRqg24ttTpZMTRtWW9o6SDEvwpXwHij6XFHrsUvChgnsZ8+5u72JoewaiQWO7d4Kl3QBxUEu2uxAJO7os5DEpRqNh1BtRPEQJ+z/3uTkgdxLZiRK7vFzKEqprHXamcGfxH8LM8+zSmNdMIGaj8D+zwoLrM3nlPHGS0KyPyR2OgCGdlOmKircPJeXaRXw24QHlhmND30FsAjTcSDzd2m5Y74c7UX0NJUmJtbHtetEsIuBdQINt8/rro+ARa+UBpIqiQMuTSPsKH8XgytXGWlQPoJGehIddBe24jUMCpBAcHL5J/JF7udObEeTsXEPZa7C36vhHgkN+eFLpQC7OHDR6tAJZ9BtVOSpKxCSeoYGnGV0XkDV8AvTF3TTonMY/eYv8M5gAv4w+1uTdhf+f7DHfPHufVQ6stXLHj29dLJamd1+kDaJGUjXK6N0BkPBvXpa/pMYbgda9Z1i4C5DAVUi/PfugrwXBJAA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87bf6765-fd2c-4d06-1ac9-08d840528eef X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:20.4705 (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: JW2US/Td+pUcYpWdF/8iLMiLxQaAtRIKNDlOiVINm2lDExEbhCsSyNmG81sGWB8U13mWF16IgBdNLFa7CmWPnxi5nB70rTMLlFhu+BVhJC8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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=2a01:111:f400:fe0c::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, 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-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 --- 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.21.3 From nobody Sat May 11 15:06:15 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=1597413367; cv=pass; d=zohomail.com; s=zohoarc; b=nk1od7woGLO/ZZgYr+f7+UcnjzhulQpZvGt1wy5+WmzHAmZJIysDIFJO/CmyG9MgNQPEFarZduLdKpMeFP18t/MxQZPwLANkkqlYzrzRZiYIN6va35oIJRt7E2SyVko3z14m5w2PLIXV1PVd7HNCrA2HYehCSdj6ODcZICKwaeI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413367; h=Content-Type:Content-Transfer-Encoding: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=H80UglqObXKnQlcaClJt4BPJoXYsU9fxtWr1yMUlV5Q=; b=fG58/Fgc+wng3ZsG81ZFYJ1ta7Ifadh+YI2hmbCIL9c2GIK1CYUpvqTsj6qeWtwjrLekdgQUm4VOllJzeb+kROfMwBYuh+H/+k/qZmif8S2qo9BZgdFJeO7T1jG57uQgcUICsbQqAj4eqsuqYBvedR8VXTLc7oCZ9rWZrjK2VFs= 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 1597413367950409.302734342608; Fri, 14 Aug 2020 06:56:07 -0700 (PDT) Received: from localhost ([::1]:50060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZP9-0002h0-8m for importer@patchew.org; Fri, 14 Aug 2020 09:05:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZNn-0000vL-Sf; Fri, 14 Aug 2020 09:04:31 -0400 Received: from mail-eopbgr80129.outbound.protection.outlook.com ([40.107.8.129]:44769 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZNk-0006bp-Jd; Fri, 14 Aug 2020 09:04:30 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2984.eurprd08.prod.outlook.com (2603:10a6:209:4e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.22; Fri, 14 Aug 2020 13:04:21 +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.022; Fri, 14 Aug 2020 13:04:21 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a6wUS4IwQxsrtmJ/4ta3pH+OPLym+Hlj5Y6UutUDv3hTnAQnIwb3LNvSCz/TQBhP6RG9U5/UpRWvWIIH1rctjb2HL8Bckfixv3/g1q8CcjAEQV/g8xx/y4kQenbF49p7iq16fGSlL7OoyRts/g+bOQmndMPGLrosnWSIU7d1rWc4w1TSSuC3eb0aH2DOfHl48ymTLo44tYuOZkVVKpxSbhxSpU0P89ygwB6ze3OEVztXGKV5K9XMeGMJ6Lf+a9QbowCqE2JlTVM6RYjTaTUUPL0QR041X/HS6stNh4mWqB+xFsrkkiUq/X/6n3vuvLknQX+jKb2/v9zITQznIyIaYQ== 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=H80UglqObXKnQlcaClJt4BPJoXYsU9fxtWr1yMUlV5Q=; b=knGNf3fp30uVE1F21b+lmYSuC2I4Fq7+zHztaQk03gEnuggY0GIc3dk2TCHZYxDBibu2lQZ8NqfYAG6hjY6c06n9kJFkZQ3liLHmRZSa4sCCfzeauK9Zp6SyHp26CNT+whdQIqlPLHXOlzhPoUDHjSkDP0SNdXXUcBLENpR7u9xvh3f6daDJcpdRM4DXBbrUMPsyc9lePdWoIKlhwiMGhsp7twhfm9EVNjjTWTN6H+i+bJQlLgUJ4Xju5dU0t44lFchD6qveKC2eBMmgqPiHS624pM0kQPj0X78KB9rfwCoQzO/PHoOWdx3+qck2Qseps70rWUft/WHVF1aOKKGNOA== 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=H80UglqObXKnQlcaClJt4BPJoXYsU9fxtWr1yMUlV5Q=; b=ELcayAKOfji2hSkzvVa3Utr/hq/GGn2klfLLPFu0ZcY4/gMgZIPj3ni1BhqO/AkpoqLVVeN7lspTubMQ4UTeB+6AVK4IZ4rluapZkV/p1/Vw7EXxPYjZdIVSX/415nlNq/MlD4aL1T008Wkoz4e0b3At/8QQ4robzOJynpe90IA= 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 v2 2/9] block/io.c: drop assertion on double waiting for request serialisation Date: Fri, 14 Aug 2020 16:03:41 +0300 Message-Id: <20200814130348.20625-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79cdc639-ddf0-49ba-54a0-08d840528f87 X-MS-TrafficTypeDiagnostic: AM6PR08MB2984: 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: 9+xrzZal1kCB5RJY5lqooZ2dP6CQxeyPQC/7Dqg5mMXzwNaKQJHY9FQCRrFsclRrcV+OMoGGFylP/9GTYeEcy19yYfKJp6iWdYCs/i4frIQ9/ozbXT9VrylXISSmIgS6h9xstwuIFEFgyfTrw7EPTWo/6bcZjR2kgYF9cL01jGxCA8yqx+Yww5tBWkhc/TscsbUbmiTrtIbOAPO052NRGMLwFKi8uH2qKykhjj34hKXOHdLGJLmZfZQqX/3Iroq2RhhexYO1jntdDGRBWEbFWzbar4UofFL+nge7ozYHBF5kh4OGYysbjFLg4ug8USsEUXaC/wZObuY8RQxHmrA+2g== 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)(396003)(136003)(39840400004)(346002)(376002)(316002)(36756003)(478600001)(66556008)(66476007)(4326008)(8936002)(1076003)(26005)(52116002)(8676002)(6512007)(6506007)(16526019)(186003)(86362001)(6486002)(956004)(2616005)(5660300002)(2906002)(66946007)(6666004)(83380400001)(6916009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: yuwehSs52CsfCkJI8TqB9e/gs2mCq+7qbISSPejdoBJXcBgnwwKfe/bWaXnP7EIgf2phWRt3knN2cqVcb3CY6CzuHFKeu/4Y9nssPSP+TukiXGHRuJ48ryXznK44HeJXYjeanBLElttKCxCU/n934zOXa9hXvG96shBVWYYcfgDfUnK7i77UtCiidHRiW4tJVH7uUrCQFNtptpuCh8U731HXrgemXfawNCvxTuPcQB3lsDOP3UVnJPO1++aZkJKorDCNKBUbS0+Y9Ev/BV545scjxMGeAe6o5XAzep+HHBwZfFPQf3y35LfAvjrcJF37ShkgvUg28ko6v8L+Cbcqn4CrocN4J7GgqyQ89ZOisbrOTibCS9epe9nLoLwr8k8IcZZWyQZ7jWTZp77qvmWL586w8WQO/jhwL96gLWw7mnerj+i7Ks7dqd0WfUyZhWzsc2W3BgJV0/D+NPt/DbwdLotFPxSH3J9FimDFQ3E0WWrM0jAa7umvhF86ShfvLjqU67wRrmCuCQiH1ARIKtGjKdK5R0XFG/d3CYzPslbi6SUQqcI/ImoNEAneAHGeKsPLcbs1QzFFZfOJcw2Q/yqfoD7tCpu2C3dW05VerSwzCKnOrBekfhaaVKkAEqoxuRZey1e17KcM2cg2nrhSmO700w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79cdc639-ddf0-49ba-54a0-08d840528f87 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:21.5219 (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: UwtEj6Ig7Qx/2hNyw6vIr1AJsOTQWrJJEcyuVw6MAccLni8O8BkdB+G7paX9SGFgpI6kJjoxKxVO3wnr1bs4bXIhneOlXwDoK4IzL9OvsRI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2984 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.8.129; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 09:04:26 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, pbonzini@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-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 --- Cc: pbonzini@redhat.com 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.21.3 From nobody Sat May 11 15:06:15 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=1597413189; cv=pass; d=zohomail.com; s=zohoarc; b=MSSW5cJf8lE6cmATAkUbQWwSkvkv716oA+IoVmqA10I5q3dflX+V+k7wDypiP+oSOWHGHVCK7c7aDiVkUZD8W9J5SCRr8/pnaD+Mko3/UjxxeHd7hx5RXeoeMmdE9mR+lgoge9c6bLjAN1IXRNoi9U39PR4Inj3Q1lWBOaZLZbQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413189; h=Content-Type:Content-Transfer-Encoding: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=Xt6BKgkearNoA7A2Lu8N2WLeZpeT4qOhZFDsJpPCm7U=; b=AmefNwvsjijymhoF2JOZ1d9rtAvXcwOco+/8ejt8nRVyNbBSazw/Jy93UAi/4Y9bjmZSW0cDvf3zmso0smHcsP9zs3hwP9OKAb3HJ+1OGzHEiUavSGNabb5H3kbbqcv1ASKo5jK0kQ4qBbbUIOeHSI9qHXrIn0h2eZOPadY1DiQ= 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 1597413189160736.0993906100086; Fri, 14 Aug 2020 06:53:09 -0700 (PDT) Received: from localhost ([::1]:51418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZPN-0003FK-AZ for importer@patchew.org; Fri, 14 Aug 2020 09:06:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZNq-0000xQ-RY; Fri, 14 Aug 2020 09:04:34 -0400 Received: from mail-eopbgr20139.outbound.protection.outlook.com ([40.107.2.139]:54037 helo=EUR02-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 1k6ZNp-0006by-8r; Fri, 14 Aug 2020 09:04:34 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:22 +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.022; Fri, 14 Aug 2020 13:04:22 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jx0ocQ+plNSdIMOMu0xiuH9NSYD/WWJYxIHQap2s4jghuU5JVXrgndtpFuu7fxhAV+Rweb+eZxqd2QQWLicVQUUkbgW6Ozi/7th8BoR36uYEF07A9r5GP+1So428GCMPo2t8xdBnCS5jVO5lUeNyz82S1KVAWG8kS2McjHLEvar+xFqOrevZ/GNDWDJU/k02XsVw9Y1kE+LQPudeFy8jgP2VJT4ozMh5lOcARHw/L5VWEXUXVxmPlvQDDY7VJs3y6UjPO50PU1T+tQh9eItbmyGxSvpWJ7gkCgFUhcnh9/fMiP4OM5OTZ5rPLyIprDLn6D6RiYEEzCFJMHdK/PmGVg== 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=Xt6BKgkearNoA7A2Lu8N2WLeZpeT4qOhZFDsJpPCm7U=; b=bpxbfwhtiJjcbbx3e30+1zPXgeI6JHJTpk4Hq09khLVJvGRO4/osdVFBPzd3a4F7c4Hw8MgfPLQUjFluIwIezsVPyxYecVk2cjZXZ5+Tq2+fnFRCyx6I3/rr3KzVB0U8JSn8Tyxu6Z/xnNYDSK9QykzwgEYdpD/UyPn03p5RqE4YdmKPAL6zgGEz449o6lXfM9G7VE/dlZ0XN4GQk3LJriJF1K46T6Wg9g3lgaiVseyh4BCW0+J+tfdwpyZDiyX7TMfiHlLlNaxxZ5WW7E58jpBeTt7S8hQhlU2h5S3tpw9qeKKKSkLHZqImT5wqfGZJYt4g+qhtSg+jh9o3Sd2zCw== 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=Xt6BKgkearNoA7A2Lu8N2WLeZpeT4qOhZFDsJpPCm7U=; b=JIs07ixfyDdslF6euPRONr60fTO6bfuwVRxZQnEaua3fzX1WiQU+myE+wWDE6HlkAuya6kTz3LbIypM+vOHKmwlkhdVQ73LpXSQVnl9iksIf8W7nRcpJQG09MvFCTj8xvLzcUUUZqNPXtyLaA9CbLW6V7N9msstkJqIGKvDtFHE= 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 v2 3/9] block/io: split out bdrv_find_conflicting_request Date: Fri, 14 Aug 2020 16:03:42 +0300 Message-Id: <20200814130348.20625-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e8842d7-74a8-4e60-f952-08d84052901c X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: fokP7NHS3Of4vsUkUPCxs+T+mj2NUSk106gz/pIj21PlM1oJ0V1W5BcT/hufUOuVooDBHQv8UlE5ZcKUmBKrpOemljavhJ/9U5TCsT3OUjpCHzVkkePPAIHu1uRX9sRD72D8iAKmDpj0TrJSsf5X4cKrG7UmLkRh+i8Ph5hFCa4Cq6/Lyj+JvkGlpwYRkJoJwXnhtQhvpw4ndWNUkzKcWgxWbff5lg6j8QjSDSs1/CnzE7okSUKzNYzQAqrO3EYB8GxSjX4gVjKwUR7a5fD/QaJKBQYThgnhn3HdIS8wWjvXlWJA88Vxe3vNfrn6/AWmE4X1qKjevfzXZdaPYnOjcg== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: evXrFl27hKRy/otG9sVySQB7Tt0YNojNOp6iHYZibdTLvUN5o/fA4LcJBtnMbq1oCPo+aO4KFa4z2FqJOY0OZMmkwGz4dGWhOBC/ctcObbMQvlO8lwY5pveP/mvmr0IPqGKzdgvGKVSPkhQVFjdGudOO1BgL78JueyxDC0sQ8P+sm2napVQ+T4xtvJSK/MqzDtPnoA+0MFh/XptF3Z5G5taw3t7Sa3q6xfh5iNJHRxA5PzGTOgJQ9T+4xCFsHZqXE2MMzbxlrrg6HVaLP9Yn6jShrY4nZ6K34Z1iZ0J+GjSUrjz8jSFb+0L5Sl3OyfEl1kesW7213RfON5dOgKRHCPhnasCCW/lYhWRAoqjq6nsqB4lQRAGoupcZUkKp8DDLrF+stnaY9UEwGRHHBe/8iOq9YU9Qi6l3xTSZ+fj0/pFT3jTevbYJz1mctEFW5wLbxc6WzAYInaw0HV/fi5bMpoykruOujd+SPAfMFnMKtEdvZTJ4GhTT+XDEVxXln2hKjS50cZb+wKa8fGhyOiZsUuQqr/9Ccom3mg4nlfgWPx+gnAPMhv8ek4fei9nO9GPBCNMsuvZP8OijMLWyguwKk726zn2YdeJ6P57aTCqnVW8F6E7FSlljcnvZ5GxfoxuTL1QiJP4Cl2W2Hh0sBFF9yQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e8842d7-74a8-4e60-f952-08d84052901c X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:22.4957 (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: yR1fco8RN6oA0UrV+0paBt8TRLlcc44WYkKMYKfz7FtSvP6pdbwslxXulFv/xy4l7J7G7Nz7P/X5ZIXjLFXQ/YQ2vBQ+BcuoRd3Ao/Cuwz0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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.2.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 09:04:28 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-Type: text/plain; charset="utf-8" To be reused in separate. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 71 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/block/io.c b/block/io.c index b18680a842..5b96715058 100644 --- a/block/io.c +++ b/block/io.c @@ -727,43 +727,54 @@ static bool tracked_request_overlaps(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.21.3 From nobody Sat May 11 15:06:15 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=1597413519; cv=pass; d=zohomail.com; s=zohoarc; b=F8Hu5LL95W5q6aLXK+PJcpM9UClrcFBN3N/zAQf00YDWhbFWbbavZU6xuiSVsRORavDZmCO6OE8j2vHd+xhzNBFTgLzHEDK2Y9LfD33aSrHpgbarfFpFwwyygvx47a2PbXwjREGafq2NCQo3hakqNt2/TnqMriNcaI59jKmLS+s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413519; h=Content-Type:Content-Transfer-Encoding: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=WdP/EqKzuzIg9SGZYyN3O24rPXtDSLay6nPV5SwsRSY=; b=ZQTCFDBFAvEABEN/O6fLkDLSotnjl5mQz/Rn548VmVthT1I6ht8Dgk2UxtaGtEu4PxAbRIRspJwkToIvKU/DxZwFi1ZFjse/j4WwqpsdaUTakJjzIbY12kHVALQjI2xM32E6PgBbZB4eRScoMAQbMW0bG7k6zBz4T924zw7EMyM= 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 1597413519330564.0023224851057; Fri, 14 Aug 2020 06:58:39 -0700 (PDT) Received: from localhost ([::1]:51072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZPJ-00036r-VK for importer@patchew.org; Fri, 14 Aug 2020 09:06:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZNu-00010n-2G; Fri, 14 Aug 2020 09:04:38 -0400 Received: from mail-eopbgr20139.outbound.protection.outlook.com ([40.107.2.139]:54037 helo=EUR02-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 1k6ZNr-0006by-G8; Fri, 14 Aug 2020 09:04:37 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:23 +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.022; Fri, 14 Aug 2020 13:04:23 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uee0q6RZB7ZH7maYJpFnI4oI4GQXJR6W/8/LiOaK0qerqUjQJoMGzsnhyEuQPAM83vbPm6QthfIp5zLrGBhzRl5sF8kWg0wDmQjxQVT8g4Lw1QwSsNsVEJSZcuWpIb7KRZ038PP8CbYPdHCM5pqd8ea2wkNZGVjwdc+00NgEj/Ow6ctUI6q+3S7Igrvh9C1opSY17hPKsWIQa4fqEzluaas3fY5m6oMIrGsXvbygQZu22NC2pQ1n09LQ+QP/KR6QzbJKqLsBWNPTSDwdvag0Oyd3w7+2sqE1FeBLK2LwAAFR+V/qTIZYEM5C3bcpmxThdeW/Wct/c0NvgyCyNJ2Xew== 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=WdP/EqKzuzIg9SGZYyN3O24rPXtDSLay6nPV5SwsRSY=; b=THpQZfX5DWo3fF1VUG2WbMutUBDIpQNJp0wRLuYeLv2yi4I6IUN7mAkfRV/2UxNIshh260JyHgd5kzJz2VgoY7HV07K6bnU/vMXdJexzBAT3RDUcsTfSLY1b8AEmZS7Zcl5JDpKN4AwB3Z6clnDmTKFiTtrnSWFtvvow1p+cuQ1uwtJO21uqPdiW07t6pHSIKNi8AZrqN3wRXvBGnPSGDOskbhOy4erFwoCY4zyO+w65BWG4+zK1ClEoenSlTdxuimZ1wMZdd7Jb1tQ/f1Q/xUdaJlHnPjRH8nxJavZ7TtlXOblG1n66A7ltvY0+XQW7Fimhn2adaA5x2maa02G0lw== 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=WdP/EqKzuzIg9SGZYyN3O24rPXtDSLay6nPV5SwsRSY=; b=jE2U/ZbNEbLiuzfTQ0PzqxFOdoNSkU1h3ACOaq1FDMQaF2Cucbxp5+VTx4N5JtnZUZe7f1IeN3t8afWjHz3FY92hRftT+xEn5xTIs9dLqgRZg0tFBmz+ChZPjkIjT1LRf4vrk7mUf00s8XKpKM6q0zN8ihuWgStteHgLAHqqBmw= 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 v2 4/9] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg Date: Fri, 14 Aug 2020 16:03:43 +0300 Message-Id: <20200814130348.20625-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09843c2b-26d8-4801-2fb7-08d8405290b0 X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: Algk3QfeUYeF73hbaV/VU6rM0PT/srX2WyfXhnYmBOXdOv+yK3E3DJSNqu1AvGhl7sGm4NMpJ7Rlpd6fokskV24zkjX37VQdn8+7lO6xTgsmrayPlnIUD/vd415YZEU8DSPSJhcBOGhcasJ/xwPYtn8DutLotSbMubvvtCubH75xZWJoUN94S88zFaa7szQ06Org1mxDpjpYH6JGpJ1gYz0USxTjFWyappZOxXyTL5yXgYVdeEmz7r8VWP17yrNyKLZMqd53I9fFQg0ixRacjiMry3XZmIu9kn7KdHJ3EQgPYDXMCtAwaoZ3XMZbk/APS/nfPU0Ho9irPx1P+H7xqw== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(45080400002)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 7jE5IokPLtw1NXg53MgfxBFBwbidyuOtCm8EcYb3dAA1qjw2BFIK/7hUw7v5vNxUsRhhzCisyQ1jPjaCd5Gvnj/2FpPJkTVdsNfUw12nBrCvUSy/ikTg5uZE9Fdd2+euPbntIEYvgGJ3KsGRD+wcn2JOJMHRJ6k7zQzvwMqqWA7Mx3T8XahjjzlfTbqs+660l0y4L/FXSv8llHpmSTcF+taFVf0GXhieJpbAwdCBcljir/lTXLCUynjVZjhhqmca8WVyBbPTt2OmVaO5hnhZqhPvbm+UvyESZDRz4kKqeoT2VW+tqNXBK5A89Kk3gSD18oNgLsAcxlJyOGz1wjAEeUTBwVnQCQy6+9kg/ApG36WNJcWsHORi0tzT45zvG4W85e395eukcjC8Q1LJl/GBW1RgGOMglRNgbXXNwcAzMNRKJshk6RcyA1vxFz3AT6keqiNFzGXNxaAm/c9E4zxRrVTgHWYgs9k3WDL9S2UWRSoVPyjm6sKV140xL3uzmygfqJ2zADMe+0JA1u6NjH3clD6q7Hcsnopk3uRaSA7K+YlbG1tD+C6LaksxxE1xEWFVOdGnMqJwFQ5ZC7tTsi13325xkIJWTkwPGWTkrVh0Q0PVEueah948jiHdan6fQp7AXJHTS5hm4l0oCHx/drFjKQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09843c2b-26d8-4801-2fb7-08d8405290b0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:23.3240 (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: +4ScU6mK6tTuPpgMllGr7DpcUvjGfFmJ/WjDUEcv24k1dMmXYz1gazB96BZK4Bh5zf9M+Xl5e2zsfgIbbYbV1c11+e+U0X34xJZbJESZs9I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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.2.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 09:04:28 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-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 --- 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.21.3 From nobody Sat May 11 15:06:15 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=1597413345; cv=pass; d=zohomail.com; s=zohoarc; b=eLHbedLoccjAf5ZH38gMp4HDNGCqE2C2MuhunkLaNASJ0MQHKLWsSvbsjJAHJdf5i6nSkuuokO9nTInpudIMZIvmkeSxeYeR9DzeRATogYmOwp3D6y3D10l1aGbVsLgrDGvIghLfMAeJkr64wa83nM9K5kirjSz6F5vB1+CytiE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413345; h=Content-Type:Content-Transfer-Encoding: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=Fi8aKkjFpdA4s0JetTP2PfIGUeilQxfu+nNwrhx6E74=; b=DAPJP2sUEGtyUpYk/T2Q+TgA5ORHfvLGulWjSe3kO3whTfBEkkgPEMF/cx/cjFjw4AT8Tj4E4wzmCrf5byeoOp7GSDaPPq0zlFoSRVVUfkVFfGgbsrp6n/PwTdUCmqk0uoEFz80Se0OqXZFJVweQ3UxwTlsi/HA0kqL9eAr0Yr4= 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 1597413345005297.2562266166011; Fri, 14 Aug 2020 06:55:45 -0700 (PDT) Received: from localhost ([::1]:58526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZQu-00069v-6G for importer@patchew.org; Fri, 14 Aug 2020 09:07:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZNx-00013x-W3; Fri, 14 Aug 2020 09:04:42 -0400 Received: from mail-eopbgr20139.outbound.protection.outlook.com ([40.107.2.139]:54037 helo=EUR02-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 1k6ZNu-0006by-Ki; Fri, 14 Aug 2020 09:04:41 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:24 +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.022; Fri, 14 Aug 2020 13:04:24 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JKzAXs29I+gXmIzCoIPeHCryA/Jrbc+sDIhtwJ5/fIOSREQ8zrGtkURE8FttzdY15UILnG7XJ3VxaCHQeIfZMNcyFVZEeep4UOxy+hQcdKTBF7E3ekiyplX1Johf34XdJuAxfB+U5qAVcRcAk8zl2uApiZOdwZtEM1emEgnJER4zP00nnSAcPKCtUSGT0qh4AVGW91z/SIpb7hJBDxCCB87iRHhwpxB2dW1LnC6ILUL0IL09KYvjy+BeF77aTCoWS53CuIVl9YCeMEaJsBN6h4VL6dCVRndui7G4W4JW57pJvJU11vanxZALcTlfh+2+p0IJC92oOLX5GPk6NgKuAA== 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=Fi8aKkjFpdA4s0JetTP2PfIGUeilQxfu+nNwrhx6E74=; b=JgVR6saPtQbAaGJtOTeKZzioSfdON6RcYeRxIRVCCTcEKiCWgoSvwvughz/rJ8UmMPQdodeKtpn+yA9NsFcOxyqZQ/XZlWLBXAQBneSSlpQG+8MxeiQl6tLHYjVkRVdPOFMibFoxyDZfLLiIJ31DoVJBVXPyXrhOH8CAar8gAWS3yv3huUb+i8SvrnIBR6Kr9/HFsTuHt4A/+mLC3NTXVGrJTMu4lDx7QHhmrDqTqOjwbF7s7FgXUkCtwBRLmLxJIMu/qFK3+327WIxHytZpfhz4KFPLvN2FNz38PdSrer8sppooFWV7gzpFCDnD0zEQpurHULmH0/Yta3BphkBHRw== 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=Fi8aKkjFpdA4s0JetTP2PfIGUeilQxfu+nNwrhx6E74=; b=ETMLPRhfQhHWtQ8WrpvYaYTDP7fKBPN9jDeBY4MSHZoY8edEIrNgpEiJA5Z6xNaj2ZWhaNM3YuUX25zSqa4pepUFXMMFnN2APUYs2+UCpTBwy4lqiX2VcHqG1cM7bYAEXHan7aiwN7di/euZ23i1g6YvNcY984KZb8lgSg0r+SY= 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 v2 5/9] block: bdrv_mark_request_serialising: split non-waiting function Date: Fri, 14 Aug 2020 16:03:44 +0300 Message-Id: <20200814130348.20625-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1caa6b7d-f66f-46f0-cf65-08d84052916b X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: ZBRkgiQvl1JSGfDtoh9MNzVPX3Nb3AUTgM7BF/sz69uTM1+ek0jZuNjc+ykuMNh6oE3b/WLKT+d+55Iod3EAQ9Y7VaS89Mhq9emq7iL7mZDAo9k5TvA3Fo7vUIU7zBGSCtTdK6URYG1cwH3CgEOfufQs7/WD+wLfQOWEqmKuGYXzSUI84Hxaj6bFhj57WeGPEE+PoKbkFtittFaeexO0gMnm2YCwTo9yPvyVQAZuGCMr4+f+xTXb70K3hWWG5qreKpaDDz4xNCtQsms7o1FvVQ22QvFJEsvcJmXEvt2YV1kiwgpd1jZoHL3gaTGD6ip5nE7TvjfDd9/AqkVmBMdfOA== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: mn3OxSI+3um8W7ym3GM7ETe+s8AHJdKXpiLvHOtL7jepr43zgYiHEyiiyzKTPBbSo7GOw5hr/aW5UCEJKZVg/JHtKmj2+b+Ux9JIVrxJN5560BX9IrgmokEkG+EvpdQWdv+fwtvBKES+dgkPkI/H6BbNY9QWWCbSm2CVwn+pORvzhcOWJ+GCCA/MTGor4lHve8E0BjEQyTMz5azcqJyeBZ9STPV5SaT9GgnZRgYhaRJCrMKOI/NHMYXa/Vb66AHLW9NWDmAtlO/SbV+ZWH3Mcrc6hAv3avAIVgfy1MVPTnAPGqa9YBLZy4b26wGCkmmE9s+AFH/miwvPdpgnzwmIOduBu2FkIaCtNYV2WhIaELKeTATZAREv0vnbST7+6fEeIxUvtK6GCRBsic8dIHufaqCTjl+lkGaqABPh96C/O9WYNGU8+KK15AoLFp2BzHIa4zLBVVf+HWZLeR7xcNcaDfzlYGGs76DIFmuQ0b3cRfQaOR/SWwaK/GsLRtAvrZeWJsx6f/8WabjSSdqC98fIEQRnMmVv0mlaVV5UnaS/4gMrH/Z9PxceByUDgB/yFxfK48H4Tn3fHwH4vNYaf96/oP4+xJgfP4mShpoy1GYTf/2XNZWhOV84WGaM1JwUcFqKXuZX1vh7FLaR5jOoMykE/A== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1caa6b7d-f66f-46f0-cf65-08d84052916b X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:24.6811 (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: 7mHSEBrbTbD6M1loatJZjs9z04CkYDxT2nxLPLHGRTwmK4NP8maczt5XIyh1e39IM8LzZW7XPNF/FzgszKTk/Tkc9MOOL23ZxSUjop9fWbI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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.2.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 09:04:28 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-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.21.3 From nobody Sat May 11 15:06:15 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=1597413304; cv=pass; d=zohomail.com; s=zohoarc; b=YVxXsBdjLXwCqaCTjKa/xwiEFSXotbG/ahEx4o/PPuLXnVOmQbLLX2Mp08MmvzGvhke2qwSeT7UY/wW3F0vZyo0ZkoZP2wQy/tbon1k3xD40P5LjixTV2pBJIGxcZfC4Pw7uYhmVaiLPoYTAjZnXettxrQ9MD9yvdtek5VJBtzs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413304; h=Content-Type:Content-Transfer-Encoding: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=D1jc8KGMcACArTVUP8rR2GuyCLG8sJUmHxyF3/a85Sc=; b=U2uvCJn0Heial8Bhz7ZfqBKBTftLJxlE2U8lgN3gLLKenxSgJhO4S3nXh93Xir9Jz5cdlqxlIIeQ3XfNlKNaI+6/KYFu8GESbPSls0iYjqi8Eat2zrNLs3V1NbvujMEZY9C6U16V5BbEFur6XB7LupDHVoNJx6tXUXH8oLiFHaE= 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 1597413304841504.8224932633011; Fri, 14 Aug 2020 06:55:04 -0700 (PDT) Received: from localhost ([::1]:51192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZPL-00039p-8J for importer@patchew.org; Fri, 14 Aug 2020 09:06:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZO1-00019U-0L; Fri, 14 Aug 2020 09:04:45 -0400 Received: from mail-eopbgr20139.outbound.protection.outlook.com ([40.107.2.139]:54037 helo=EUR02-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 1k6ZNz-0006by-2z; Fri, 14 Aug 2020 09:04:44 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:25 +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.022; Fri, 14 Aug 2020 13:04:25 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TWQX8kLQp0tFmjXs2n5zTEYf+ZeokPJC97+9myLnyyr12V6v50IsYkTx9ypDryXbFXXsYIO+GWMZiWDcHtY1o97YLs7dBBF1MOaXTQB5jIUdScHS5bngWkMjxwL493rva2vqgvqKbp6Ne3TqpuNb4z6N0Wv8XLhoi3GGjKP3KBf4XKjVu1kMzLheDBAF52ZJHwXqRl80TjEsPbrjz7aUj2UwFJPH0C+6nZJ1btgorkx9arhw1GBfr/c5BVi2dUejq/4dxej275ThWPNekUp6ShjYLWDsygHNnf9X86Cja/Vg+3H0n/Km5/Dx4ZrPc1IbQyzN6mcVU8l5S5wQFwBXkg== 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=D1jc8KGMcACArTVUP8rR2GuyCLG8sJUmHxyF3/a85Sc=; b=DnUh5y2RivORe8ME4NqY8NO7KUzkA/DnLIEaVuCcesmW7Tskndv+pUz1BVcwiR6MX4xIOnTKowKYJtkiuKbgzN2ryjfXy3XGll6mJuuB/LYyd1iyNlGkBagcrjLtHhmG4RV5ZlOfmgHzfM7WIMF8su1p0CTdfzbvaFaHWd81P1iDWRZRYxl9gj0FqHBux3ZoYfr4peZpNeJt/hZFmtq4w0uRWiT5bDvn1Pc7N9Mh00yMBGXDTMbGWKPpXHVXvnX+1QHac1vx7p7bsxRBDSOB5nbm0BPdOyXL8EDYffk/PKzyOV2RybkDzh6tab3Ap6qUaA7cp6zcDtJDreD7LWg8EA== 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=D1jc8KGMcACArTVUP8rR2GuyCLG8sJUmHxyF3/a85Sc=; b=o4/2g1guFbVJTvVt3A3fzgbgrJ/SNbUZNbToZ0IrVW4SFwNgxXi4Zuhth30fXUglvNKfpvMS/2q3kucr/HtJtp94KTbbmo23tRIiPHJxYQUCGi/q6nhnhijq76HqU3u7+si/RP1xv/qM/aEwZ88MYrXSXGpCAjCUA5OR9bGI5lw= 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 v2 6/9] block: introduce BDRV_REQ_NO_WAIT flag Date: Fri, 14 Aug 2020 16:03:45 +0300 Message-Id: <20200814130348.20625-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 12cbd8e6-7d58-413b-168b-08d84052920c X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: 2AqCIdHSINtwgBNhti9wU+BBjDJsz3WVKPVfyvOiDqCv6uA6KjrU3RC/lMiFtSTATbZA5kwtLnVfQ9Kpdn6B3ZLn4Su1aWEPcPHbDQ+AI4Br4aLXm4MVQNrsOoIYQ28JDgv7mzDfSacnSYdi861DVLPzmOhTjRHRV/isxC4V8ahKHoNDircHvzmo37L1Wsor+tlCqWeHeIGLaBK+u2lKbSUmawPR3kcjz7iwepaNFk/5hkROqewNKvgGfAviO1xdzrxSXvKhe3xVzAWVaVyMWrJxghOM8/Ah+SF7/H/5iiM+ljrp1B8KOo5jhx+JdEIUzhgh1rBBdL1jWK2KL0dvpg== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Jbxl1YAJs3unazLINKJi65Ifq1sdqQrWSvmyFsR8Ot92c5yyJTGIeQTkRSgY4guLmgc4szUZOHk6Xgd9H55qvBaY7nU8odOCMW7MSDCyeFJYVWCzaeF20Wqiof0/oODajjXPxLqAGEXilIhHtdudOEk1y0aWBzQt4NUPR8Dk/u/YXDRft4XTSqg4TJNsjFGYCRLlWSbXqcBv4mQK4KtPwR9Mis+QTIKkjFGu6UbZw0W+fPc0HUnP2aapp4IyQEyX5V1wC23xYS789f47FtYMyKf9p3dfHXrEDle29+X68x3MiibUeCyAXeoqPOFn9jveLrK3eQDAsPMzALquOVTrK7UOLzlkeouiE37HslrSPbipl3MydlLuhtmnPiqEsCZrQzX9CRJmMHuqGCpIe52Utwrx3SrAyaG10eZG9ZiFb7Qwoeu2gmoQ/FYsZqQCDKejsILaVUdaQuCsiR2KeG5weMtphzZwZEn7bHiK1saMHLhU/RuiWHrerBjm4Rpa28soEXhoirgiY6GydeO9VJnYnb78UJzDhHYOVbDvIWQjsT2yV1GK3ulSiAKEVhtTkQXc7+DnBC2SG57CqbL+AO4jBh3oNM4ibXJa/fS1nBG8T9l/DucwN/P8wBIdvS7naOkXWSyB/tI6stHTXnTeJozTfQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12cbd8e6-7d58-413b-168b-08d84052920c X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:25.7175 (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: meGnfx0eERpHOCOAYeVBxcR6F+/jRguVj8DbTl2SgNKeJKmGmGURaiG0X49nTcJoRK+oHYMuf5bayTGkG4q5TXgWneZcoKiQ8m1l4NJP7oE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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.2.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 09:04:28 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-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.21.3 From nobody Sat May 11 15:06:15 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=1597413281; cv=pass; d=zohomail.com; s=zohoarc; b=jutMfRdjdiNBGqwaemn/sLW407eJ8daNqM4suIKqR2JhpdcxFhlQpgZfzkzyC24j6Bi9UjJtQaM2j6TKf2VjRIUzrlJX8meCJ9+OG0zf5EyPc4RLDt/ldNL9d4BviyG+Eshu+JxRpymnsWvklBco+hC8qtoW7OnW3lvdULdRgqI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413281; h=Content-Type:Content-Transfer-Encoding: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=4jdTNlw17ygJdYj/sYwPN1cVj/SjYxHid3lWhEd12wA=; b=EUxZzwn6Mb5SyYUfNcHhxc5x4ubIIbLhLHj0iVKpcHybWpTUElhHjU9DQ5KPrLhwlr5/+O+Xh+F8Nc6dMjeGvS+08OBazUMbu3dhLKeAz8W/nowUfsIVcKYxlZB4TL9l31ETkDWQqVr2V0MEpVsvWxEwYXvLRYhLd3B6SX2LXWU= 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 1597413281656662.3841021926394; Fri, 14 Aug 2020 06:54:41 -0700 (PDT) Received: from localhost ([::1]:37136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZSS-0000Xt-8S for importer@patchew.org; Fri, 14 Aug 2020 09:09:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZO3-0001GN-Ha; Fri, 14 Aug 2020 09:04:47 -0400 Received: from mail-db3eur04on072e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::72e]:48915 helo=EUR04-DB3-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 1k6ZO1-0006dr-3I; Fri, 14 Aug 2020 09:04:47 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:26 +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.022; Fri, 14 Aug 2020 13:04:26 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EuFk86Se+0YsAYZVlRfRY9V2f3kf83GVOB8w2R64VzPCoHhR9nm442b92ld8DpJwfwivnEKNEDHIOnKdVQa7KNl/dUuFf+Vq9PvaGekljCd/z6VT3WWOuaFNTpUZo+CKOZi+Jqyv9XH0BFPwZDEpW3YPxLe0iw8AGnuw+wu99Kwz8pk1K1Qf/nV+rdkkq+Tr5fv/8uj+DWo1tLHGPERQPnj5TIZ+7qeX1qumjYQsIorC9jILl3cXZmaBqrsIP6ZPZvZkSpeYrZTIuHAIQubIh7+1jSGxc0gz7SuM6EeWTuwxVevdfOq94oAGUmbgpM71e1z26immVMoEfmjvL862sA== 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=4jdTNlw17ygJdYj/sYwPN1cVj/SjYxHid3lWhEd12wA=; b=eAvA479KB/vml0Mp3GwcC9Km9j5Kq6CLsDEXbV/y+qJHsJx3OEcIRY+DXE1c+YjJMhOiE8vJk0R0MWLvoGh/2yh3CbE/1kTf76n6iyMmTuptcqn3PDy+efrh41GyPeoM2SKuLCLtSpI+80af3lheIzCYIJDdaJ1fWDS6zOTFS5cFdi7vMI/NNTiPIrlM570MAzyk5Vaw4pH/FWIo2xQJvaKbu9nyij5ybd9XbwKP6o9qsqMAGyrftmlnTg3xXSta8ibTd9BODdUbwD3kI4Z5FSxIMv4FVSptJUABUbMCRVY04d+CCa3/U5dCx1oXlItKuToAtBKIDVc54/1cFIXT6g== 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=4jdTNlw17ygJdYj/sYwPN1cVj/SjYxHid3lWhEd12wA=; b=LmOBaYgytm2SMiltGy48fVEgG4JH43JT8J1sV5Ce/hCbLt2bbfRIf5FEuyMTj4SiMt++0kfjXqOJyiRNQnvnOb3cZ3V5put5Gq9UHVLVliLlSezhwaEJ/Oprof2y5Yb5zykpiDFF25KvQSlQhTHBrbnVAqeutoOOGbeUqISUMqc= 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 v2 7/9] block: introduce preallocate filter Date: Fri, 14 Aug 2020 16:03:46 +0300 Message-Id: <20200814130348.20625-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0efb814-a835-429f-df1a-08d8405292a8 X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: 9vDFExEsihrtR4w9kKORdl3NUz7MLaC1uzHj2o0HABm2CdxxoXsBinul/3sMFhJlx+ezO8yCf9/+vinvwjq6JnE9D19SPdIpfcNf+/SKSJB5YtztngLUdhEWFuhqXhJn1n6sHsM1MUltkM423gZcQQTp/rzx0tJ3Ty9Gphmw2zRSGqGK9RWndkl+oGy7GqlrsfivwpIyoLo/3wxvq5ff8TwaCk2NnMAi8QqwI8dnyvjH+Ps6qqyaFhBoE8IBnw1DJcUKje4NsP/N8+VDQERqxlGnDLTcL2Q+EPaRh0ZbKmJZorFB9cY3s1Eqzvcjd75QOJFYcldaWteVskT/C/EBysBIclyHGPooszGn2qwly3y9lGqTRGlU8hk55XqxurfbHjiXojHYcJZlToUwwEw6fZD1SnCXuLgBRDgJOERm0tx7+/DWp+YhOkTMBwjJbxn7hdj3kOoYOg+pnBktcvLBLA== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(30864003)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 4uuf5Tc7DoDRJfj/XlD63oUk+9BHYjM2ScIS+tFRB9odMyJC8pFaMkUfJkJoPpEp7EjEaPegBcq12zYQKBrJkJXOqDbk6A3/hvAnQ9rElpG720rWiOvqlF5fzRfMN5MWfypnnJQ6UIvSk+FgkOx1zu58bsDM+4L1CRPV2m+K5QTIGztAKpxvZjUXFAdsy1K0YEUPYe04FP0Tzt/eSj8+aYnU+nxGFL7qOhcPhqmTwaLpJp6Hw4vV9s4ONS5pzX2aXxgpjYNdhxl4bpzDnim++G7Regl8j1Osv/nKwZGdEw03YlRENDXRTp7B9hQmJxQp/+cEcUDMRvnsMcB5QOS4cKAjiiSTPJ641ROdlVGI1zRfWbkVC+2eSJNGtkLIylVBMGNP0W6zh7Xj1zbYW5/5e1WSU0LdeNCbvCdwsMC6/ZFR+aIpR/2x5qLkiI0MESScdW2xzLAYNb/wYhGbPTVeypghvz42nKialf8askDzMjVG7aPODmYIH10fkZ2czUvSsK0WUCVM/nYn4WQK/S4aSWSWCX6QHXQifjRUwjYaJp1JzQlSd9aiwt3OVxfqi3MlgyvbqszxzUGu/IZRCRXbLYfO0NCaSMkJ/+VYNXZsGgqdLTnaOGFCberxlk1VYvcmZNixT9gMiRQgxCIfOyxyTA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0efb814-a835-429f-df1a-08d8405292a8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:26.6893 (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: 8kzqxNE1R7vnobRoO6J1rOlsHbXTD0im1i5+dpYnhHyeLaSIWdQBn/fAXb8gfMb9zqOGqYpUKkoBRJil9Is8fRm+INDBzBP3/xLBrfpqeMY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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=2a01:111:f400:fe0c::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, 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-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 | 264 +++++++++++++++++++++++++ block/Makefile.objs | 1 + 4 files changed, 310 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..0673678744 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-align + + 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..7cc1cc1427 --- /dev/null +++ b/block/preallocate.c @@ -0,0 +1,264 @@ +/* + * 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; + + /* + * 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->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) +{ + bdrv_default_perms(bs, c, role, reopen_queue, perm, shared, nperm, nsh= ared); + + /* 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->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.21.3 From nobody Sat May 11 15:06:15 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=1597410634; cv=pass; d=zohomail.com; s=zohoarc; b=EnWo+KWy1Z/g8m/l9ftjG0FFlXXpDzWLa0SxzdcgpsW3kitFV1xOCaaFa+wMH70GXHXPVzXcf8iV6HB3Ko/MJzFNNrP5suNyOXnHmJB6gh9jiibx2O+TEPoNpS4/DD+gXQRdbwkR0HIlg/YMMhztWrPI0AFfDwKigREhu8bq5Oc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597410634; h=Content-Type:Content-Transfer-Encoding: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=lgJ43neXWXddYK6r0bzKLeoupwTJydQ6HKTEK0ovulk=; b=aV28AzJ5uH6uI0ZNh/i4G+ZPFR1pLn93f+QjEcMvL8qsB63W6txDHqK20I7g9Os1+uNmwzeGCXLdGCYNWsk+y9mT+Nebjfhange5IflKBRN6TBNTkpdHLE5HIRdVoUgcFQH6XLi6lG4aaoPpGKh2IuQO4dPs3UKDD+X4T+oNFp0= 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 1597410633832226.37111492882593; Fri, 14 Aug 2020 06:10:33 -0700 (PDT) Received: from localhost ([::1]:41096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZTX-0002BR-GH for importer@patchew.org; Fri, 14 Aug 2020 09:10:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZO4-0001Hd-08; Fri, 14 Aug 2020 09:04:48 -0400 Received: from mail-eopbgr20139.outbound.protection.outlook.com ([40.107.2.139]:54037 helo=EUR02-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 1k6ZO1-0006by-KU; Fri, 14 Aug 2020 09:04:47 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:27 +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.022; Fri, 14 Aug 2020 13:04:27 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UA9WR1QN50Sl3bYmMUSfIHxlPOEcJnosQ94JH2nshJp/qwpGT44jaEGxMSwMFHuD231OS6i517kP2JfTSyA7UIU2umZ42GV9eQqt9/RXyEiYE+rQZxz5z0KgrLrycP2Abla1JiD0Cuiq52K2CEL+0hqmiln5Y9UNXFm1KRaAeTDJsgi6IHVVUgBy+NF6STYrlqXj4w2oakjAWovktQr7G0pOImOlgcNX6jaJgA9mYOjsohfH+YdymK1uLLOMqB5/1Y4WswbpS+7pFeKSgZRKDp9UbLmNV/tLlEhV02q+3FscNiD2DBs2XGnEwwUf2e8F3WNTuHuhZDBkaw3dFSKwsQ== 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=lgJ43neXWXddYK6r0bzKLeoupwTJydQ6HKTEK0ovulk=; b=E5Fxt4S4CejHFy8E+DQaSCPqbB16SohjQ9psL31O7+TEDusU29xwG3ANL8Wa8j6xO+rXMqXLEUjoMZ+y6P/eo5j3KuR9xqm+Ziby/9Xf+TXEx4H6EP6WtMJPEhZBgPFLSmUEX7DtpX3XULSx6w/8sXWujNNI9bz6H4U+9mcVgnEWkpiyBq0m6HRIpDmcmoP9RnKpFZhBCKPPTdQbFhxVjDWxyrCqUSwxs5MIoI6/r89uXkgfLEcW31PjyY9ciR8k7HghLzBdyMx8vfEZf6ZfF7sHGy2kP9T8PNGGmg9kt2oTwcaNDCWuC469GjDRbi+rZW6RQ9xOmmAey4iX08HM2A== 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=lgJ43neXWXddYK6r0bzKLeoupwTJydQ6HKTEK0ovulk=; b=eC6iFSfFoHiGtzvHJXrf6se5KMrv+H7LJWXoJOVQZaXfRT0jqHQYPhQhY8QeZdmXCvZ3KFVuCDbgwMpb4MrgXINTGDSJve9GPfsm23Ym2hdtFUiBlP87GrJkVmQ9YQiGNRJhxBV+qphsKS0sDAG0jvr+1OlBM/8sAT9oxy5pzys= 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 v2 8/9] iotests.py: add verify_o_direct helper Date: Fri, 14 Aug 2020 16:03:47 +0300 Message-Id: <20200814130348.20625-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 59abedf8-cd55-4b3e-7311-08d840529331 X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: 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: /zoXyMBlXuR4tKThUKRfwOiqv30AaRISkaPFQR1rh6bHju6KDj5mY3335EMaLiSkqKzzddlUG9m/4f6Zb06Ol0koqUmnm5Pok6MlZcu1ZSOCqEtKqTv9QD9zXIf0ZYPIOiXCLmP/AxsX+HAsVspXg1FwJqVCkC1phyZy34p5Nc7q+031g0zilaZz5xOYgC/wR+53QnoE0XqNleTXnSG6Ka1o10S4NXLDXQcgPwDJ5zgJwSbVAy9JRENaioQx5ZG3qQxbASsj/XeT4QCEr3FV5UM9eQa9ZTPf5wy269CeWlgsilQy0rSgFeGDsofvU2H7CX9FW8qw3keUNJ2AO967iw== 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(15650500001)(36756003)(83380400001)(5660300002)(4744005)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: hSXsEcJ20wNQdwtdaoqXG/Xv4UIZpR8MKIFgiEnT1AjSeXvYmrD+fD+87DOPKmgCtlSRtnx52w4HlNw/foY1/SPshWTqLDAe2sYqry9L5a1sMjIAXfylmMcxCkj+jJvQnKMs7NSM4My/aBI2F3Ef8OrE1y6BZL36t/w1IkXMIYXUbX5yEo338Bj3sApwLOsRtLmUVa3PpQo2yLEZX7fbyW+5iT5GncVpA8wSFN86V5X+YeNWC0YR2UaPG1bwYZvitAao/zPOC9GSshWfCorScJo3IG1Uj13MlR6zeSwHbEXISrPGHU4i7RZ1tIpY168ORAIPLgOHjQcBxuqHDVg4Z9+XKUzwifz2zxynrWPkFRzI+yQc58+KZy5xugtg0lZhK+ab0fPH5MU8a4+edIjnkNWQGTqQSrI3jYJE0ghnHmlswKuDdNngnhmtDegrqYKAyG9OWhBjIOIawxG2fdlPjIoqlqG21QCzdvy+9dR9+dohZravfft+fHvqZXGxECV4/rTFYZdH152HlSoOIc1M1VJANo1nQ9jC6mxPdNdy7fAh3d788T99ufwTMNPTAVI+R1ES192/5C7nWx/2GRvdRKkvlkRiTPgKlpwQAbfCr19nH5pORYK2cRkUYNJnx3qCIahufEWBnRasYvoTRW5fTg== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59abedf8-cd55-4b3e-7311-08d840529331 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:27.7307 (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: eP1kk5v6x/OfwB+6gnrLFDuVQyWz8MROu+2pXgTGJyfd548/NmMqWKBiu22PfUHmFrLPcoCTEg903e5lOn+bdBYAoSj8oLcPSZkemqCKl1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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.2.139; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/14 09:04:28 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-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 --- 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.21.3 From nobody Sat May 11 15:06:15 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=1597413327; cv=pass; d=zohomail.com; s=zohoarc; b=WEZGBikf9M2bNqNDIAyCD6XdPR5fgfn3Xw7UXWUozGAGhBadhiDHVRLtqzo8VWoTXllMleu20xxfH674iAAgDK7mouLMmBVfOzKlE/JMbrqPb3u8qUFuQD/wgq5v2Ut4RI/ptSnUrX1bzgqxzQONc+KNJUazpQsyhV/ArAfD76E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597413327; h=Content-Type:Content-Transfer-Encoding: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=OwJJICaHIpkjdPbIEjn3UdJ8jHH3nyXZ6FM0fT77gxU=; b=Bik9L+BLaguJGZhnrkb1F8wrET8CcXHA28uTq/GAaZiSRCzuuDwL1YDSZ/p4GV3n4v6xS81JApLKJJWerGmjXFppUyVBUyC6DFlSIr0X/fStCuZsMmjTfVIeosEhAUbzYfyMAEkTN3ttIhT0E6Lk89Yg30fbgINm05neWSB1EvQ= 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 159741332738294.93066039326834; Fri, 14 Aug 2020 06:55:27 -0700 (PDT) Received: from localhost ([::1]:59774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6ZRA-0006jF-6k for importer@patchew.org; Fri, 14 Aug 2020 09:08:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6ZO6-0001Nb-8A; Fri, 14 Aug 2020 09:04:50 -0400 Received: from mail-db3eur04on072e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::72e]:48915 helo=EUR04-DB3-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 1k6ZO4-0006dr-4n; Fri, 14 Aug 2020 09:04:49 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB2981.eurprd08.prod.outlook.com (2603:10a6:209:44::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.18; Fri, 14 Aug 2020 13:04:28 +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.022; Fri, 14 Aug 2020 13:04:28 +0000 Received: from kvm.sw.ru (185.215.60.177) by AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Fri, 14 Aug 2020 13:04:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jq9E/fAyrFczDjOFh5g7AX2sLTFkk44nJjXt3yodVz9EKZkk1DZnk++xGVNm0CpU2zfb1bBdEPY5Q+wy/ke8eAHGY3mMBQc17B+2/823adr7JpIndrn/H9oJVz5w64keKeV4bwY7Y6bjzfpyPUOuAquKNYe1DSVax3rwvMyBBR3YuubQcrgugBoqFiPI+kGDCo0BlHFKZ8EXZnpR5UTjsLfRvvTypL5rTDWfbUCWPbwPWvGED7rXADLfWDtMUtJQbQwW1pzQoYDzPxFchZp7mXGXgMX3XgVLScdeblW4eCHJfphFIGJ2+NOFWiag6DziQcAhu/AsoYdl7ZIWBD0JDQ== 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=OwJJICaHIpkjdPbIEjn3UdJ8jHH3nyXZ6FM0fT77gxU=; b=GiL07nz39fseohbtfNuv4UGrKMWp7NyWIJ6YtOJa/lTBHeFmnBXK6I8DQt5HUyrBLZausmMk/MLnwlY85T3RlYMHrUZxlbKpEZyTFaxDPV5xrV1Lu3ifYKUatYYvqGOIqR6bNmWBgDZCQ5EWyybycU/ONmCi5HzaXFlKBvkpljRd8d948yNEzhk3E8WIHpHsay8nRkQktNkG9EorilYDBU2YxThZ3n+FwjqQUY9fq59DLvheQzKTnYGDYyQvYWzwwZ0GcubipO6l4BTcaJYBdeTl5lXRlnb//z+2Ml1IohRpYrq3S4flC7DbmbxSeNy+NufpuEcGVQMQihPhh6wxpg== 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=OwJJICaHIpkjdPbIEjn3UdJ8jHH3nyXZ6FM0fT77gxU=; b=nm9IYlSjvO604bE/chj5j4nBjQTxFVPomoWtxryk0wBLaTeqIzxyQGl6UX+8wsGBCpxmim+ioHr3S5RaK7TXPUJjSTN09Xy+bespbDoxDwjCcvPrphu5pZMzLXbupJzY/TWDcC/ugtvORTm6yZvZz0IIPCRhH8kbM4uaa+Qcc+A= 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 v2 9/9] iotests: add 298 to test new preallocate filter driver Date: Fri, 14 Aug 2020 16:03:48 +0300 Message-Id: <20200814130348.20625-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200814130348.20625-1-vsementsov@virtuozzo.com> References: <20200814130348.20625-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR10CA0075.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::28) 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.21.3 X-Originating-IP: [185.215.60.177] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ced3d61-b2ea-4efb-f7ba-08d8405293d0 X-MS-TrafficTypeDiagnostic: AM6PR08MB2981: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c7Sz8swdf5SnDKv7XBwR8zhdRc6Axok6d4xEKpPSA/yf5y2SxdQk/IAVdVk7vJEA3Qp+f1xMSbMx7cE6hGsYJ1zXxR0sE9juUHdHFVxV+LMC1/DLO2K906KoPQSsAjZcMxXXSVokb/azGXWMjFkX/wORgh3wC94kVbUP3+i8Tehfz57OguqBBf30iPwXZY1mydh8oRBR+C2EyvXssb6wUW/e4ElguRq4waoEd0hvGQUj8qym6DGwpZdfhO6qltXsxmZFK64rX62NfvIohFuguYsn36y28J7MmtGfwXzXuhKEJuCnxF1ZzeUR8vH14FxrMiIdIOAhmkrFuVOB4dzHBzAj7DldMSQc/o5nZ5rmyZwDeV6pcFDLco9omzkixw43QhNI9C6y8nRhTYuQs+w2JD0raNuquWiCcjIt6fSN5fHBiJ0ItcTiFuZAl5gMbFs3V5PmtVP1Wcj8AYDKXT/9yB4UORkibHcA/IilTaueUA4= 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)(346002)(376002)(366004)(39840400004)(396003)(136003)(2616005)(956004)(86362001)(1076003)(6486002)(478600001)(8936002)(6512007)(6666004)(36756003)(83380400001)(5660300002)(8676002)(6506007)(16526019)(186003)(316002)(4326008)(66556008)(66476007)(66946007)(2906002)(107886003)(52116002)(6916009)(26005)(2004002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: AV93DvAIrYDQO0a3q3lb6td9OUrGIUHQ84yfkE9DgVLv1Vdc6af6HSrrDsAeEtfYjKvjCsjUYYDv2d92DTX8x2NmD7Suo/Gw6NvoCPyRlpvwiomL+gwNPpo+gkkx78VD9bHpF5Pu0u53ObXV2yESkzm9cZx/pqORtu4OXXgR1neyFeVYpGqFvvR7cWF0nMdhISbGLV80l6lmMi2a6IvpscqGe0LZqAmcdhB3ePLwNhG1p30LCYZsGwMQYnShe5C5z3WfxxCD723xJeiQlhF5JmmkccgfNZALkypgPE8I9Nn3hzrdfrKlQUMS6eNh9hB4GFzd8ATLMjoUF9yU39GHB9PzqXnySD2Ufq0bfrawbGIT3b2lO/UbGEEJUVh0UG2ibMOya5SwbrsjDpiWGuN4tDpGXht+rKdmOrPEYxaP7YLoCxY970QPk9dKwKz7lvKYW+dKBGKyVXd2kPzSi/s29FW8TjFB/+18YdyIDewtFnzU/bmGazpWnNMhEmhS8SnqtP4S6XXMp+JR/UiFA28v2gR8J4KH2qpjOw8reuLZNJs38qOSi03ffbbilzweOCDrWG7NL65bQ/CO2DbxSJlRVzkJ+vy+ZIoiIqSpSJ6e8zPu6A8A1U3eJQlsfbsaxaBhS6I7/H9aILhdHirO+QwsHg== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ced3d61-b2ea-4efb-f7ba-08d8405293d0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2020 13:04:28.6925 (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: T/2GO6oyv5DGvpA2s9hV7oK0hLy5BFndQyjz64ZYrx0MwxidoeP+QjUL2494sEVKK+tofPWPJvNe6oRCiV+7iwQIIrU29jfibIJm46U7BT4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2981 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=2a01:111:f400:fe0c::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, 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-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/298 | 46 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/298.out | 5 +++++ tests/qemu-iotests/group | 1 + 3 files changed, 52 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..f10b14fd35 --- /dev/null +++ b/tests/qemu-iotests/298 @@ -0,0 +1,46 @@ +#!/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') diff --git a/tests/qemu-iotests/298.out b/tests/qemu-iotests/298.out new file mode 100644 index 0000000000..6c34d172a4 --- /dev/null +++ b/tests/qemu-iotests/298.out @@ -0,0 +1,5 @@ +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 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.21.3