From nobody Fri May 17 03:00:53 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=1598019246; cv=pass; d=zohomail.com; s=zohoarc; b=YEq9Z2SMHPfWMNlRBkUYOIIPZ0jA68VPTNv29NNA/H6qQsRpiFIiHViywemZ5y0qZCBr9/4zDD3xbrmjRiDWELyQOdyIu6vBkb/u6f3gghbTsN0JSjcMKz8mr1eYo1L0dgr7w23g0rwXw4kRWF33N7Wlj3rfrA/0j09itL6Bf3M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019246; 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=T6ADkc6uYMLabKqyv9ENA7/hX8HBJxK5upg5p8B/ZEw=; b=mVznJQetfoJHWcbNquXvv4JQPd5Lct4Ztz0LK+MBrDxuN31Fw4cbyJhRqVg6/VGy4/P4gZ9Xc59a+F/fGzkAHvuats8LKz89vYPbSUq+oMaiZWa1T0DRM2po2cH6dYfVIQpDmdKTSOTYjxySBF+E4ARwuUKsrhHV1IX4yKoNFFo= 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 1598019245787529.7268714384937; Fri, 21 Aug 2020 07:14:05 -0700 (PDT) Received: from localhost ([::1]:57538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97nw-0000RT-KM for importer@patchew.org; Fri, 21 Aug 2020 10:14:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97li-00056j-7x; Fri, 21 Aug 2020 10:11:46 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97le-00053q-T2; Fri, 21 Aug 2020 10:11:45 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:37 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:37 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIZNTyqkcxEbWMrMFvl5Z4A2gCLSaVtPhAA6IjGSageAi12ib8Bc2h4ljgjW/oBzNT2H3Ty5NQT3Y1hE+VJWQoHfRV2evGsUNktluUE9buYkYtt3Sft1ILT7lewWm5ssxh6Ri2erezNnF1CzRJH+FhkigZbp/hNzmg8rqCjvZhSfha3KtflOXU4SnG+zwZt+900me2b4DEyPxomfdm5yL4NuKsMlMTLQdz8c2UcynncuC7ATDBdGpfIOs8iV+2KJSfk24mi82E9ZZqkVyBGHygJEQskVbRIaFNGSNucpdiqsyrQICBG/ExqtZCPtK2zefNGgIarIYkd0r9E1d35SFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T6ADkc6uYMLabKqyv9ENA7/hX8HBJxK5upg5p8B/ZEw=; b=g7/CIBOEyA9BttwBp5n4x7UAUWyza9B1d3ch6dFsBLjZWG3b2pqJTxwgtbM08snirZfJHNomB7ob1v1eYuqjiBeW7e8/qwOQJDYDU4xi0PhtgRbbiwDFwoDCAb1zbhiGeTk0kUIirCw7i7qYpWUq4wFbhmD2Hlp2eBE4tHLCcRg4sq0kMx7sb4Kb6TU6cutxvG1u9XFZuTRWhl5efob86qNukxHAx0c0xdXue7eDMd760sFzoHXG5sRSwWSlBfVvfwyFnDxJAA6d8TFjP+BWpV6IXiiFb+znp5majKkPmygLizymPijsnNeNcgknP4x5kMRcQVZAE5sgPXIPhFm86g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T6ADkc6uYMLabKqyv9ENA7/hX8HBJxK5upg5p8B/ZEw=; b=Ux0CBAKnl+zOgWyAu6DEc//n48WzJg8qckvawh/PvuRy407LB3ICz2VzqUBirHk2fJCW+AGc553nyo/1Z0zf+GkajvmlwlnBM3W9IbtNjK55LUij+PqxWuoslgfiKk6WZ9tHqno+TzxbG574YmBDmB9DFHQH0qhE5YTIy1vEmA8= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 01/10] block: simplify comment to BDRV_REQ_SERIALISING Date: Fri, 21 Aug 2020 17:11:14 +0300 Message-Id: <20200821141123.28538-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4126218f-d288-480c-c881-08d845dc1e49 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jjldiDGEnMqe+I5RF2cmcABvHBHzIRm5UVUiG9v66g93PiWruTtjVJGCY+cN0UyXiZksDH1jTOwqYFcdR5/dbg1njnm388fXXaDI4rI+44HCBA53b7jpv1bzxzGVe8B6+wZBoXwNXi5FwbsH4M/eaQ3PzBgguM3tHf4qAUGaZu9bBC3sV3o71CVv9H1krdemmfh5soEjJw5T+RPvFnoOspP+A8+ru9vG5RB66kYyHEquw/TE2DPbLu9ib4oGlBF/VwuxdAOaBKKLn07MM5qXiTIgSDcZ/VQMXKM69SeinX2+g7E9lVlwqYeyKk4jhnz9Q/IpEGqnTXokZhJ2tV5d6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: fZa0M9J0oBIQ8B44TRw9V0LUAL5UnwRXWgFd6KWVBuzdFFP0VPjCXO2RahWpPp2eknml1wB0WkumUXWtJj6VGhrJjoSAXCiO3CXYbAy0Clv6qRwPjWy2FUPVHcVDBLBUVxusxOlN37mgsM5gUaNpL7u3KOu/4GBnVa65mwlz3yi8RHo7dvrwqn4gRP4qpMzYBBog0Fq4dQ1m2grUlhKp/bqd2TN4V9TuY5oaCb8WYou1Qb00mt3e1JSO1d/lBqHdEcfYmCoiFdRMe5EZGL5JG5bgZ99I7C89KH9k6SQ+V2oryDScl0CwNhg8on5fJMimm/DXBhx/hkeifGiOa0F9/NkL7CmHuJy7zWGP4V+VrMdDzljZwQ8BJnJODJgDi5S6IpwhHXy7RM6d9+jVUmLQMnQhfCoLvqqiIjjoDEF19ivCfSvYrOOyu/oKM/78gwYsXmVGAIVJARtsc1Tx5+7ROtuxRDnLh1i+UGTrlmDSUq3G9GYSE9Agyy6fa4RI58cxuQpTlUt/uOHbYvVNJ0krc3eA638L2p/gdsZx3tev+tyZuMyV5fo/kD5R0QgPCraDFK3uuHq0Zj5A1wN8VuIbFknQZ08XncQ+pyvgsHwfhqZqbebo8vSUR2uNsL6JvgrCPXI0iJs+rNBe58ulCoL83A== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4126218f-d288-480c-c881-08d845dc1e49 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:37.7393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JUQkbaP7+fEEv8oBRTeCHrxaG3BxNCYA6g3j7nU+Xcqx7DXjgzNKiyfMcExbT0EcRSwbDUsgMDQdQi9I/TleT8GeaWMSJGr+lIpoym2zwPs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass (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.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 Reviewed-by: Stefan Hajnoczi --- include/block/block.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 6e36154061..b8f4e86e8d 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -53,16 +53,7 @@ typedef enum { * content. */ BDRV_REQ_WRITE_UNCHANGED =3D 0x40, =20 - /* - * BDRV_REQ_SERIALISING forces request serialisation for writes. - * It is used to ensure that writes to the backing file of a backup pr= ocess - * target cannot race with a read of the backup target that defers to = the - * backing file. - * - * Note, that BDRV_REQ_SERIALISING is _not_ opposite in meaning to - * BDRV_REQ_NO_SERIALISING. A more descriptive name for the latter mig= ht be - * _DO_NOT_WAIT_FOR_SERIALISING, except that is too long. - */ + /* Forces request serialisation. Use only with write requests. */ BDRV_REQ_SERIALISING =3D 0x80, =20 /* Execute the request only if the operation can be offloaded or other= wise --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019448; cv=pass; d=zohomail.com; s=zohoarc; b=Ue7uDg9JG22OH1FaInPj4tLNr4GukmQmlRJ9A4wyi25vBjMPXVKsbMgR79OFh7v50aTE2evU1GO1XuQ3lbADRHpMnGPZ75KvXNdlw/oIvIFIvt3ZQrSLhs0QCTq8KFrkZxPsQGdeA2Zw54F/iyCYkeDjOrSXO5ybdr+/6rfrMaw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019448; 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=0386wauxXmSK63FI+OC2yIics9gF/T4FfYX7cSlvOt0=; b=EG0EjpFoiWwbiNUrHs8TFREN3OrrWc4eiuVMwkY2wd4V6Egju8WWSX+CSrVvZ/vtGZwEeX9rByS2I2Iq3y4YAnwh6HkvQz0eIEWCkrPcinC/HNQuAuOeCkGSUt3XkovzmRGQBQkKnucUA5f2pwlUPmjYKVkCxsDxZsqGE3uip4k= 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 1598019448374456.8117338570355; Fri, 21 Aug 2020 07:17:28 -0700 (PDT) Received: from localhost ([::1]:47678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97rB-0007va-W6 for importer@patchew.org; Fri, 21 Aug 2020 10:17:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lg-00053V-4r; Fri, 21 Aug 2020 10:11:44 -0400 Received: from mail-eopbgr10117.outbound.protection.outlook.com ([40.107.1.117]:9536 helo=EUR02-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97ld-00054o-To; Fri, 21 Aug 2020 10:11:43 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Fri, 21 Aug 2020 14:11:39 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:39 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RsK7xZeCAoJ77EyRItYhEQQGzEaHUIApDQefMZAAgT4H/iOk4AiFTYeVCJdzqeUnc5+0lw/SVs7SahUou5bIsgf/FaQLo2Y6yLnUddph+pfaPViUjXyPDq+iWWGHdm+Y+d3AhPAbCKG/fRRtKHN3sx9cErCiKJfKH+5+VukVYE3Z9f20p9wIoo0IAJD2B/16rv+PotS48H9nODBNEi7w5sHwullOioaYds7+3P8G5hpBbJtheI2P3ER5UPA8Od3zAVeigA4Z2ssVNhkEYIgQtmrRR9kWDL+5azl20rzDZLn/7juCfjptHaHrFwp+q33807e1PO0eXXK0/7UPhVKGaA== 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=0386wauxXmSK63FI+OC2yIics9gF/T4FfYX7cSlvOt0=; b=j/nIbCv1eJyLKzp5r0jIiggNgVMctUPSS3fV17YrzYDa9p7CrieL3onYU2YVWJ7cP8cxxST7I6nZxHhFT4tD73mch62syF3mBILHtZhjlofurmUkm/EqofOeEGmQraRnM5AxZFr8yw8ROVLQFSJYy3UqHc6duzeT0v51E1LctPPFuNQQiB6u6IybnnLxNEoKd005VHZqx4MzRTsIy/VpiuYAuQBHODH/1uwP7NyOXyIEA27BrQBLKQqgzy45WR1P6R87pWyprV6c4QuRF4dPeUFQStkTahKBFAi1DkNkjq14dSXR4IbmQ29SEjL4t/9cx+lWGi3FeNQWN/xrlso9gQ== 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=0386wauxXmSK63FI+OC2yIics9gF/T4FfYX7cSlvOt0=; b=VnGsTS5tlaowzaLl4vmyle6IebGXZvsoYK1Mh+kz9m/RyKBMEKVpwjTjnb1YGR9Wgn6aM3pVvMX7f+inG9HpvfJyKQg22pZXpNMiEM6ai6SVBHF+GadhoPI32H94AIlJ+OYnCJQnpq2xcCkFnJxFWqbR7M466MRaqbXa1XbIluY= 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 v5 02/10] block/io.c: drop assertion on double waiting for request serialisation Date: Fri, 21 Aug 2020 17:11:15 +0300 Message-Id: <20200821141123.28538-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7954dc6-31bf-4dd3-db32-08d845dc1ee1 X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: 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: Ip/ukdEbWv6vCwhDxP0VRLbnAhgS6cZbHr0nvWylMRCTG3fa/EQGHa7w9Qj04G3X3ebhGq8A2N59srlDx8J0KBc2vMZtOr1BqVI0v9hIjFq4lz69cOwSfo4LD/uu6eu2kCCHwvORDbC0oj6VPdG2ehTRXot+Qkp1jpDNfn3SpgdeDRlNUGM9NtPy9zXZ0RCFF/G8FgnykumFS5Jv6qhU9cRJC07CuIz2gAkCYkvuYnv9sREzwkOc4heL3mTkw34wFjeEZFH/Cu3KgHVpvHoURxIZVpeXhZbzsHbPhOkoq55M247M3+tFtuQhPFgv87n3tpvXB/u1j+RbTvlR4wk1qA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39840400004)(136003)(346002)(376002)(366004)(6666004)(66946007)(8936002)(66556008)(186003)(6512007)(16526019)(1076003)(6506007)(86362001)(2906002)(956004)(2616005)(6486002)(7416002)(52116002)(8676002)(66476007)(316002)(5660300002)(26005)(83380400001)(6916009)(478600001)(4326008)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: nEjllAGbwzjqKvCd0bycWF6ca6sAkWMlDRCR8xzK56Zf6zrrXxIWy2/8vXDeCkcYYFwGVh405o4GaeWeBUHUqr6a2OsmUMmrn8ilTJFiqqouK+Yt+u3DkQzQqmTpcK62gPoQmx0Z3joZ+9+iZ5uz4IxlB8V0dvW5REk+Me45/aPkDSLxCZUSJ8EZc8dsIu5AVxK3zIzFpMv4WRZF0RegK5unbrvEk6hsF9gstqC1m2RZG98IkKyGfaDnabN/NE1caq+3L2sRb7A7LBUnOB9+0X2SvUSkgeGW1QCO6y0GcSIYSWpGJydtYCI7Cg+BCvBmMQziPJzOuIAvQ6qmQEVVkOjNOIRSgcJizQ+5LfxO8qlpUxNrIooZVPyumg01oB6BSLaIg+9lIaUuNKU4F7gB51qc7EA1cMXU54EsQmjvlr3Fs+Rf3rcndPLmR1bXGYZYNOxomdo9fiTq+eyVZ+YTCCEPDzQ/Tq9rdvmyYefCFLvwGT9W8NqJ3UWQDuY1CMMrRaYhs2VEmvua0M7hGaDARkt269ZEe1pLv8faq/N83JOKatAX30pouHbrbprrRbitWQsOPYpO9AvdG42LCLDbUctMZ0pylzQMJllGxuG+vVk+F2babLst3/6nUZ0mZA53nYDZvfK0B1mUZjrPzS4wGQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7954dc6-31bf-4dd3-db32-08d845dc1ee1 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:39.1023 (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: HBfDwJwc5Qvwerhok7A6rDwsMZ6VRbZEeWBmBTaD6Ew7JjtGoFD47hK42LDgaOKxNfmsX7ccFpd5HqZiUU/gjDuQbFRLDxAze51TBJgXguM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 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.1.117; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:39 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, Paolo Bonzini , 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 Reviewed-by: Paolo Bonzini --- block/io.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/block/io.c b/block/io.c index ad3a51ed53..b18680a842 100644 --- a/block/io.c +++ b/block/io.c @@ -1881,7 +1881,6 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t o= ffset, uint64_t bytes, BdrvTrackedRequest *req, int flags) { BlockDriverState *bs =3D child->bs; - bool waited; int64_t end_sector =3D DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); =20 if (bs->read_only) { @@ -1893,15 +1892,7 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t = offset, uint64_t bytes, assert(!(flags & ~BDRV_REQ_MASK)); =20 if (flags & BDRV_REQ_SERIALISING) { - waited =3D bdrv_mark_request_serialising(req, bdrv_get_cluster_siz= e(bs)); - /* - * For a misaligned request we should have already waited earlier, - * because we come after bdrv_padding_rmw_read which must be called - * with the request already marked as serialising. - */ - assert(!waited || - (req->offset =3D=3D req->overlap_offset && - req->bytes =3D=3D req->overlap_bytes)); + bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); } else { bdrv_wait_serialising_requests(req); } --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019388; cv=pass; d=zohomail.com; s=zohoarc; b=avYJXENXMdnzqkEq99ExsgkZCq6dP7WKnx45IWZfzxIuBN5XT+h8SkgHAj5figboDyjZ6h8iXXkpKHQR4Hm8G2S02gsu2fOBfe6pEh9gKbexiuLemjFpx/CV7LTk3AGGMGkhc5BfIPFNzOc0oP2tvLKjTMPpYwgjNa1gaGegqHI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019388; 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=aF2PaB+w+zYUXs99bK9Q70bwF4UMXw1gH6C9i0YbYm8=; b=DPKzlA3x5eTtcg9bOGHJ4GnNFBQ+OehS7dGwPA3hf1oYUJXAo8JY+fW/gW6lZg9EGsH57dV82y0hZDnkwQtkjdnFEHH7IFoeFJve5jYdiNFZb4O1qCg7IrGeRC0qF1XUZD0Cf/fUytcrD5P3KG5kq1RSQ4f3IkP7SNkxn12byqc= 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 1598019388697806.2606807998317; Fri, 21 Aug 2020 07:16:28 -0700 (PDT) Received: from localhost ([::1]:42588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97qE-0005rE-9Z for importer@patchew.org; Fri, 21 Aug 2020 10:16:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97li-00057w-KL; Fri, 21 Aug 2020 10:11:46 -0400 Received: from mail-eopbgr10117.outbound.protection.outlook.com ([40.107.1.117]:9536 helo=EUR02-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lg-00054o-Ry; Fri, 21 Aug 2020 10:11:46 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5495.eurprd08.prod.outlook.com (2603:10a6:20b:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Fri, 21 Aug 2020 14:11:40 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:40 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eBrenY1rXGZ2MEfMSV6OKN462YBMhnakkCO8Ki/aR/6eDevVWhe9wiNoJFrldISHjaWgpBq4WQu9gL0ISKlaFrijedxprEDnI0+KRq/YgtNksNDycCFpLfYVTcCBJ/NeVzB+iL9bcHoVWZysQdY82I38HS5hmk5in8h/SAGRqG/hi+RGkwNLpb8PoZK4Whfa8+tAFjGIcTxy/9+lu3ZIvjIvqBgZPBKWKPYHbLS6bLSfdxiLMhf7oTxEIwnqxpZhIxFUfk127Lf+fnQRHRJRfjweuCDXpyIFjdD5zJr01PGdYl/SpjytQXNGKuSmjcHsRst113hLdrTZpJ7sMkeXJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aF2PaB+w+zYUXs99bK9Q70bwF4UMXw1gH6C9i0YbYm8=; b=Vurzm3fzn3MJo/ZNSaies57JsD++lAhGrTWznhqPgRumZh7oqpSlGddcxaL+IMM9bHFK/qtBHC3wwGGYQSSMYUOSmRDE4OX5Y60jMWL7lKtXRoFoCH4fAFib97aAAs0EDopGy5VY5DkjBjYqema5XXSWuFbTvjWMSUjnBPCsJogH+kZTLUKi2G42GN8gRdqnYIJhAEodxE93soJO1JJZ6HNkfE2zaeefGqE8WyME7Ek0EuMC/6g9HBJtvj2nNqpBlcZdEEnvCJowNcOHw1wsWYS47Fmj8gGHA9nidlyeAMLiSVB1KUBftCifa/xU0wkGYtKgonXLgeCKuW3lynQvxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aF2PaB+w+zYUXs99bK9Q70bwF4UMXw1gH6C9i0YbYm8=; b=WalgxZzzurya8fIdfx3DvCuZcFkFukATf4Y7zeQiwTafUM5rMg/mEjA08CCpv6AqIZry+wUn/bCui8R3UVdZWitgWZmAvJcAZlzfLJON5eqNu0PS0wW9U+yLO8LL+jc6sqjsY7VtWqIBlQBAjA9RzeIUr07TPpDZsPVCsjDub+g= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 03/10] block/io: split out bdrv_find_conflicting_request Date: Fri, 21 Aug 2020 17:11:16 +0300 Message-Id: <20200821141123.28538-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bb97938-68a3-410d-85cd-08d845dc1fc4 X-MS-TrafficTypeDiagnostic: AM7PR08MB5495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eeTpQcwuVvTclXKzCrcGQUBYGGRfNcHMZqWWIs3Pu3mI6v2e7ZNsxKg5nBHWWZ5k1Du5KOr5hTHIGcueYla6SLRmLD82TzT60Sf4lufuTxaQI00WppWEMp7V8RceuK0uoRCpmQ1msLfsvYjwBHTtkIHCxy+tVep2CLrC/AAISvgARMcy4WL0PySXnYcVaD7/V1BA1CCHYH4EDHTt6MWgiMcuNq0n39d5UJWwW1i3AhNLtGJWGICyIcE29vN+VQ30Qi4yZ4u+pmRwLS/2mJQsEizHUY1BER1DCz/q/CTLmHaLPVvXvHwDn5lasikZHMiL8e2u4Ck3tyiQ0s5vlfjcWQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(39840400004)(136003)(346002)(376002)(366004)(6666004)(66946007)(8936002)(66556008)(186003)(6512007)(16526019)(1076003)(6506007)(86362001)(2906002)(956004)(2616005)(6486002)(52116002)(8676002)(66476007)(316002)(5660300002)(26005)(83380400001)(6916009)(478600001)(4326008)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 658i5Zc3i3QAjs94p6CqjDQzZZ13N5AaYcq4ylfMn/arZ2AmYbJiPcs7Ipb1XXJ+sA3vcikxw4xvNn2PzXfoCbLn3pV3mCZZgItM3Zcfh0LqqRHdhOzRFRUTPmCgT42E1suayw7ein7/jrWtwhM0OYB//ZwRO1bJOHfJXjL1fS7tIPmFQ1MlUhGAyBoMXEC8d9g+Th6oOhiyv7Xx22/Ht9SyCyR95MJhmzsmZopXvwkJU9I/OEFssGD/pdty4bI6DHpFj2/db/4h6pQLdMdR+8BTk5AAyq2A5paWNmzupL+bE1MqeWBjyTtGhU9FK6/z+2LAc1ZlnYuSDzMgmYLGQEc3u3dJZ5p0nxj2Z81vLfeYXUHTuIIInX4+EL4j7E4f54S5c+1mAyNkBpOrsIkAZHjCFIQV253eJNYgRYmVqwqUzdBX+PXb4FGDtfsf8jEFsBLRyvb2dvZ0hK48cxZmQ0ogctEdj3vX2Fu1T0o5wCxqKTFVkOvFJR/w+hzIab+V9XEKDM36b7Izuaz56LhcXdOY4c9c35CVpKBXzuTv+Q9mWizBEj+Eq5xxSQ/FuAJDrY+o30OzKP+FdAxjEsGARQJUjUnqMOQl424zwTWpjjwAvKRnICGXfSjxQPmDgDwvXolpgVwxZhTXzsm++VnW2g== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bb97938-68a3-410d-85cd-08d845dc1fc4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:40.2573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VyTO1F9Dxc2u3tuSqC5kchlYyu1kuzd3nMNGIBjh0o7W5DspKWcx6Y1HYJY9yTf7yTy559aY+E3CNAuOXQ9IB/OrHa7t76dcGP3VTyCt+sg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5495 Received-SPF: pass (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.1.117; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:39 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 Reviewed-by: Stefan Hajnoczi --- block/io.c | 71 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/block/io.c b/block/io.c index b18680a842..5b96715058 100644 --- a/block/io.c +++ b/block/io.c @@ -727,43 +727,54 @@ static bool tracked_request_overlaps(BdrvTrackedReque= st *req, return true; } =20 +/* Called with self->bs->reqs_lock held */ +static BdrvTrackedRequest * +bdrv_find_conflicting_request(BdrvTrackedRequest *self) +{ + BdrvTrackedRequest *req; + + QLIST_FOREACH(req, &self->bs->tracked_requests, list) { + if (req =3D=3D self || (!req->serialising && !self->serialising)) { + continue; + } + if (tracked_request_overlaps(req, self->overlap_offset, + self->overlap_bytes)) + { + /* + * Hitting this means there was a reentrant request, for + * example, a block driver issuing nested requests. This must + * never happen since it means deadlock. + */ + assert(qemu_coroutine_self() !=3D req->co); + + /* + * If the request is already (indirectly) waiting for us, or + * will wait for us as soon as it wakes up, then just go on + * (instead of producing a deadlock in the former case). + */ + if (!req->waiting_for) { + return req; + } + } + } + + return NULL; +} + static bool coroutine_fn bdrv_wait_serialising_requests_locked(BlockDriverState *bs, BdrvTrackedRequest *self) { BdrvTrackedRequest *req; - bool retry; bool waited =3D false; =20 - do { - retry =3D false; - QLIST_FOREACH(req, &bs->tracked_requests, list) { - if (req =3D=3D self || (!req->serialising && !self->serialisin= g)) { - continue; - } - if (tracked_request_overlaps(req, self->overlap_offset, - self->overlap_bytes)) - { - /* Hitting this means there was a reentrant request, for - * example, a block driver issuing nested requests. This = must - * never happen since it means deadlock. - */ - assert(qemu_coroutine_self() !=3D req->co); - - /* If the request is already (indirectly) waiting for us, = or - * will wait for us as soon as it wakes up, then just go on - * (instead of producing a deadlock in the former case). */ - if (!req->waiting_for) { - self->waiting_for =3D req; - qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); - self->waiting_for =3D NULL; - retry =3D true; - waited =3D true; - break; - } - } - } - } while (retry); + while ((req =3D bdrv_find_conflicting_request(self))) { + self->waiting_for =3D req; + qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); + self->waiting_for =3D NULL; + waited =3D true; + } + return waited; } =20 --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019560; cv=pass; d=zohomail.com; s=zohoarc; b=c608+N7K57j0vCj9NZ/xB9CafU6KPJqPaxBIOSla7dWiTeptMiironUkgrePkDdf+eLRNX8qaueny03Pt30h5PhVW4wa61bIx8Vo0WR5MdzMYj8NrtCvGqOBdz95zQ0uFCzIoIasY0rDe5Se6QNxDKrfimGFn9GDhtrnbIFBnzs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019560; 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=iOSs8tSaCsvqszeIfYHYua4c4UTbNH955appswRjkts=; b=Y0shj63ekiGRZGCDvJfuWqWVMUHALapPSCtPsL3Da0wEGd2IdS/zJJTLEIqlnZXSOqjRq//LpH9YUUwFkV7DYJOaw1sp3B4wXE4nuRAnTKYcpVRVTvseUDF9miAhnWFudQawnLqLAfafaFBOvHGzp5lykpszdZsP8ggtGM8RbJI= 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 1598019560236109.72317901505198; Fri, 21 Aug 2020 07:19:20 -0700 (PDT) Received: from localhost ([::1]:57410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97t0-0003SQ-E8 for importer@patchew.org; Fri, 21 Aug 2020 10:19:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97ll-0005Fi-Oy; Fri, 21 Aug 2020 10:11:49 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97li-00053q-TK; Fri, 21 Aug 2020 10:11:49 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:41 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:41 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lxQK4tLnfOCigRW2rhGE55B7boDKVcpDKvEu5g3ohAL8Nxy9jozg77oZR9XIeTLy+gxJyTzSucj2LVQYUgL00sPjMWGCfkTP7tpAa0RfzDxWF0ibL46S76o40V4T4zNkGlYQEFgbqiUdqTrEvDzTKHlZiMSv68HeXvji78FjUyhiPhZNxHZwlEkRH1RrprHix/AWcfz4KcFvQCzWbXPhWLKIF/Tfo5CSz6n4q6soE8Ni2rx9qMrPq4jtYkZL/rkHHAPv5LqYkAVM/qhWKpLwPWY+c+lwcTidSO6YIE5HNKgAjeiDWMB3goYj8GsinUaDwGRiyn1eoH8s/Xg81XKGwQ== 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=iOSs8tSaCsvqszeIfYHYua4c4UTbNH955appswRjkts=; b=iAMFfUFeFouo6ibstsv2Jvi6jsYh+5+Pthl6IE9izuSNWUHqTELD2iL1k+bcFC9aLuHA5KUosQwza5GAPEICap5hT4YPpsxc0CAnENoGiJBgM1OjvuVyi9v+mC/7U0t+JLjmzOsDHEUwmicTU7oVZJlDJ67ncPz3cGZV3RLflYLl+uUNQ2lH8SGYWg8gonvWeliwnzCdAJdM/Z5L4Tiw7c1WQ3OoQZr+CrHqkypZy1YCXg6dMk/+yQNoTh5f4o7tVcvLRrI/WL0EXjWEBYjSGIYWCByqgjZjhZ1mJZRqkkX9hWwpiE+7wfcsgq445/EH8g/H3cBxh7348IHjkTkkaw== 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=iOSs8tSaCsvqszeIfYHYua4c4UTbNH955appswRjkts=; b=ep8wnyx03272QWQn49h5BzmtTVZsCILOZDoHPzCWCjKEB2uHRGmBz8ZF55cUwCgv/exDybC6CWErMikZMRtWqbSxVe4BCzeBYDZFyFYRImjbtqmYq5zkgnmnXuHIRtPiLuabIHKkuCNmjo/79pzvvXEivc33KlHxnpOW6FxGrnk= 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 v5 04/10] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg Date: Fri, 21 Aug 2020 17:11:17 +0300 Message-Id: <20200821141123.28538-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f31f7a1e-c906-43bb-541f-08d845dc2053 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: 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: Kh7ANgNk1rJ5c6N5nJVEJyifQ3/wl+8wz6EAzkRyjyKBmag/m7gjTLxdcxKPRAVHU2unZyPcOnQkGSI3tIj3zRaFZYr4rEYoYJZCSpPnA26Ce2LypLeIwKtSJ1BmZL8qRIMno/O29eP3yT6T84I3exibrw7JxGYU3lFGbkuQH/mfGikSZZMji2kgfkP89HRSsdpa8szse2eiE0VI217ecKg4elhWw/XNGrCXhGU8vHdRN6nQBeEVo/C5GnoPDZuoRnZFs67GZE1G80E5TKa6xT51IQDF08KB6yt1yO0NOOqgAmfrl8DeoTSLYtQysvkuWrtDFyn2MmdjnxwPF+KADw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(45080400002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: qbw9PtrAnm5UW85VCpIkyT4pCmh8JYjbEQrp+B4Ucuo78xWQEP4PYXsXRUtowRer8kfLLqKFY0/AYR3MPhMVQjetxxzV14v2Q+Du3TxycGbqUdFeTMq6tMrRiogML+47zhDDeCFMnKkes4dQzdYpR7SyxdQibgtpibTt2pCNWaPyKQn705F35Byi/nFc//hWDa5Go9Nnil77A9AQwSmJ8uWpqV8FIggp/oLsdNXBFcL3bv2+OvuL0fJ8S01Ll6V+Iev4yXhSiWgWuY9cd0XMEa+IbnkKtyHmrsNgIMj7YU0+SxHvsBpUr9ip8LcciDmVLL7cqVftgB55BkfgZylkwb9FBpZ5wLIj8ycBEgf/2Bzru4g4oa5V9vgPhxxxy02APKpS/IJSEISDbvHE+Ea8SyXZFVB0wIlTtD8ara4trMx/HmhkJHZigNmIXGzm9vqXd6uXjcZgZNp7lF8ysFpsCqQpBf3v7A1GSwRubx9P8/lM9h+1C9jIM8lgGNETaWAocUlpBcFcKYABaY7B3e8XqtbPFGinMy2J0iUSAY7YG6dfzIZkbxnj93M4im3TXArvoL/kdNACt3q6kRKYbB9xHxNfRirqbnMse5diyL6Nd4mFsoPBIzdQkW1OBXK7PwQ40968TCKdbFA9ULdgGo03dQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f31f7a1e-c906-43bb-541f-08d845dc2053 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:41.1912 (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: 5pHbK8fk3QyBllTHk6VIHV3VC76Nv5+75EWZ18Ryea0xmFVOXdm+TmJgpu0lZ2d9ioiRthagJ4h/smFcvaDMAimQuIKI4ImJswBGF1pgkb0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 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.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 Reviewed-by: Stefan Hajnoczi --- block/io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/io.c b/block/io.c index 5b96715058..36bbe4b9b1 100644 --- a/block/io.c +++ b/block/io.c @@ -761,16 +761,16 @@ bdrv_find_conflicting_request(BdrvTrackedRequest *sel= f) return NULL; } =20 +/* Called with self->bs->reqs_lock held */ static bool coroutine_fn -bdrv_wait_serialising_requests_locked(BlockDriverState *bs, - BdrvTrackedRequest *self) +bdrv_wait_serialising_requests_locked(BdrvTrackedRequest *self) { BdrvTrackedRequest *req; bool waited =3D false; =20 while ((req =3D bdrv_find_conflicting_request(self))) { self->waiting_for =3D req; - qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); + qemu_co_queue_wait(&req->wait_queue, &self->bs->reqs_lock); self->waiting_for =3D NULL; waited =3D true; } @@ -794,7 +794,7 @@ bool bdrv_mark_request_serialising(BdrvTrackedRequest *= req, uint64_t align) =20 req->overlap_offset =3D MIN(req->overlap_offset, overlap_offset); req->overlap_bytes =3D MAX(req->overlap_bytes, overlap_bytes); - waited =3D bdrv_wait_serialising_requests_locked(bs, req); + waited =3D bdrv_wait_serialising_requests_locked(req); qemu_co_mutex_unlock(&bs->reqs_lock); return waited; } @@ -876,7 +876,7 @@ static bool coroutine_fn bdrv_wait_serialising_requests= (BdrvTrackedRequest *self } =20 qemu_co_mutex_lock(&bs->reqs_lock); - waited =3D bdrv_wait_serialising_requests_locked(bs, self); + waited =3D bdrv_wait_serialising_requests_locked(self); qemu_co_mutex_unlock(&bs->reqs_lock); =20 return waited; --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019673; cv=pass; d=zohomail.com; s=zohoarc; b=cSzlX2xnklheC/Pd96C2PTzVnb6BMzOkjaornSwspgv4syPkcj+4jYDW2ZRBbTOc3+cPpgOp1ZFZt5cOfVx99jDRwOX8cFhnlY8iT6VtPkicJpYqFqcD35an87wrZaYq8Kn+Iot0B2veXL2VbCUMul0oD3gqO+o8tBlYi6Tttl8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019673; 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=fuTbjm6gbDz6RyXpolpCv0/trcGhMj8sqU81ZszkNnY=; b=idvfYL7v4gbzg793rI5kFiL+EkV6cJvPGjytLUXndJJ44ZX6pYlzTgodjGI+m6GDa0Ocuok7GXzV7duNJNo3/RTJyduVuz9s71w1JWAv7RIeRJ2bWEAY0ErMUzwoDYdwZoN5k02Dstq/sAjoSkOuxZCKKxS8mWoglSc2zj8jpc0= 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 1598019673578282.45367406012815; Fri, 21 Aug 2020 07:21:13 -0700 (PDT) Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97uq-0007C1-71 for importer@patchew.org; Fri, 21 Aug 2020 10:21:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lo-0005Ml-GP; Fri, 21 Aug 2020 10:11:52 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lm-00053q-F6; Fri, 21 Aug 2020 10:11:52 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:42 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:42 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZnzBsACzyZAmSnaPKzCon91O0TTT8CgL8G27RJA89Cn9hWHExSfOqaA0FJh3H6NXYMQQslQZovnueaIgFFEWEitBCQs9CmPZVf5ZXpJQVqSKfDapw6ogdqmxqP+XtBQB1czni89a7R6e9Tf/+NfjmrsKRBzO22V/ZGjxghzw8MeQOSqhxeiIaXnouVOHajddxUskawcn8TkorFxMnxoClal4RVS7MFQNQ+t0Blf7HQWV+Zamm6mpglHIlTX2MTVt7Y7rj8tfEM7mLczpQwGHLtTJv2+y1O2VFJo17WVMs1Z+JFbi/9UYEyYbNwP4jilYvvfITaEmVQLVc/IzjcHVDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fuTbjm6gbDz6RyXpolpCv0/trcGhMj8sqU81ZszkNnY=; b=O3Mhj5T7EXT3iStol3fntB2UDI4b04jBEbOcPnCVNp262fAL25zbbXU2C413fx/xZka7ADUcC/jwNI4jHW/owe4J0i139FLxYKDp2+V9Ucul56XPtlJ/0KWmlQZd5px5slCscTxfp5SK/ywihGkajxwa4SBGqDTgkWDSupVKZhk7kgxt3DO5Z7xN9p7sZPRiITUmIArpWLzzlQrIwPdPaOnZ95m+2lohphR8/I0rRx+Kkb0U7IOOjzHrPyLUIgHcTOvgMZwExhrq6Y1FfjUONIkhNCeA2AkqezVKPnJZZLXun4ysuq2rUSTVi6dfCWdEUdO0tjcEIxaZ5joD/41vNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fuTbjm6gbDz6RyXpolpCv0/trcGhMj8sqU81ZszkNnY=; b=W2SRPA7f6F4wll5PcValPml/tGYgGx+n3rhfoB1uFv7a4eTWthaD9QGbXq9zAAm46ryVm+9LjBuVbCkK/HSIJ6dtsSUdjY9sIc+zS9npLrx4B72ZTtoPgWSwg76+H/TOmoNyqvrcfgQxkGgv/VDs2iB4t3PG2ciSuJUS9JExcW8= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 05/10] block: bdrv_mark_request_serialising: split non-waiting function Date: Fri, 21 Aug 2020 17:11:18 +0300 Message-Id: <20200821141123.28538-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5e0ecf3-eeed-4038-b135-08d845dc20e6 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rOt2dCXwBCpK+2mUcTQs/c2n+NT79wT6Dffene2UiQ/a1UeTiN4sdYbsHTLSDpLApmV2QZE/oEd/yObwHWjbJPqa/A+T7LhAcDKrhe4EOrXOCAqSkkl5beRzzEOTAIKx7CKWywqkXCQN4HEaJ3cwRRdTQIucmcvvJdFOIZzLyQRNGjbONJr+0cT/XGMh7AhsRLWDXOFTsfykiOYWce6A+C+6Wxpwk3qYmN0tlEhXIzMV0I5QK7QNl51FksHb4hFl0i9P3qHF8Iukoo5ezZizPs8Zxiu4gL2CYinNxZAwTlDczeZv0rDwCjMUdpv++kyWOQbW1BX3ClTJcqE97Bqkmg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: laqz9QST1KQFkgIayHkKZhU5KKhtuyaq30jtEObzI8oWXeK7MsUHXp4zeuPKrFZDfgVw1Fk/A0YA1uQGUFyvJc7fPJozUKioYHT621F8W6UT9U4KK6y5q9mtZRYBQlDw0VVLVOUhXkw74ludvN6duzo0Xq/M9w6Ic78wHXQ8C7fH3nnOwIDTXskictzJfR4n9JkL7aHtO9OhvyDZWU3Ibido5zJn9wV3YBe0PZD+ylQlQNRsoNOgZQSv8oSnp79GTXzOaloPOIuODZyBheDXoDa3n3vCRB3sr1asr2g1opWX5oKZxQ+O4UJTO0YYBnbx/fEob1v66K8wSoYWocFb0I6tJuRfVKNRv7QMv2tBtW2Ew70Ge1yk1rMTALZG6X827Pnua46kba8ROhUOf5s6WbKUqF3hlQqBOtiF3uszInnsKY9rOVF4vJcMMMmURwuekAGIsWNfAJd5sWdhqb4BMnfWEU6IZcTzaxiAevgktBytOUAmZQfQe90fAFeuRAkr8Em6m7EvHS8auIGSxHzei10fyfdBbzVGm4MduGATGyYL9Enu2DZJ3k78gR2noOfP1dTW9l0tu0ndTy3Su1w6psz6QCsA/uoqa1i1Ayr1bnBjSqqSyYA2fzN4fxZWEbRL0itQTbbGeLi+GLAXJKDbjQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5e0ecf3-eeed-4038-b135-08d845dc20e6 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:42.2157 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cFO/li2deGCeZ6ZxhaVjmjTR6I/T+pwsH/RmJSMSAQPyzgnqp+RUjWIb7cVLyfDwt2+uJZWohXKeqv1e9siTa1LPPyvj9aCR8s/NO4TWt3A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass (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.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 Reviewed-by: Max Reitz --- include/block/block_int.h | 3 ++- block/file-posix.c | 2 +- block/io.c | 35 +++++++++++++++++++++++------------ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 38dec0275b..4d56a1b141 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1039,7 +1039,8 @@ extern unsigned int bdrv_drain_all_count; void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_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..dd28befb08 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,21 @@ static bool coroutine_fn bdrv_wait_serialising_request= s(BdrvTrackedRequest *self return waited; } =20 +bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req, + uint64_t align) +{ + bool waited; + + qemu_co_mutex_lock(&req->bs->reqs_lock); + + tracked_request_set_serialising(req, align); + waited =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 +1503,7 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild= *child, * with each other for the same cluster. For example, in copy-on-= read * it ensures that the CoR read and write operations are atomic and * guest writes cannot interleave between them. */ - bdrv_mark_request_serialising(req, bdrv_get_cluster_size(bs)); + bdrv_make_request_serialising(req, bdrv_get_cluster_size(bs)); } else { bdrv_wait_serialising_requests(req); } @@ -1903,7 +1914,7 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t 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 +2080,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 +2194,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 +3358,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 Fri May 17 03:00:53 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=1598019378; cv=pass; d=zohomail.com; s=zohoarc; b=bnGc9RV4rCE+bK7i9xuygJaJZfg0LvAr9v7k6zRnZcIAql0tM1pn/hYy9XGK3zlm/IxiXVpCDdC8RiJvN3FZxWw1NEmfKn0ExhDjv6t9d7T101hNmgFOVl1QtAo+LADy7Vs3Y+pMRPUZOKxbMF7dclH/g7KRF2fyl0B2/13nnxI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019378; 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=JicS2MgvlUGxcQ4pTtRKtaD7bovqcjl3Q8ZlpEpR78o=; b=QtJCqz1KXAw6pXvNPDOIGWlRa2KYGfoLQEzfAw5RLFYhtukH4AtuHxQbtJV2Gl3+9SDB/f9eVXnDHnQmyfbEQ+Moti0qFB9d46hhxjoBZ5a5mO0hVBMxXd2xJiifgDZpmx9CGcZxDCoJXL6VaBhhEF5WGIwPwJITL3kgi5sc4/0= 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 1598019378239906.2806447994267; Fri, 21 Aug 2020 07:16:18 -0700 (PDT) Received: from localhost ([::1]:41754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97q5-0005Wl-0u for importer@patchew.org; Fri, 21 Aug 2020 10:16:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lr-0005Uc-GM; Fri, 21 Aug 2020 10:11:55 -0400 Received: from mail-vi1eur05on2115.outbound.protection.outlook.com ([40.107.21.115]:44416 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lp-0005AI-99; Fri, 21 Aug 2020 10:11:55 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:43 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:43 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mX43eCVnOwF9uB0vXPHo4o//94nKpPctjwUSgL2/3l2X20yetMwXL+Lz64GnOgLcLQbYKwQkeB9UxiWedI/IpTi+BMUVI/QeZQe50nSWiJxm/BcqWTm78Z491QEpXQCKmFa9sNZicAcVElDDQ/j5jnvrWfvbzFrECjg/c0Qyxui3i3c3p8K9podM455zdwuWlDGv9tP6yKdO3pNgtcUEk6FDARniKhQCT3DxStewACgnbl6dgmI7TSaNm5mOrMv1FuewK2yy2qI6TihZ5vhzuITRkngrqIe4cMWYYNO38Inbre6YtExOR54BS5KW3tM55uSk60xu0vDlwu5PI7BX/g== 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=JicS2MgvlUGxcQ4pTtRKtaD7bovqcjl3Q8ZlpEpR78o=; b=RtOkxljYP01x9ukbwyYwa70fUaIqQ5CTJy2gzXAdoEAeCH9gGN7C+l4fNKIfsdVQK+Z9ufW8kctDHczcCs6K4BXBhd16dRgxkM4ZsqiKfoDMoRBYPXJ/QX7Fdlce3/Av/oNcnkQGKM8mCJxo1682wg7m1MwyQVGkBC0qkNI7HQKvgSVWD5pO04nzxDcCespiZML5uwUgSI0l1ss+scGEzSpFcYzedpLrFDN5tAuOCZAY1taZry00qtLV7zuSKBnbbXY1yDsu4LsPBaeCPCOBcgvtIMQHqpWzvYn1/W5EuslUTvpSOxm5hMgr90ysY5ndUzGvq9lC460zSSIC0qCi1g== 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=JicS2MgvlUGxcQ4pTtRKtaD7bovqcjl3Q8ZlpEpR78o=; b=MxEetfk3mLgDoq9VsK02c7xkjWFMRjF8hbMxN0cUd6bkKgWJWoED2Zs5v629TEIpasrOfM5zc+XZrTqgLJFYCjA9lVRjZ0c/I77Jo94jJPdzoDxNhnD2HmZeNfQaNuAYkp6E36G0ofT3XNghumVjRSdhkEi9tcdZLcNjqVut7jo= 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 v5 06/10] block: introduce BDRV_REQ_NO_WAIT flag Date: Fri, 21 Aug 2020 17:11:19 +0300 Message-Id: <20200821141123.28538-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4170355-a8da-4f44-a377-08d845dc217c X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: 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: Qe3Ib18IGO+sqZlGOPJyYZtdqcmZjg5jB5fDSDty4dfomaNWGsIH7mxE+Q0ZS8J7fboHI8OD/Wc4pmYbulD9JJRgBVrLftAU+RVUmBh6N79Tjd7TqPQsghYvZyNSOSbBOSMd8OBFoVhUrskLCVKnlKtnEKjEBUZeXErnbXiGMiqpGKq7h3HVgsAteCx742d83rrcQfHGx3ZYWAvhvl+GcN1b1PB+eFfkpqjicw2zBSofC2EThPSzjrD+cWKKQhDEDFZ8esveNa27JRAKvz/PdKZH2H5zdDGGluWhjVi9JazP1uX27RdIgl1kdw7uVo3isanMrdWauo8SCxfL0XVmbA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: POhx0E3+DopZZj8ID7t3XKtBn/XNPR9ry7n9eNWsNFLPxEgtLw894dkp8jrgnoqxTXTDwW3ubSJQYr7pgcavq2rSwLxZ95rHuMFKkcpfVd6mFqnXJDXLLs4WH4czkZmiVTjomGrjXOwcXVGDBASnm7zXwcUF7Ko1pZJHtKpuDPBIYW7F1BeUJP92dPIS5U2y9IDj1F7SGTP2/u15JGzWoHshQ+VuNgpxIdsYADliN3RpOiPFTcJkQxbXEF2P13/w2W85DHIb3Aq9lZBzDzpqk72eh9Dcth4oTodp1K/Mukw4divPhYF9fiafkyQfi8tLrBcqfiylpgLRuh6ypBNzRwUoJCPFlKW/VGKridaaqhFa+GXQOy/ewR89RGJI6E4gv9TDDoC6up9m1enzbDz0/BB2+iZ1JUnJwMPvpdeAB1NhlwA2ItPyHZ56jctIS6NzKka708oUJ7zmG1nnv3Bip7uwdP7H7e19ptuBHSp95p59/TuVnN8FrVS7r/DqUYCxpu76Q5B3et5YLCOwzSwhCYaOEW9D88eILNS5qSw0SvVIBgB/rKTzLIOA1Y+QJDZAlYE+YhnRg3jWLu+/9lnBjyrKet5FU+67cOPtlRDXa8fVmXz+bbBXicfkWK04ci+GYl4IM6qL8PgfDmczF7r8yw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4170355-a8da-4f44-a377-08d845dc217c X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:43.2710 (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: 7U195Q83nesVK1Qff+85ialc177pbCHZWngbrrYb7DYLyAzWN9WKqJ9wUKGCrNYc4LG4qQHshLOx33RDYPqoPLYtv2Nd1GscRjlTnFKHjS8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 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.21.115; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:51 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 Reviewed-by: Max Reitz --- include/block/block.h | 9 ++++++++- block/io.c | 11 ++++++++++- 2 files changed, 18 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 dd28befb08..c93b1e98a3 100644 --- a/block/io.c +++ b/block/io.c @@ -1912,9 +1912,18 @@ 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_LOCK_GUARD(&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); } else { bdrv_wait_serialising_requests(req); } --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019508; cv=pass; d=zohomail.com; s=zohoarc; b=IoE1gd/6BXXkkfnKoPIU20bA1eeTvEmudjVfzlqKvMg1tkWsHbhgCLu5znXTMGlC6hTcqO4jh6nNBNwlZuobKfzx1GBLx9IChaRfXZbUOJRVRtsZ7YKZhkssqKgcVcbrx0DrX7b5NjNB9/5bB3sNmLb1+9AZKGdnjbr47rmhj6I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019508; 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=XNWc3uvAHjhP7F3zdyGW6fCtrLJxdhDq6PVseTT8UEQ=; b=BeT1YE9C9v9q0rkpNLhiv6aWGg4KlgU9GUts4Ad2CRUaZTc1SifbHMmQDf7wXqn9bzzFsg2yGnh01Fuyt0cxOEp5tJDyAF6WeVRVWXXtWQ4MY4Va4vqC/7zKroIMM+OlrKbYVLiQhFMX5k0g3umEd+yVOHouXH6NwkZavjSjm90= 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 1598019508657245.71370605770414; Fri, 21 Aug 2020 07:18:28 -0700 (PDT) Received: from localhost ([::1]:51822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97sA-0001DR-9F for importer@patchew.org; Fri, 21 Aug 2020 10:18:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lr-0005VX-St; Fri, 21 Aug 2020 10:11:55 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lp-00053q-6a; Fri, 21 Aug 2020 10:11:55 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:44 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:44 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ajQD4TudfbfqRSyxljGIqtEFaqrlG/TtlhPhlDaAEMbvU/7G5n37x73zeVNh4FKMJj7kZ9WvIDnl0YX1+GAu+D+uyzawHdmzbNfkDvnjr6HW/vu0igagziWrKw217MnDmn/QaOUMFJlcrGEI3SnmOE686N8H1rnNuYFTa7rZj+7+4F6sSdAleLMR7EiCStt1PtKgklJmaGbjOM38fN5TTYDdPNp6vpily/kTcS6zX1Jjz+HjFYrc0XLBPrrfeHbqcyhrL9Z5spzmsZCAjETdLRfiZBCXP8qijA7a2NUI6VMrXeC54RBY+1mcQxo+MyyHrsrcfWOpF9zGtismQv+OpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNWc3uvAHjhP7F3zdyGW6fCtrLJxdhDq6PVseTT8UEQ=; b=DcxZLYN7G90DrYney2v0ioUK2e22nGrl0TLwkEz448Si1sazM0Wxf+d3YWw4m5beFb2BKClfLXfvnX5guP35h3177dgKfc9ob4sxs/rvBoYicnaWHrcBWhC6QUTSyHphSMsgKGSDZnKfXwwbXiw9nQBaE3d6lPiJ+OSpp0CRPJzNOndEpWCQtk1IwvRwQPGv6ErJzYZbyGUxgsDaT5e/KXCSxWJLHlMqytiwvPEjtVyASe1Ny2FYPZcztB95fha7H7fZv67PFiRThJv0erJde9jEUPQ6UNS4qyqA+YgEBS+ViNYxu5bd2O95mW68lt+3EgenTqfcLqzX/DBqse4hkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNWc3uvAHjhP7F3zdyGW6fCtrLJxdhDq6PVseTT8UEQ=; b=m9eGyscgOkNvPS7Yi7BsWuZ6V8LroQvU3TO/zjoJNr/1+VtlEsHDuLh7oFz40TR6zaLMQ2/NN7udeA8CKxOkH0Bv0yHv+IfsO8iJ8TK7KaFlRsvtA3pL1p89UxIOW8dNwQf49aCeiI3/pdhcJifX7r2mSPOsvcFNUbDR+sLVePY= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 07/10] block: introduce preallocate filter Date: Fri, 21 Aug 2020 17:11:20 +0300 Message-Id: <20200821141123.28538-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f60345eb-6ba5-4841-f130-08d845dc2226 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7kWRmvsxZqDygG4XoakmQkwjZYeL2ktJMOwfR0Bh68tbpAluPuZo1rH48R2sklrNGoXMUd4Ut5Jnhir6KpklevMk9JqO7m7DfJOBI9SU4TX00y2J0SVi07ez9isksWmOGAMf9nnHR9Kg9QwGG4t5b95Ubi86Jwn6G7+5ZUTLZqAga8sBc7NoUnRVyzM5zA6HTYWyhbvl+KX6Y97C/GWbY3uO8/sF7oQrQA1iTWQ11XOgH+anjvelwl3KKOLRSFH93JlwX9hqwTDbALNwIWWlH+wqTcoXxjaW9r0HpiOmLnlzMeglFhiv/TbxYHavt0nM1oTTU/Hzbra1ZvqZjrCdEe4BQQA5oUB2+LK/CXGD+3uxZY2K0PpKGMyKSNIn853DUzY2Zoz8brBYMiGw7vadacZMal26KEHqRErAjE9636HID1BNQsSePN+joOs3TArS1A7fn13IXJJP4yLiYsTkOg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(30864003)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PAd+I0FRksEHXsKqsneL4SKKPjdTt7TwJwtOR0MHWooh2V6h9k2rL7YTtaJAdQUP8JjUxSN+F+Q0gjbQRimcvWPP944RwS7A8hYUT3iuRE0mk2HQ+1bQhlR9XmPmk8Vto0uPqiko7m+MxMgQqqgD7mpkqLu6niY2R4/6A9CQ2WOXMVGZ2Gep+6QCVrVuRC7JXpaGFtfLvD+DXqNsnEuTF2oHScqqu6RrDqbQhar8XJz3bqQRkr0UqRVAlbN+hRwC7jkuwOTBwJ1DoXtAkZiCx33aKRDegPjKIu+20OHspES+SOYsAwTUmNAysZMZJkVzHZFJV54FJnKfwd8tCu5f8EMVV3XQ5Y/JZQlt9p2Lm2S8J+dPjq5+3Dj1B8qw1aY1Su765njZYEJmCHpjN3wUkx0G9EoTRbiAnP7Sf1pSvDtD8F7w4oecZ5tCWJoQAKK8HShjluPbN+HIWpfGNiznXXideU5JcCzSi9Tf5VQLE4C2vQrOiGAPm4YP6xTDAU+WWsCUefXR5a0Vmjsj/ShmD0IN/8NSUJRU/WEDP46bJEJSvHFKkfTUCO9v73pTuhMmTTlRgrepc/AA3US3tjJnNUId6dcQ+Pi9u+C7ooQleOuFXu4wAX13x9TKRssBChWCL1sdUtD3y1AC+7xdZU8z1w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f60345eb-6ba5-4841-f130-08d845dc2226 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:44.3254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yge184z2aDToglg4xN4HOzWV9CfBnTwby31sXJqXLSJF+JUbYYZCzorhI0Pk1wEiGU+JN6W9DqchP0EbRBeNleGo7pjjCAzYFdVhkY9RG50= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass (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.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 | 291 +++++++++++++++++++++++++ block/Makefile.objs | 1 + 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 block/preallocate.c diff --git a/docs/system/qemu-block-drivers.rst.inc b/docs/system/qemu-bloc= k-drivers.rst.inc index b052a6d14e..5e8a35c571 100644 --- a/docs/system/qemu-block-drivers.rst.inc +++ b/docs/system/qemu-block-drivers.rst.inc @@ -952,3 +952,29 @@ on host and see if there are locks held by the QEMU 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 don't store any data, but do s= ome +additional tasks, hooking io requests. + +.. program:: filter-drivers +.. option:: preallocate + + Preallocate filter driver is intended to be inserted between format + and protocol nodes and does preallocation of some additional space + (expanding the protocol file) on write. It may be used for + file-systems with slow allocation. + + Supported options: + + .. program:: preallocate + .. option:: prealloc-align + + On preallocation, align file length to this number, default 1M. + + .. program:: preallocate + .. option:: prealloc-size + + How much to preallocate, default 128M. diff --git a/qapi/block-core.json b/qapi/block-core.json index 197bdc1c36..b40448063b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2805,7 +2805,7 @@ 'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ft= ps', 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscs= i', 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallel= s', - 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', + 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, 'sheepdog', 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } @@ -3074,6 +3074,23 @@ 'data': { 'aes': 'QCryptoBlockOptionsQCow', 'luks': 'QCryptoBlockOptionsLUKS'} } =20 +## +# @BlockdevOptionsPreallocate: +# +# Filter driver intended to be inserted between format and protocol node +# and do preallocation in protocol node on write. +# +# @prealloc-align: on preallocation, align file length to this number, +# default 1048576 (1M) +# +# @prealloc-size: how much to preallocate, default 134217728 (128M) +# +# Since: 5.2 +## +{ 'struct': 'BlockdevOptionsPreallocate', + 'base': 'BlockdevOptionsGenericFormat', + 'data': { '*prealloc-align': 'int', '*prealloc-size': 'int' } } + ## # @BlockdevOptionsQcow2: # @@ -3979,6 +3996,7 @@ 'null-co': 'BlockdevOptionsNull', 'nvme': 'BlockdevOptionsNVMe', 'parallels': 'BlockdevOptionsGenericFormat', + 'preallocate':'BlockdevOptionsPreallocate', 'qcow2': 'BlockdevOptionsQcow2', 'qcow': 'BlockdevOptionsQcow', 'qed': 'BlockdevOptionsGenericCOWFormat', diff --git a/block/preallocate.c b/block/preallocate.c new file mode 100644 index 0000000000..bdf54dbd2f --- /dev/null +++ b/block/preallocate.c @@ -0,0 +1,291 @@ +/* + * preallocate filter driver + * + * The driver performs preallocate operation: it is injected above + * some node, and before each write over EOF it does additional preallocat= ing + * write-zeroes request. + * + * Copyright (c) 2020 Virtuozzo International GmbH. + * + * Author: + * Sementsov-Ogievskiy Vladimir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "qemu/osdep.h" + +#include "qapi/error.h" +#include "qemu/module.h" +#include "qemu/option.h" +#include "qemu/units.h" +#include "block/block_int.h" + + +typedef struct BDRVPreallocateState { + int64_t prealloc_size; + int64_t prealloc_align; + + /* + * Filter is started as not-active, so it doesn't do any preallocation= s nor + * requires BLK_PERM_RESIZE on its child. This is needed to create fil= ter + * above another node-child and then do bdrv_replace_node to insert the + * filter. + * + * Filter becomes active the first time it detects that its parents ha= ve + * BLK_PERM_RESIZE on it. + * + * Filter becomes active forever: it doesn't lose active status if par= ents + * lose BLK_PERM_RESIZE, otherwise we'll not be able to shrink the fil= e on + * filter close. + */ + bool active; + + /* + * Track real data end, to crop preallocation on close data_end may be + * negative, which means that actual status is unknown (nothing croppe= d in + * this case) + */ + int64_t data_end; +} BDRVPreallocateState; + +#define PREALLOCATE_OPT_PREALLOC_ALIGN "prealloc-align" +#define PREALLOCATE_OPT_PREALLOC_SIZE "prealloc-size" +static QemuOptsList runtime_opts =3D { + .name =3D "preallocate", + .head =3D QTAILQ_HEAD_INITIALIZER(runtime_opts.head), + .desc =3D { + { + .name =3D PREALLOCATE_OPT_PREALLOC_ALIGN, + .type =3D QEMU_OPT_SIZE, + .help =3D "on preallocation, align file length to this number,= " + "default 1M", + }, + { + .name =3D PREALLOCATE_OPT_PREALLOC_SIZE, + .type =3D QEMU_OPT_SIZE, + .help =3D "how much to preallocate, default 128M", + }, + { /* end of list */ } + }, +}; + +static int preallocate_open(BlockDriverState *bs, QDict *options, int flag= s, + Error **errp) +{ + QemuOpts *opts; + BDRVPreallocateState *s =3D bs->opaque; + + /* + * Parameters are hardcoded now. May need to add corresponding options= in + * future. + */ + opts =3D qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); + qemu_opts_absorb_qdict(opts, options, &error_abort); + s->prealloc_align =3D + qemu_opt_get_size(opts, PREALLOCATE_OPT_PREALLOC_ALIGN, 1 * MiB); + s->prealloc_size =3D + qemu_opt_get_size(opts, PREALLOCATE_OPT_PREALLOC_SIZE, 128 * MiB); + qemu_opts_del(opts); + + bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, + BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, + false, errp); + if (!bs->file) { + return -EINVAL; + } + + s->data_end =3D bdrv_getlength(bs->file->bs); + if (s->data_end < 0) { + return s->data_end; + } + + bs->supported_write_flags =3D BDRV_REQ_WRITE_UNCHANGED | + (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); + + bs->supported_zero_flags =3D BDRV_REQ_WRITE_UNCHANGED | + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & + bs->file->bs->supported_zero_flags); + + return 0; +} + +static void preallocate_close(BlockDriverState *bs) +{ + BDRVPreallocateState *s =3D bs->opaque; + + if (s->active && s->data_end >=3D 0 && + bdrv_getlength(bs->file->bs) > s->data_end) + { + bdrv_truncate(bs->file, s->data_end, true, PREALLOC_MODE_OFF, 0, N= ULL); + } +} + +static void preallocate_child_perm(BlockDriverState *bs, BdrvChild *c, + BdrvChildRole role, + BlockReopenQueue *reopen_queue, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) +{ + BDRVPreallocateState *s =3D bs->opaque; + + bdrv_default_perms(bs, c, role, reopen_queue, perm, shared, nperm, nsh= ared); + + s->active =3D s->active || (perm & BLK_PERM_RESIZE); + + if (s->active) { + /* Force RESIZE permission, to be able to crop file on close() */ + *nperm |=3D BLK_PERM_RESIZE; + } +} + +static coroutine_fn int preallocate_co_preadv_part( + BlockDriverState *bs, uint64_t offset, uint64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, int flags) +{ + return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset, + flags); +} + +static int coroutine_fn preallocate_co_pdiscard(BlockDriverState *bs, + int64_t offset, int bytes) +{ + return bdrv_co_pdiscard(bs->file, offset, bytes); +} + +static bool coroutine_fn do_preallocate(BlockDriverState *bs, int64_t offs= et, + int64_t bytes, bool write_zero) +{ + BDRVPreallocateState *s =3D bs->opaque; + int64_t len, start, end; + + if (!s->active) { + return false; + } + + if (s->data_end >=3D 0) { + s->data_end =3D MAX(s->data_end, + QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE)); + } + + len =3D bdrv_getlength(bs->file->bs); + if (len < 0) { + return false; + } + + if (s->data_end < 0) { + s->data_end =3D MAX(len, + QEMU_ALIGN_UP(offset + bytes, BDRV_SECTOR_SIZE)); + } + + if (offset + bytes <=3D len) { + return false; + } + + start =3D write_zero ? MIN(offset, len) : len; + end =3D QEMU_ALIGN_UP(offset + bytes + s->prealloc_size, s->prealloc_a= lign); + + return !bdrv_co_pwrite_zeroes(bs->file, start, end - start, + BDRV_REQ_NO_FALLBACK | BDRV_REQ_SERIALISING | BDRV_REQ_NO_WAIT= ); +} + +static int coroutine_fn preallocate_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, int bytes, BdrvRequestFlags flags) +{ + if (do_preallocate(bs, offset, bytes, true)) { + return 0; + } + + return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); +} + +static coroutine_fn int preallocate_co_pwritev_part(BlockDriverState *bs, + uint64_t offset, + uint64_t bytes, + QEMUIOVector *qiov, + size_t qiov_offset, + int flags) +{ + do_preallocate(bs, offset, bytes, false); + + return bdrv_co_pwritev_part(bs->file, offset, bytes, qiov, qiov_offset, + flags); +} + +static int coroutine_fn +preallocate_co_truncate(BlockDriverState *bs, int64_t offset, + bool exact, PreallocMode prealloc, + BdrvRequestFlags flags, Error **errp) +{ + BDRVPreallocateState *s =3D bs->opaque; + int ret =3D bdrv_co_truncate(bs->file, offset, exact, prealloc, flags,= errp); + + /* s->data_end may become negative here, which means unknown data end = */ + s->data_end =3D bdrv_getlength(bs->file->bs); + + return ret; +} + +static int coroutine_fn preallocate_co_flush(BlockDriverState *bs) +{ + return bdrv_co_flush(bs->file->bs); +} + +static int64_t preallocate_getlength(BlockDriverState *bs) +{ + /* + * We probably can return s->data_end here, but seems safer to return = real + * file length, not trying to hide the preallocation. + * + * Still, don't miss the chance to restore s->data_end if it is broken. + */ + BDRVPreallocateState *s =3D bs->opaque; + int64_t ret =3D bdrv_getlength(bs->file->bs); + + if (s->data_end < 0) { + s->data_end =3D ret; + } + + return ret; +} + +BlockDriver bdrv_preallocate_filter =3D { + .format_name =3D "preallocate", + .instance_size =3D sizeof(BDRVPreallocateState), + + .bdrv_getlength =3D preallocate_getlength, + .bdrv_open =3D preallocate_open, + .bdrv_close =3D preallocate_close, + + .bdrv_co_preadv_part =3D preallocate_co_preadv_part, + .bdrv_co_pwritev_part =3D preallocate_co_pwritev_part, + .bdrv_co_pwrite_zeroes =3D preallocate_co_pwrite_zeroes, + .bdrv_co_pdiscard =3D preallocate_co_pdiscard, + .bdrv_co_flush =3D preallocate_co_flush, + .bdrv_co_truncate =3D preallocate_co_truncate, + + .bdrv_co_block_status =3D bdrv_co_block_status_from_file, + + .bdrv_child_perm =3D preallocate_child_perm, + + .has_variable_length =3D true, + .is_filter =3D true, +}; + +static void bdrv_preallocate_init(void) +{ + bdrv_register(&bdrv_preallocate_filter); +} + +block_init(bdrv_preallocate_init); diff --git a/block/Makefile.objs b/block/Makefile.objs index 19c6f371c9..f8e6f16522 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -44,6 +44,7 @@ block-obj-y +=3D crypto.o block-obj-y +=3D aio_task.o block-obj-y +=3D backup-top.o block-obj-y +=3D filter-compress.o +block-obj-y +=3D preallocate.o common-obj-y +=3D monitor/ block-obj-y +=3D monitor/ =20 --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019606; cv=pass; d=zohomail.com; s=zohoarc; b=LJFPCbtSY4YfQe98kA2hGDbmwXS3mi0DIUepxQ2cXFcSMWZ8TbrrPqWMWZyHPwXtp91gCXjApyj7I+0va3CGDX5zldKhp4eWF3bmDdNILlX6cQbFbmOoTKL0DW64gs933flkc/K4DG0YGL3yChu3sRz/44h51eSIHySCv+29VnQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019606; 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=O2MXAeW/RMI77KkOtkr88BkwvA/NnR/QKKS6KgN4M0A=; b=cHPr3Og3FhYGgxCwHgI45e101VcDTFXvYlMgQZUPS+ByFp6Y//Auhmd1Tkd8mLjYUjFZ7MkNj7hWwosSUbJWWbLqL0WTm5R1lu1xm2tlLJHeiAaSWUFjYRGeEFZrgObYM69dD0PcKbWZBbJr9DSR0lxsSd9+P5tCwvf9W+vyDAI= 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 1598019606155609.0778075614935; Fri, 21 Aug 2020 07:20:06 -0700 (PDT) Received: from localhost ([::1]:32858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97tk-0004yt-QZ for importer@patchew.org; Fri, 21 Aug 2020 10:20:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lu-0005b8-1G; Fri, 21 Aug 2020 10:11:58 -0400 Received: from mail-vi1eur05on2115.outbound.protection.outlook.com ([40.107.21.115]:44416 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97ls-0005AI-4e; Fri, 21 Aug 2020 10:11:57 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:45 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:45 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXl7H6Nnt+JSG+ouHmHc2BWdqURkNfVt0IncBWtGrNqwa77VySc/TpIZo7b55Fly88B70kbDZMWZ5eIiAP0hFPVCLENGFZbT8E5eYInb83dIxeK0Jrvz/uQ/ONTZVhEiGSa0SRybdWOMbmI1PDwwIRp3Mt0Qr1rSB3YssdyUiIlBaKJn2kQcmXCu+0o6f+kqFrlt/Ht0gMWbgJ9/Pi26eGv/+vfCBVNX+VjDkKpP6cC46I5HxvxzY18Yrw9LcNu703qGgCelwUnalV4jUnt3o3ZQZSuzhHolPxS3/+9mC0XkK9tzDu3l6TMMMFKfX+kuU4uccVNVJYI4zgDlbznkMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O2MXAeW/RMI77KkOtkr88BkwvA/NnR/QKKS6KgN4M0A=; b=IbDtApT+sJFFYKwQ40aG/tICSAhgdK/BphsGKb8IGMmfcrotihT1lZS26uRIUqntMl4DKo9P5jOSXqMRfivXs+i1+XOgdH7yjoARLGRmXsBMjOTQjlJIewpjPe1gs4gcTBCwWUQfC26fEc7ibAXI0dJqqovSjkvYhrOS5nqhTDPQwRfUKRO3L+8VKayZ7ckIe4z+evlYeR3REaC+GfBWD7e2zyagsgf0BiYcZ8s68ftbeYzO5TPntCGloqZHapOjSWfMRD6l3hGhEhkgVmd8aAolE9OXurTd5hmWaAA9732MaGrfEEFwx18rMCXZg0NWKC35I5CMrNdQ7D/lxf2Ilw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O2MXAeW/RMI77KkOtkr88BkwvA/NnR/QKKS6KgN4M0A=; b=TMPMgZ0jw2pyLFcjHQh8tl/ZfE/HbcXrAEnzNoI330nqEQPR0z8wEEMDDrsrpqxuxqsZTA9hNymX5jM4cMZ5hJ1yBqJYoYYZlXkB2dsmpNMuM/i+tsp2wQhMsmPUSMdt3cTZuXXs008JYnbOyNYq6dcxMluBRHBQ9wCQ+s9JJjo= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 08/10] iotests.py: add verify_o_direct helper Date: Fri, 21 Aug 2020 17:11:21 +0300 Message-Id: <20200821141123.28538-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3dab13f6-0088-43d6-1960-08d845dc22f5 X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1388; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ffrMMg98Tg1uBfggmHO3czBh2RjtvpBQE0dUA9uj0EujgUzzWbTSFRFe7rffrBaVn+R/wWBrMWZXklJyF6Pur5dTbWlIdZeXHI85dtoKc4Pftxu9BDKQvt63Ry68s5ckg5qSfJaJ0Sdw3dg29Qzt2FqFS1LsEcDGRtAU3uoVBs89/K/Dqn9mTgaXKqCsll6Ze0FW40rkjYggezbklmVw+HCVYSqahWq/dErB5kiLOUYhLo0wgUPwLhbLhcQPoOzNxkUdUJ+c97iTP7YkNIw+J7Ztc195Y6aY8zDopq/EClfUnUqW8I/S8XAykj2gVTTfercE+R2ZZQAq/C6jAREKuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(15650500001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NOLU7VLL2PLqWXG6c0wjUd6ZKGrfEHu6WPhwiWGz/2FhUQe6935awrTbpN+zwdecILhWCYJ5oyVH87V4wbPGKcN9eYMmb2qI7U5zquZTBN7Kw6ZmAOC7IPsxGBqYY+OEf5/nq6/JcCm47/AOlAoIlBS7pf2HN5ZIkgDopix8QsTUtucmU6ZDtuF4DxbfDrWbJv/Vb66NNFrN84U3AxINNq6znoai+XK6Mn2BFAN5IumHm0yM0vL6OtOv3+nCnLQ/mqxm6Q++QRz7xjmKyQiwB/ktJabP2mPcU8AOf8M4NbNzcNL5sAPq40jDTJKLWTfCfX7gPA3juHuz+GPH9H8diORQFY38gvdXbQVNZz7vAQ74XkSdYC0X4eUUzc6X7a3yJpb4w6kNbCP1R57GAp9YKHIfuPStvQYGjslGr0UlWzA3+wnS1GlEfJ062BE4XNc5ebgyj+VYjygvvurRmp+FvQ7VZrSuSNRUPY/HXPav7f2i5tdbHU4xvgb1IJ+IoiOEbiYXfBC4t4HvnmFnlAkcHbCSGYGBTkZv5JINtzqhs/MwSjEEbzd/YFwuvnKErWU1jjZESGyvIBoBL1Q8N49uJjEahlft7khCOZhgqtUuXf0yv4y9O3d0zDgLAWICJQJuwP7NTDiOeHbRg2aePDYK+w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3dab13f6-0088-43d6-1960-08d845dc22f5 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:45.5779 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wiXorVrtaOQMnTGD3wZyfDVF5ET7wdX1MIY2DH2yNW/cbxueb6JHKXySPpQ5M/Q9BmZiJZzKt+TXaPrCx/j8aCZvmPcQJvw8DpqcRZ5KOnA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 Received-SPF: pass (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.21.115; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:51 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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. Suggested-by: Nir Soffer Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Nir Soffer --- tests/qemu-iotests/iotests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 717b5b652c..7f1aa187a9 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -29,6 +29,7 @@ import struct import subprocess import sys import time +import errno from typing import (Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar) import unittest @@ -1083,6 +1084,17 @@ def _verify_aio_mode(supported_aio_modes: Sequence[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: + try: + fd =3D os.open(f, os.O_DIRECT | os.O_CREAT | os.O_RDWR) + except OSError as e: + if e.errno !=3D errno.EINVAL: + raise + notrun(f'file system at {test_dir} does not support O_DIRECT') + else: + os.close(fd) + def supports_quorum(): return 'quorum' in qemu_img_pipe('--help') =20 --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019663; cv=pass; d=zohomail.com; s=zohoarc; b=S8PrETyxPFDq2YvjnZRQIgl0S2ZaciCRfaTvDx/B6HpdMGjbquLDUs1yRzWiy91/5jXFic3y8IMoassDTFFaaEO6wH7d3S4GxJZOrGmmw0lJfbMvFcfsf3zBYtRa1JIubFLkyC+bFoSjFNYcwnp0aJDPmW0qxzhgnqex7hhcgPg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019663; 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=CHDE0oMfdz7fwIrU9FLt+uCfg+Dztbzf6ECJwUYmXEo=; b=ZAgjEx8scsxQ9v1jOU+EKH0sTsYl/Wh22SV09dSy78BJfqWBn7efEmUduFaYOZlz+W5UIuU6Kg2HcWGWYFuqRErN+LuB+X07RrTkqhH7GuM9kr1IKiqMFyhr/jOI8RxhSz5wFyerLTl8tWCUdq6VL9Gx7D3NyfcYbKpdh9Nn1TI= 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 1598019663902854.7863890119902; Fri, 21 Aug 2020 07:21:03 -0700 (PDT) Received: from localhost ([::1]:37300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97ug-0006qD-JA for importer@patchew.org; Fri, 21 Aug 2020 10:21:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lu-0005dQ-RM; Fri, 21 Aug 2020 10:11:58 -0400 Received: from mail-eopbgr50124.outbound.protection.outlook.com ([40.107.5.124]:48515 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97ls-00053q-HP; Fri, 21 Aug 2020 10:11:58 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:46 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:46 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4sktRGvMGJTlpD/HvJe5Ya4argZLV6aEIV/jjYsaq4qebPM5R0gIKDCQKvQdUa8oHvICRWNVMajXKehXrFj3sfL4pX5oJ2VYzZEJR9pFTdKPc0bqSHFD4XR74o+G4tY6Nk0IYVKL4gMrlN3kW/Sy4cS8q2Y5tb66o+dgHl7rlqDQOMQv2zh/uPHjhOAvXl9UE54aENtCz6vjcPnmp9AhShtdsHd6vmFYQzDi4p2v54umeFC/FRhWhMtFZy0O1XoYbJywS9pjPxG+2GmxhvrAwLw4EutRme6eZmhVj3PHMyxcAuyGAyUa3v9nJVyDQmVbw+JLOsFZD0mPRJKuSX/xw== 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=CHDE0oMfdz7fwIrU9FLt+uCfg+Dztbzf6ECJwUYmXEo=; b=meYc1t4W+hSkc5nhr+o0gaFODAxuUNYifdjoPoPJvWIjJgIoQ1/aLg9znLIsugepbk0NMYFfdzUBXQ0utV3v4rjGpMN9AfepU3pewuvj9et8fl81sPXuuRH2pj2BL9oaMPmRAY4GU8MoivsNF07H0/T10wkZMe8V/cAXVVTdlukpjzkT3X4VCqJPBSlubsnJzLXXuIBIl3XV1CrwFEnJVrvew6W8t58nzXflRs5IuIu3oFRgFXSJotwiuKgs82rlPntzAovOJdFoHRe4neQ0bM41V/1O8m8K4fVWskzDsZkXHc/zHkhgReet2HpfwqTDohUFuUnLWuJ+M1GiipK4gQ== 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=CHDE0oMfdz7fwIrU9FLt+uCfg+Dztbzf6ECJwUYmXEo=; b=p21kOQvlx5NwA4ESDzZZMHiOJtXRjdcZQKSyZOq1CIY+AnqvGO1IUyJiILUeUJ/oofioLTvC86sKl2FZ70tbmZDjCxvzyte7FJ9D0T7pyJUTs+MbjRTjTO25BbQxy/Rtr6zCY7k3TAFU3c7sEV4jdXaJOrAxcenBLPP9rKaLmx4= 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 v5 09/10] iotests.py: add filter_img_check Date: Fri, 21 Aug 2020 17:11:22 +0300 Message-Id: <20200821141123.28538-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d9ac4cc-61e3-4612-cd95-08d845dc237f X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:393; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /PiaJs49r/WkP1bwR1qSl2Ezr6gaUb5PDErfBWHhdBmRGHRlOmQKyZc8v+VGJQq7Xz4bIdoFEdYhyQhhEaKOCsTybr/pb/ffPfmQDHHEScWpW9oYaZwglMurX7OTOZ2+s5V32WXlkAwsc76YTo28qjv7yy3591T2xetm72wC7rKqgcHD/yOerIemPEnWr6wnErX1sZ5cxHUyNClfD9zbuAzZBD9UdLCGCLjfuGcIekU4FFBsV50o7yNXr8NTVA7PoLn+01jghjtRt6rD3RPCxi7De3mGREyHhOHAUwMtMfD1YwwVPikcsJAvuD3Csw1HKgZXZRwoQvPFvX6RwKJNTw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(4744005)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 69+mnTj+g0v6Q5123EDE6kQKU3GB2V/7zD9tDHQiPi6LbNl1GxhGLYy04U/Qg2LFHS8H+XQR//Z6ZXom+cyg5KVbLDxBWk5j49BGlHr21sSFNtdzk2zU8bsgi65x+b9IniEhMtFVxc0zzRHcMqEZPRNoykxKwEHKmnayipBlhW9ctVJ5N/T/0x3QziKaA88iBl8z3zxawP2OuTz2+7fZVihEnRBQRo+e0ytnvopng52Vex4iQ1fHfqYWvJrMQ0rk0sQyzi3ADl1OChA8WrzqtPSbFTJ77c2qZsvsCsZ0OwcWlyyIj56rp1vMZIv2UVkmNQ1lQzw13LFcAMSNmQmtdNrwdADfQcwZulNiGmg5hhqvXdXPJIu6ex5tyxEnFqE9eQjJyvKZM3OKJeJpyTwoplT4vKzys1V/6qU7pL/DHWhhNPVtx4iic6i3xyDE6iwWo21WRqcsOgHluiXaq+QAQBCYW3jk6EBiqiXxiPofJhOrx04mL8W8hHAHutPN+yjyZ73DyKl9hzXWQjVszShzEH6rqSwpvCA1yYgLqs8D0C1DAIP/Amxt4pP9kz7OkTfKKLG3moQ5kHN1Auo8CnXbrXhxLgqQhYIwuSXGQg8aEOPTzyD5lI8pqwjJ3oqeIAESa75A09JZT3vKzV/2OLmGEw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d9ac4cc-61e3-4612-cd95-08d845dc237f X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:46.5048 (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: FDDochQ+Qc9k/KGrlE1e41p8dAEcYuLHNkPvREypoRccVr+jxmGOqFv4X82hN664vdLmH/Ey89AXQSvLWzSp2/FIOwWGwP+BVDr885VsKZM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 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.5.124; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:37 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Add analog of bash _filter_qemu_img_check to python framework. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7f1aa187a9..14f1d47d52 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -403,6 +403,10 @@ def filter_img_info(output, filename): lines.append(line) return '\n'.join(lines) =20 +def filter_img_check(msg): + msg =3D re.sub(r'.*allocated.*fragmented.*compressed clusters', '', ms= g) + return re.sub(r'Image end offset: [0-9]+', '', msg).strip() + def filter_imgfmt(msg): return msg.replace(imgfmt, 'IMGFMT') =20 --=20 2.21.3 From nobody Fri May 17 03:00:53 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=1598019746; cv=pass; d=zohomail.com; s=zohoarc; b=kXMwG9XPQaLaTZ9aRpAFj/YNvWxw8B7JKdFFbwNZseEdJTt1vSH4+Mg8Lsxsnijo99TE1VTN8t2NM1amWwoiGoa4h/dJXjf8Rpz9l8N5zZHxV7YCmovFjA5eqXc8PbxsRDoFOmDs8b0fCTjMEkt7uZbBArj8gmA2kuU4gAAgDds= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598019746; 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=PojbpGlAjyIZLQtIBV+fJDsMPKIisfljgBp7buOOgss=; b=X7lPKxdlTBha5rI0KIDzGShbVyk00ms3BMCW0xjYIhPSyQnN0/T7oCjefb7j8N42V0DYiqF4U64mnt1jPn2R5Lq/a7mEYeb4IW3GZU0cSOYAukpi9dZmoiSnKcpGaYWyGLVckbxiXc4AoiyOXrLC5/Uv8aRA9jpiCLsfM+fijeM= 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 1598019746720129.915318590516; Fri, 21 Aug 2020 07:22:26 -0700 (PDT) Received: from localhost ([::1]:40560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k97w1-0008B4-5o for importer@patchew.org; Fri, 21 Aug 2020 10:22:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lw-0005hx-L5; Fri, 21 Aug 2020 10:12:00 -0400 Received: from mail-vi1eur05on2115.outbound.protection.outlook.com ([40.107.21.115]:44416 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k97lu-0005AI-Mw; Fri, 21 Aug 2020 10:12:00 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB5253.eurprd08.prod.outlook.com (2603:10a6:20b:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 14:11:47 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Fri, 21 Aug 2020 14:11:47 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Fri, 21 Aug 2020 14:11:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fQmIjemLHVjL2tAc1eKocV8yBJYJDde0qxl7n1kITSWPgaP8sZRLgHIDHU9MgkpHEAvhT5DyTS9vkJlb9KJcBsMBoUswHzY0gp5tfljX1bK790GlGuVL7RP+i+x3mdnGzfDDDbwixTe3ym+8ll17FqbCO2GkjPX8JtCHQaJBTUC1BM+CpkosW9wfjteGHKO/mV/rYdmnkyKWOQgtQ3Vf5Jf2XW+BT1JSjZrsIXNrPvQ7uSEc8+SqC032Mf/qIeXPO8z2scHAKXzMgZHZARtZvl3xV9BHaHngTohFW0rN0YMT27vkMqbHOIts1sMa36Jccl3srKbBoU5kWvV3mRC2UQ== 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=PojbpGlAjyIZLQtIBV+fJDsMPKIisfljgBp7buOOgss=; b=SKVM18pbnjA23iHNamg81SMO4Bu6qmgisd2s4x2q6WlSwnp5APD41r2cQeMbXyVriJVPW2G+M/BbLmMY8Ayj4mTuXwEffl4iZkg08kVRVILtOt5SD4kz2opeGe/IEAmaTM1z15HxlQU/wkBin45jNwYlAJ69wJQlGunVuA1+mcReY4Wh7UTTbvUfG0K9jwLtX7LY2YWRK+ZSX5KwbZuZOQ3jaqjV/wM0OKtuo3HwBey0Honjn5QW0nrKTD3wufdgNdO+9jcPyDl8KMELbWCqa1vbAshJCijVqxD/SZ7Ru6YCp/9FDihzdsXG6C2Qs2xtLAVN+oDunr+z5K7KnCxN/A== 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=PojbpGlAjyIZLQtIBV+fJDsMPKIisfljgBp7buOOgss=; b=scL8sYEe60CBAQrNcpAqEfdAWF0sDIJaMyuXcffuLAafnBF17n8jjsqpoZ+QZq7/XfV3qBIXyR77ZthMsrAP3PzZnDC5LNxUshcZsgRj2WJ0bdVmplH0/QdRKw4p9w4dpb76euBQiC2OvgPEefO+kzL4oAzFKqOnocKKKGa+D04= 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 v5 10/10] iotests: add 298 to test new preallocate filter driver Date: Fri, 21 Aug 2020 17:11:23 +0300 Message-Id: <20200821141123.28538-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200821141123.28538-1-vsementsov@virtuozzo.com> References: <20200821141123.28538-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM3PR05CA0139.eurprd05.prod.outlook.com (2603:10a6:207:3::17) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.21.3 X-Originating-IP: [185.215.60.171] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14ff7567-5116-4e8d-377a-08d845dc240f X-MS-TrafficTypeDiagnostic: AM6PR08MB5253: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ofuxbgHvlzpb8BVipLjKdP2gYuEew8aZRWRHjwNbhf5gLWBVvqmUjsTiNuEnVsqpUZPRfX+3CnLswvPCo20DASU1TSuw/+LTRcm6JFHot0VUl7eI4qnV+xYLyd2RTbih8NoAxzoLcxWQ+88ISVGGvMT0I8LC8eUkbdmiKSlW2hUJQ2Uyx1pVMRSjgUPBAT545L8BonlgH6kTpjrduZzrys1VTvkdkFh9LiI3zQ3o3lUf8NCeHd8EJudF8d0YHSnt6m0lxu1Wd2eJrS0PdJXrsF6pwY9PH25QCsQdnMAEiYan1ySKc8h/IHo6Rw2Dw+OV/wYGxQ6q8+bHNfxvaKJGJ2cPzJe1+GuVXBMhEvLkw7AoJHgaBSMx3sSg+aFpQ2d5YrOQu5AQJvwTkCN6ODJEyFy+28usJDeCsZnc9EEpvIEvAfs8jQVBHkJxr/maXdO4egWOpa6PAcxYj+IeYQbTmp4Yjb8GylSKupXNl0onsKI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(396003)(366004)(376002)(346002)(136003)(5660300002)(2906002)(2616005)(186003)(1076003)(316002)(6666004)(26005)(956004)(16526019)(66476007)(6486002)(6512007)(66946007)(66556008)(8936002)(83380400001)(8676002)(6506007)(36756003)(52116002)(478600001)(4326008)(6916009)(86362001)(2004002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 5NuDqFw++oncoSRttz/DC/RAc3adyKgePwFiQ/4Bhz61rEZ0mqYoGJxSMKWR0D9tSwG0s1aPQ3HfcusYjCTTy9tdI5un62Xpst8P+PnUxGcbX4RMt0bBsYtiPDCSVZx51FM4qveqQRnC+62RdFMBziFlGQSMigaE6BJo9U+mHMatLnJy7n85GU/s4a0RlDc/YbLrbCbhV51jh7Jj/xNPbuCdVCle02NKLVU+AwTkG7Ead9Fj/7XFDSYQVK0v977ejsPYUHWRW6W9GWXgMnnOq445olEPX/OR6tOxwIbuEcRDxyOEBZiX+rxFJ+mfz5jytOXNPXoyR+6x9tMswY/IKdBVskp7YfKtUa51B/FRXp7OrmSqzTObSPJMRNqvgc5d7Rq9AFhTbXZz2fTwXGi+E9Q0oZO/9QJA9OV5iNkfxGFvU7vQPtojS2hXAMqrLLCtkRW46y64oDhDyhVz0WGjN+1vUgAPbCJn9HtjXxKlpXuCe/pHjeHYvINYsF9XkK/JSrxqaqIdGzqq+XLZBhwbIEyAJuC57/HmSXcbrIoU2UTaAHmnLiCAaP7UueL7W5Ef/5QS9d+lNK2tFChygzQ/Xvcpc6CbY/womMCZ9Rm9hpMv22r2n4XoLDKP7PGxaRFwMbUnZxvcuPe6xqHrE8SyvQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14ff7567-5116-4e8d-377a-08d845dc240f X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 14:11:47.4507 (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: lssm9DJYFq5eXppnFIMkYuYVSg8o7iPpCX9FlDzZkF3ZBWaVe5BojLdVr8UwgnFxyaup9Zn+VMoMaPiDHOFo6J3FJhK5iJZ3bBhrR+bIAzo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5253 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.21.115; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 10:11:51 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, nsoffer@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+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 Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/298 | 50 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/298.out | 6 +++++ tests/qemu-iotests/group | 1 + 3 files changed, 57 insertions(+) create mode 100644 tests/qemu-iotests/298 create mode 100644 tests/qemu-iotests/298.out diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 new file mode 100644 index 0000000000..4f2087352a --- /dev/null +++ b/tests/qemu-iotests/298 @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +# +# Test for preallocate filter +# +# Copyright (c) 2020 Virtuozzo International GmbH. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import os +import iotests +from iotests import log + +iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.verify_o_direct() + +size =3D 10 * 1024 * 1024 +disk =3D iotests.file_path('disk') + +iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(size)) + +opts =3D f'driver=3D{iotests.imgfmt},' \ + f'file.driver=3Dpreallocate,file.file.filename=3D{disk}' +p =3D iotests.QemuIoInteractive('--image-opts', '-t', 'none', opts) + +log(p.cmd('write 0 1M'), filters=3D[iotests.filter_qemu_io]) +p.cmd('flush') + +if os.path.getsize(disk) > 100 * 1024 * 1024: + log('file in progress is big, preallocation works') + +p.close() + +if os.path.getsize(disk) < 10 * 1024 * 1024: + log('file is small after close') + +# Check that there are no leaks. +log(iotests.qemu_img_pipe('check', '-f', 'qcow2', disk), + filters=3D[iotests.filter_img_check]) diff --git a/tests/qemu-iotests/298.out b/tests/qemu-iotests/298.out new file mode 100644 index 0000000000..baf8f8425c --- /dev/null +++ b/tests/qemu-iotests/298.out @@ -0,0 +1,6 @@ +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +file in progress is big, preallocation works +file is small after close +No errors were found on the image. diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 7f76066640..cdcde2fe48 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