From nobody Sat May 18 18:02:08 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=1597949011; cv=pass; d=zohomail.com; s=zohoarc; b=HF6ipFe3WantjFaMbu7jlLJUUuBNn272T26rEhoH3HJqCgUK204m1c9Fg/GHPoJOo7f+KyjYP86Oes+W1eFLJzkSPozX4bjfINSfLGVDEgmzEKE/cEJXfxtXT7JKFctVCHl6c/E9uw3MwlOCJPyjbdKBCvfcq4h8mdC+tr05QXI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949011; 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=ZKJeAI8F694ylEoyAew2tdwHabw6lTHgsZ65QfoQSyl3NuWMAYaZ1CkE1dUVhLioL7oq1+m4IokUD5qrWgukDTtDiyg8JesQymyHoNj5VR/cnz+Djl3p6nqb/XxY7KuoUKM+wySMRzndmSG6T07RQXmcL6ibQx6ihTp35nHVnOw= 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 1597949011695385.0605448723294; Thu, 20 Aug 2020 11:43:31 -0700 (PDT) Received: from localhost ([::1]:60956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pX8-00056R-Fd for importer@patchew.org; Thu, 20 Aug 2020 14:43:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU4-0000f1-3d; Thu, 20 Aug 2020 14:40:20 -0400 Received: from mail-eopbgr00104.outbound.protection.outlook.com ([40.107.0.104]:1630 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU0-0003CQ-LG; Thu, 20 Aug 2020 14:40:19 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:05 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:05 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GBiRo/UBCqb/Ty3eTZVSxkxGszp2uwf6OLB1rRg7w37MJ3W6s4o5MVqfHwALBC3g8bfF9MNjBXRPRaHyqanaH+ytT2++q/oQyzSFqRLC/8xhkLB7DR36IhT8e53Q6mj/OVoU1R5Q4Ei1of70nhfJNdiz4LFIjLCs6HXn8n4PvOZl94UtOhn2L+lbzMYDPxT9TI0VBsVOsWxkbL9o+Bzzt/kdtuo0w7+yRFzRYMyEQ+0I08CjdCQS7iQBhxfgWQXKJhmAhnCuxREPo3l81RkyoBUdBoNLI8UL6kbYFdJ3k171DWjX9XQtGKv7OSGE5s1ZG8zcF21HHru40HtZJg57WA== 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=NU55x8MyL95otdMvAoWufwfYClk+DkiNBgvCrPXKvgN2h4N1o/oMVIcjM8Xg84jZi60mPQQRQeKFusojqyA/WQKvAmVzQVnPj2/yeWg+rkVz03g9g6rpdLx/pWD6bAdwV9VBgyvjnEn8m6fNF+D/U00gGDEnBM/iPByWSGd9eozeu2YBeXFJ1or2831XfM/O4JP6BtJxyU4JLtoUbJhjDC1owNPtxHtN9YtrwcQSj4ukVeub7KU876G/i7v8iVfnF2h+FXwnxKVjd43RwxPkvq4J4JusqGQRvnm2xYtAEH08x1PuP6xYdGLZdpHxM/gt0tuewRKjtB9J4mi1jSsuYg== 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=oYkAs51IndqwbZjPANADAN5XEAoGMqpCVZPwQXMt3RF032wLHIBlM+y1+iUvB3M8F4bQdxqcp0V2GNJaCNaJX7RQm79YvInAQ3wXHq5DZaBqoTE+ONdWNy3GQh27pnfUWol01c6GUFvAp/05k7wIQWzNmerxUkOalTHLjW0qgP8= 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 v4 01/10] block: simplify comment to BDRV_REQ_SERIALISING Date: Thu, 20 Aug 2020 21:39:41 +0300 Message-Id: <20200820183950.13109-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 1ffcc4da-8d39-48b8-b771-08d845387472 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: oXQhYPOz6R9JYiHo6aLzPawunKaYYgM8un83h9oDLjLkt+jvJjvgJSocb0Kx95U7jqi3IqBl2QhYi6xxTuT2fnYnJqUnxCGSJtcDRP5zYIp3xMeFicw5QfX85LODMiMMpV6Dm37Nldb2DmyIoaalXgyDz1qDJ4X/Vhgq0nbRsRX+v1FrT2t0w5Y+1lX8kkpqEEKTu8x+T52WwpAnlQaFmQRaa/iTPqyj9xsADJR6ynYTEr88HZ3TDdKZsVeKguj9jbiIyct0ogVwml+hNlS7UBWRLZTwZAbOd5U8FJw83pXr4jtsYWvZN132hSCqfOQMgIQzwWhejMfj2avjuDTsXg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: zs5MA4mhq1cD7ueBJa1GLShLzC11u2wyIJuoru6WETglEoEw7Nsol5pEIqjdGARbolvR5D88ZVkWEBScyzgEnWHmc9Ru1rHqxk2hPQ47rVHq7faXSj7k3bjK09TRo0BhQIS60krYZo2y75oQrTS1c00qrisTH87Z0T4/ICOpnetg0/0K7OOiII9wmDdWCh7DbZ2Fd+IFNcii6YBiDfoyH7MZZAjk8a4RT605xR6UbEu7Jl0gz+pK2Y5+9otLMxQJZCpaqK24pvEVvzXEmt/Sqfe1I79UtUX5Kbdi4ce04FTctSInwKP5vur8tXcCcwsNghqfWov+aBPGNqhOlvqxj1BRpIQzsKAMLLKR6GXjEXzershB2m9VeoeBkS/2riPiYhDCgtVbyWg3zfoUMl/VpB8F+K7vWvpQXvBhR2rRZ1BZpCVDPoPvr31krY95KZdfNOfK8GdNncp9JplIl0x7gEcgK7CdQtQbzOsKLlQn8Ttlxkom1Niqn2aCZXnDv+6DXJ29WeAOVNz1PZbbB99qzW124/DdnYidKv4Q4xxfMrsPzX9NizgOkpSil/qvZgwfKEfnmHJaGQuYIsjZEh6+O6X8qLrvJ8tjc+9YOmWTXWZqPukr5bQCkUOfuNlCeFeHtvUlh4mU9De+UMvZIw02xw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ffcc4da-8d39-48b8-b771-08d845387472 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:04.9106 (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: n/h7JLtHK+AKFiKmX68la/gXghj1zB8+U+4SJQNebbqYdzKluvLJqwjBw/Rxy7Ly+RPi+pMH04LSotDttAtjniVTuZb2SGZ/KgpdxyDk7Kk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:13 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, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" 1. BDRV_REQ_NO_SERIALISING doesn't exist already, don't mention it. 2. We are going to add one more user of BDRV_REQ_SERIALISING, so comment about backup becomes a bit confusing here. The use case in backup is documented in block/backup.c, so let's just drop duplication here. 3. The fact that BDRV_REQ_SERIALISING is only for write requests is omitted. Add a note. Signed-off-by: Vladimir Sementsov-Ogievskiy 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 Sat May 18 18:02:08 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=1597949112; cv=pass; d=zohomail.com; s=zohoarc; b=PO6xyttNNHhDq3aSdOZs3JM/rSM3Nd+WalI+rvAHS8xuzBE8ZjdZZCLaB32A8SVlQ2DtEriRJgalOjLYe+0lY/AA8cEm22gslHlE6UPeOnrHB6TMKUVNgbxRjRwetwzvTgdbHPuShFg2BkkpnEM/Tmg0vZ/nAmQM0PSQ3O5AWwA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949112; 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=El15tRu4jlc8MBqtG2epXA88wVGN2jq2JJUWUCjiMrbkc1r8Ded9xm15Zog5GFGgX+6uvX0aHKIrTsuZM7YoLPJC/jWrqAEH0DtyOMxCjsD0b33ingiAIhylOHeRQLLV/ycf5KxsOGMl/AZPPxAU9WPrK16QzPlYSdIh71d4SQM= 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 1597949112845757.1241223849379; Thu, 20 Aug 2020 11:45:12 -0700 (PDT) Received: from localhost ([::1]:38336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pYl-0007Nu-Dd for importer@patchew.org; Thu, 20 Aug 2020 14:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU5-0000gx-QY; Thu, 20 Aug 2020 14:40:21 -0400 Received: from mail-eopbgr00105.outbound.protection.outlook.com ([40.107.0.105]:40648 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU2-0003Bm-BK; Thu, 20 Aug 2020 14:40:21 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:05 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:05 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YGeHF3kvw+HTEehCTUCkPtJFhRSu4O/qsD+0UBSMWh1D6PnV72hxN7g3yEEcOGmwYI/oEcWyZwbnggWx7SbdNT8y7+Jk5xVyDDDC4tB/RPy4dg/x53EAgSzzbZKG3w9+9S5t94fbn1x8jJTzTygj/4Z0JI7gWHxULSStXWEIAe5VRAmQgH4glkUJtpx7qI1l7Y4CrhUezFEELlj3LEstH4X9EsYtH1zo8Xk+73VjcD6G0RcuJcS0SWU4U85XwYxOYc9a4CzG8WToqJppgu8NPFzD3cx1ddAMTYSHmJbNsVkfVeMf6qO7AHAIG5AInQkqJUY/iZ2G6O+NAn5dYBGsyA== 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=KErhmB8Wvh9zmzSn0Kh6lhjATEZPbl2kEDVnSQMp3o1ptrMmVqQy/nl4LeA1sZGe5UOOphuGUGTEKFvI8mnJxbWwSmBpwo8K2MW9IIoILpM1DDokHXG9zweD2jZm4mtr3J2oNjTqqvrcNuBdf/J2shV4q5vxA07aEy9i6ZGDQBublXJ8AslNVmLPgc5LK9cVWWrmdG9Jow52r/faEwQ7C6xu28wRSKJfciYVYjCMgRQR612u+ntwsbPI5+/1lH7y9hMQGjIEVTity9W/OHVCKtiHtxsczG24hwgMb2SdLQSLZh9gdx3NuplcyhjsvABaPMvGDwFVETZk+O1Fx+7xIw== 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=Tdi3S7hVyuXLkDaXsiCZbPGdgSjw39r2O8h5AEPcl8YRNtHeRZzopXIpxylTb5fOTpAbB4sS/Bv3vpTWbe1zGKzGJxqJMK9ahBnjXObeqniPsOyb/KgrPktIAlAVVy8/HbKZZDYOUR0KAAVNk6N6rEH1kjk12UPxh7boAfhhWjQ= 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 v4 02/10] block/io.c: drop assertion on double waiting for request serialisation Date: Thu, 20 Aug 2020 21:39:42 +0300 Message-Id: <20200820183950.13109-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 6e34673f-3f3c-425e-50a8-08d8453874f9 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: H22EwgTuQUNi7hdu14FGy9+7RD1CRKltrB8w7h3Wb+6JciMFIini2rXibTpjaG9JJ2bS952x2olvCYz6xRNcyJKQpaDBNVjOZ7ryqu9RTlyOlRIY7YVMvQCQiUhhSbudgblNDGlIRbcpsF6BYSUh0ir8RfELslhYJZn23/3mCtKGzDlzCjSPQG7bDp9QArEMbLsOILw2Z9tG25lnExXNbAYBxNdzAvRWyX42YDyWlX7Hu+d2J/GGdf40YXaD6ADalKsjwZGWZhbP5jPUikNhTQWCBCHzbJh3KAzHJfMya+mpM0untRIaKJDpmOcXZoObgEjOFWVfYp63o3RKWsfCPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: KSfhn5nAAh5+a7b1heexq1Y/jS1HH1BUg1DEZZDkSYKgfDeyvvFProl30RUoful3K/Ndd9jXqFJQQa/IARme8sS0TAm8udav/ggYfYECUGDKJcyBuu0OApmdTrgNaGS/jB3Wh/urZ6YjZv4iklqsnv2QS4dd5t39gCEQnxMJg3D7r0WZRlFRmuo35YnSZLZ+fxbc92X35vUkEqrX2Hh9M1xy5I1t1DJ4NX4vL2YdAerGLdbI/eCD0A+Dsl28ya1ZtpJ+crQCSPzTJqpoPY4kTYv+Oi4Licd7r9E4Mn2+pRccFA2/SXM4L7HFpjtLlHw+RzcsZ3eJFK/BCc+lAVMgbX8EfD6kEYNKmIrp9AH19YnCNGHg9L0FUwVwtFLiSP2GY3NZklPAs0QBqWhhT3O8r3nHdvHVhgtw41jshlWvvFnDOjpMLq4oUlu1RJ5MkJDt4hxGvwGkJTLz4LtM87r6tgP7E48UPsycV0tDcC2N5Fjacr/0nHisMTi1KzEqVZf50pJl9snONoiLvwUhPIIj8S1h38reiXEYGMf2SSjNob13kU1cNCIDayiRCfKYEPDwMzRdOQcagPAEXY5f1zO+cxDny3sr7bfUh16u+cmM/jKmVEowdS2oLS4k/JEWfRhxYdYZd0qx+aNBZN2Ml4Vb9g== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e34673f-3f3c-425e-50a8-08d8453874f9 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:05.8305 (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: 4k4PWSpm3qvHMds9GsEQTLyjEjwaUMzpZokZkfbfiaIfdQ8UUQBHpdqynd+qOy/hsvd+sAF6YdlC1qR2KM0DNlkhz75bH/BHfPgOY9iOfDQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.105; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:09 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@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 Sat May 18 18:02:08 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=1597948911; cv=pass; d=zohomail.com; s=zohoarc; b=iXFH+1k8vCUXdInsMiPOHu5eJ8DoQ0qHNPNoN4Xh6/aHMXOrl7LOuf+1F/PJYE5Opaa86nUtOHRbh8LMVyqplUICwgI01ISbcSHlrPQ2kEAieF2mgtB17sTzoc93zRTD/KoNsIQS0zEQDWxXcbroIskH4bbtBL3IieKolzDqiBE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597948911; 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=CG6oi+YPmJ4knS4MhuzjVajzdWo4xq5Nw8sDMxBpPrJX7QUmFLMVI96C1tBNhx5NNLGABgJah9FzguCpCoLBeAQUADSgfwIANF/y9IoskeXvRDJ64oWzzPql+hHRAChjTGq1WPN1F2f5S9DQ9EH8vh1A12dP0IbeqaxDMJVS0J4= 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 1597948910890345.63232374843983; Thu, 20 Aug 2020 11:41:50 -0700 (PDT) Received: from localhost ([::1]:54098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pVV-0002JU-4w for importer@patchew.org; Thu, 20 Aug 2020 14:41:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU7-0000jR-Ta; Thu, 20 Aug 2020 14:40:23 -0400 Received: from mail-eopbgr00104.outbound.protection.outlook.com ([40.107.0.104]:1630 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU5-0003CQ-Ky; Thu, 20 Aug 2020 14:40:23 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:06 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:06 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mXitKQyUrNjzWc16g+KLqwHNCCjTe+5M4loxsAQ+PdaIUWkmzpeljy6vXHP2+hb2uMyPiyScqjv8ido+WLc4xJycq6k8u0zP7Ndt/IWFvvFl2zurs/8jSY50AJKPbvwygB4wc4vx9oWm55jtZyNvw5kYWzgwFL/cM1wyJLGDHTnxE75Ecbi8VX3VWmCqOOvYhrqh/EOAnxsedrO+QMZjGNab5M1+6yRjnNkXgrllljA0T9XADJ0Q3kiKUltNFl2Xm1xiCPgyj8k/2sIdkou7+TWhKiq/Csrsy2OJDfXQTgCESxgcaSFWw+9NRlvJVFX0MxvxU3gKJRr5JwgJ7DiAOA== 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=SZRCYul1GOl3CqF3PaX7O4b3f6OT7HCTA0GwoueTZpJQ8SG5rI0kE9AJn4he1SHBv27k00iIzMyWAmwTei9NFS7XROrjXS4vFShi9wqH/8K/tIkI5yIa3J5O6BxRErTVTOKLIrPFXNcWM9vQGExP/a6Dy3kTCiZPjXYE/3DWk9g82mqwK46e16T8PLlBfxtf9hiq6t4AkuX3zpYHS9ju6W7mshd2twU8Wy8XWEIkAKdVwVvIIvDy8pWOHQL0G+bnR8GKP8gBPYnW77owP9fY0o/uKWm9feU4AF3Yk84WpUDVm0QpaROZibEj78W3GENg6RAcyuejsADrQ3zefWmj6w== 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=q3vBSUMLITrEB5DROT1JvYF+ejRBdeEpJZ9yDbeYVN5aKoeiL0cBXUg9wma9wGoOTBKuurqNU5Kkjs+fFDtPnk4BZHNZCVuF5gdjAaCaSSG8WwunVcbMXpN3oknwf1LNvOCAAhGBCriFC7Hre/A//4dVoZxlYV1aXyyHLktCxMc= 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 v4 03/10] block/io: split out bdrv_find_conflicting_request Date: Thu, 20 Aug 2020 21:39:43 +0300 Message-Id: <20200820183950.13109-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 89201796-fd8c-4480-ea49-08d84538758b X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: JVZryucyoszKam8UxEEkJ8xJbCz/sge75jK03F1uo2UwD/iT8PSFSGwepDM2+MKaCkllgmaegPLKeWCuIjA4P7NGz6V0nbccx8YZ7Ln/YqYU5jDbGPhyxlYKLfF4CtXw7zkvV7hwZC3ntpSCiA2VPtNquADWvJhhk9vftZSkMbfiyN0uulOEeuuIu983r3H03WqnoU9CZuPg7bh7LcaXWNSiJ9BRKTUpHBkxD0wSGLhQ1DZUvl9UHx9yBtDs9JfobG3isudjYGX2QuhTnCN/RVgpYbZtZJsJXr7wBHaonDD2nfdq3Of96ZeObOK261+N0mS3fZ9f86yiEjStwCx7Yw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 0fv7/ZirdL7KMbrpreZ7TNfGZ1zehwXZCh0ZWLTxudC2ffm+APts0JnL5RQqyd5Nj4MV3zyDrpCO2MFsNZA+4lvDERb3LPvgy7gQgh+WY+6mpR3+XL6ZJNtG95RdZjRP2Fp57T9HYMqNdBj1p3nDMArgnJ4qUvz1+wDz58lk7HhK2PV1pajmXNMtyHoYA9JHPfAvBV4zwKSw6lyLckTzGV6fA2MZ3eaJQPDRhp69PF+52acS0p1tvNp617FYkZ6HNs6peCt5g4eLCYGDY4JRx9pwFEQrCL/SRbylvLnoYCGrdKlWOMgYK1usLyrB6/ej+P2naewok6dcCkxA1E090mihsORAR3wOBHEcGaLR2XC/s5fUtcskJlfufpQ8FORFn6uT6HYyAfKkbqoxEqgag+9kDIw9wZGxIvFGA3KT+rtl0dzFZZ3ye/pXGS/1lE4cWKyv3r6rPsd5x5RXKtyqf4A66SN+SDQR8M2DGfcmciqqBZ1C1ykXvEremZHh829phzPci0tI7pFehvXreOmr4aR0LsPxcuCpfc5UGkcd/UOQGubXlbQCuI0g+vKuUk0HM2xXH1Mfn9RKHrHYq+AImW5HjUXN3tVhqqz+p4P5sUyKqbjXBeGw2tbNiSdaQKMkPfjk9N++msx7AYH/oepH0A== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89201796-fd8c-4480-ea49-08d84538758b X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:06.6848 (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: 7phw0/8TgYffKO+7jIBz+6AIghEYu2oWzbd5i6xLlUCFoAZ0CcgGhULcMRnFZIBicpM7jaFEcYCPtnIbOfWP1+CmWH1AXEuyVajAe8j2cuE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:13 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, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" To be reused in separate. Signed-off-by: Vladimir Sementsov-Ogievskiy 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 Sat May 18 18:02:08 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=1597948939; cv=pass; d=zohomail.com; s=zohoarc; b=QTKcxoKHBWgmBep5/CU5S+F45wvN/W+vJSkLN+DSolJZvPGX4EEYxdI4PnZkwODlC7ucmTwEm3dYpAtY5FlHAShmzlI/mtc+hGEegBBItAh/TWqxC5Q0rMIyUtw3WBZdM/tqsTPXc+1I16bdttiaD4jl6XratSAVLFP/DmIBmHQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597948939; 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=RGoLgSFd9aaWt09cN6v9nG4940okWRw6HNZKQumUUuvOFvEwfFms9Vlih9wTIVG4tWb4by8inK+PSX/RD8XG/rHphSiuI7zBXQxN2I1PTd3eXN5o4T7TUyPEzNUt3FJm3EM1ixD1k4IXZ8qjo4a+wjFrs8yvkn4X3OM1u/it2e0= 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 1597948939262841.6804740149923; Thu, 20 Aug 2020 11:42:19 -0700 (PDT) Received: from localhost ([::1]:55284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pVx-0002mU-Jn for importer@patchew.org; Thu, 20 Aug 2020 14:42:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUA-0000op-1P; Thu, 20 Aug 2020 14:40:26 -0400 Received: from mail-eopbgr00105.outbound.protection.outlook.com ([40.107.0.105]:40648 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU8-0003Bm-0u; Thu, 20 Aug 2020 14:40:25 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:07 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:07 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVYpUwiO4DA583L9PmA/Eo8ncPvVFgIHCBqpUqp1vmmOuZhjM/Ii08Fa5m/39VJnapjMfkrWBSVIstH21/vLPgy4emMAJ+z8KrGDtx5zSua0kHifYZtLs9UfNuVCBMoNL6JeqvVrUh2ZQ/97EL5cIyiKch01SJm5vJDTHPJmprO5Cw5fGZouYQYgZ45h0praIiVeIplbXp5HG0aeMBLflTEf7K/g9C7M8qUhsTUEwoKX8NzEvgQMS7TVRgjUKgdujcJkE/kZYwPxix+S/uJwcL7MjQF3AoEGLvnK/DmuUDU3oBQ0bpKvgq24aJGymYP+AIWoS2fihxybzvg4ghOSfA== 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=OLD0D06RFGhPg+U/fcVdxWFPyPcTeyS2QE6q42kaFf3DsGnUaTl4Lo+ovCQs5qvC+W7waeLnJ7z/3t/sHAqnBm0fmUQJ5Yk3Mdj0Ka5TnBVhu2A/cTYHbSPptLlpbJtCaCZA+dJ8QynXo/ZawEFWsd+nP+53BA+Aeqf+skPoK20mBIYMCXtLd+jiU9NRS7ctbqQ1Loc1U0C2fnyLt+F2mHmWmxBZGHh3uLKxlTX6ohPJn7Fz2+ldNq25+Fx1c59Cxza/NaO4NzqivW/9JcltG06hofFHan2cwSphiNra7iUeMdKNjhEkHbyCtum4twZTMxhtP1mboiY/pCl9PvW5EA== 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=DhLAfoi0Z7qjnctn8/IItUlYDHCIxIa/74inBDwcOHGmXr5zyjcR0keKvm0cVsVQH96TWN+dPFKmZ8QIRbM49m5q6KCo4Kasnq6v4NK5rNpJktVhLCfXCRiWN7YVefvJQ9D0hUvt75fUVNX/iZH6zzy4KwTrTe87NA1b/30t33M= 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 v4 04/10] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg Date: Thu, 20 Aug 2020 21:39:44 +0300 Message-Id: <20200820183950.13109-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 2fcfb961-347a-4640-14f2-08d845387604 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: Dq028sUGLYcNA5uz++1aPD0Z8c9gNq5TNI6Yt9ukKEjDlVg9WR9hvPuA+tMPcHHA38U4btxgEqq12pPg+ykWWEB9MKfTY6fObBd73AlUub99Q0mfUnMQzcATS9oCAOpU3aUbaCM/in49ipDTOEd7rO1IQElqAic0NRcTSEtrIsZFiGIZo9KmTnaD/XtTnwRPNtOkG5cU+K0yTBPoanVAl1mejGD+0a1hOF/qajmopdGLm+dE+HAktsv3UYIeyu9+97n6FSGwBjxcvuFS8umjIIE7Np/icd3WIKIrlq7d5gw1N0nbMehbBc48uBT4F5jsuPJC1W4YwM4TQi7FYGgfgA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(45080400002)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: liQJjP2aEQkprfQ3F1FymhHwOs5tsa0/8WRxVtbXAzM+vCgEwHy6wjeEDColdCLE1ryc6F84sEjz0Nq2LeoFyuMuzaKm8GgRrNvpuYOXdjQGF7oxNHITWpR3Jn78wJGj4ioHKlehUKY3+94vFbBZ42iYsWngBa32otH4paK+UYeL11+nR7HbqER+UNvxoSS+Dq2Oo6yNOYJqlMqsYOiPz0kpLmZkguozzkSK4CoCahRwkq3hzkbKabzxUH5AgtIi5gYE6O4qghuQrQQKgh7oJsr5LCuqr7i7+Qlc8fXg7K0eKLRNT3tcK6I8o6+NjH5n/xP/RifeNgyhVoH/ikMq0HHW/BNz3Gk+YDrdokOoxqynQ5kNEIGRlCYMp6oZajGAIoTZ86vnhoajqaCHbr+Hbf3kFvWxnEtkrXwSXyrPn2AJBRJUYwpdDidCJlQDg9n6pKebfYXLzW0MUwI7/qJxsx8CoJ99eOqoFeiCrFmssykmmVx/iU9ML/L7eflgzT7mOTlLs2MNkGd+e2a1rxaZTrE+V/Hg4gpboXAYemLZveQYc0hOnl04GP0BqbIv5vGRKxtSE75iNN4dwUjtZ+3a0kJQ7ljZXSwqoLaLCTUuUm0zfUcPq1reoygV/64wM8fW49oPe7/Q8CUk/o16zm1n1A== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fcfb961-347a-4640-14f2-08d845387604 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:07.4603 (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: +l0d1DrWXyBhLUFaZmqjXQK32GVTyf9T8vR/RwpNTzpD/ONhcLOjIbfJIhivb7BQHS6CohuBguY+46HpeUHOe5q3dG5QcrXuImVEjpbKPZo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.105; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:09 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" bs is linked in req, so no needs to pass it separately. Most of tracked-requests API doesn't have bs argument. Actually, after this patch only tracked_request_begin has it, but it's for purpose. While being here, also add a comment about what "_locked" is. Signed-off-by: Vladimir Sementsov-Ogievskiy 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 Sat May 18 18:02:08 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=1597949029; cv=pass; d=zohomail.com; s=zohoarc; b=mz/TJrgZFBNgHxL+tkb4vM/KhAVFWvhr072S83DdQ4oHlgHZiMsCrYvhKOsHNlFsrE62yUmbXR/H6KQl1AR+svc6eSjCz76z2YgPZQ2L+yKUd5JTeiZYbOBTSX1hKAxq78QHz3rnDvsoEpC/s7jmyKLYx7nX9tpIgb+KlCJnsvk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949029; 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=dj+RH8lTxUw0E2H+bPuEDTJXHPl71LIRoE3AsNWD2m4uSdk+uRfZEjBjhd3OUCnhZIAGRuNEP0cLKa2jOwN+Rn3fRCUokdEgkORXcEXl/bO+I5tmJ7cMn/DnAI/Fu+/mNJoMSLpbeqOXFVJLfik5Kz+qWX/sDZ/LjPVYBhUTslw= 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 1597949029826229.5639275808736; Thu, 20 Aug 2020 11:43:49 -0700 (PDT) Received: from localhost ([::1]:33452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pXQ-0005OM-En for importer@patchew.org; Thu, 20 Aug 2020 14:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUB-0000ra-3W; Thu, 20 Aug 2020 14:40:27 -0400 Received: from mail-eopbgr00104.outbound.protection.outlook.com ([40.107.0.104]:1630 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pU8-0003CQ-KH; Thu, 20 Aug 2020 14:40:26 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:08 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:08 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QK9KDe5yMHn1JWrIDBNa+CmvNH4jj+poZnnuv8+q9q01hNz/OkefxP4MtZfa43vR1YzZE81tZXecKno7gLAHt+ZuDWdO9bmnWX6+nsHHU6N3hlLXTqXNIP2rcMSdkGfOoZwZSd0C/X1oqVjxCOSai8PkrHpEECgqyIWCZRjm7tdR3mVlxcxjjkibEuSRBaZHpccvO/D2TfqHpj0geCJ4IkaTG/5IzCO5wxHo2lGwbZpdpnqeCf1ZDHZ6QcKa84qpenqXBueEO+cdodlMbsUvAdq4Dzq80QGiRNWgKWoclJKkliuV3o8txWv4K7SBAuX0LXje4gooKE5EOIf3zu/Tow== 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=Z5pK6Zi6k2+oraql1AdyO0UY2KnXbeVsYFqYs4sLBc6GC/jZDIOPIowfE4majYoLKIRMkGfzUrSLaOHB3oOH7rDGf/MEteS6VJ4f8fckHBOAc9cAIoeSFzXP0xsYil5W+LTvTtswAdeoSL5/Sw3YPuxu7ZxGN7zDcTK7xAIdIssH7QjmzkBaXdlaAGARK6ahaB01RU39eyg3ay/m9b/KqNp6g3fq6oZDolcSEstZj1dptD6SbanVvjldIaV0ynuG6mPHOumqmgMYC53bAxIn8uE9WtrSayqxqrpMxjEyXUCiIq6rVeNMcQWlAoUIWNJbryXXSvQ+FFkqPm1C6fiEMQ== 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=qkntXS+QubRpouBsfL3BkwoLnRjispAX8j3SdQkRXJFjXwjYBBSJijxG/LzddyeIH8pE/Jnj+R0ApByEjJFHK6BCJFhZbWt68uUH2mZ6bWMJtXBr+/7SnQNzAqttQc/wgMjesAVx6LRW7PDuObKz3s6NsrDddMGomwjAMOBslO4= 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 v4 05/10] block: bdrv_mark_request_serialising: split non-waiting function Date: Thu, 20 Aug 2020 21:39:45 +0300 Message-Id: <20200820183950.13109-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 0fb10343-28bd-4238-3c23-08d845387677 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: CFFO60mafzM6DBFrOutv1csLUlS/JP8rtyyO8cc6aHda023vImH/vqcM3b/uvRbNgHwA1U8fWvfIXzien676C7pTbTfzaR0VzYj55k+ExQ6aRWAtJjmRBn06pTLBOV2FBb661GdVr67N8oyB8LamXvOac/FjqpgBfjGO0DbSmXRXdhmsAH0brHmZXxXS89sruR2JvWGTklBquSJgkC5TyrzOKZ0EV/Rnpo5+K+N1NShyqRWsTmBGqBDeYandD533LZsMIBnYRT37zsOngt1iJW0z2c4mS4ZtkB6yAUkHxySqG7EXT3892BwzqsvCdxzcsezHwIYMkkx3mS7e+GjuTA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: VCENNTdPJ/OSEMFwfRgn/4CjNZKhY+b3VYq4hyBewIcBLlzIeuyWhf0I5K7eGgDlD/HVP0BxcPUyJ+gMs0wIBNIRZzN5OrOkflXkLZybKLoDS0NY4g5SxQLtJO6hxSRWQgAQ46pN4HVATcaPW07aXNo2XlJTzB/hzlVg74hzgfy/Cuog/Sdv57i6H2RKhrS826HtbW1x8bu91hqhAyALBcn+BF3uJprtvkPGY/UnLfDaIelFoH6DuGMfRA4jsBgnaVFYpkYlnaGTM4gkVPlaxDYXzCXC5lK0tZyrUlIbCf/ut0c9bJesWyCoDzdRt2r26VK6HmQrjvijB7hJrZtf1qYtKY7Tw4gvi3Usg3uO13Z+65YUB1K3t7ATFIjH+VaOHliuFFkXoCNeqpbHvs8O0NlmM4MqinFH1qp2Z7hHiB56b+xfyy/6IWqrZYSmqdvQU8XrO6dBALGdOwawwoHxoEjwU3Cq+YBYg8CG36OohLw1YXF7kBaoOOqDTBWpP55Zn8cXfTTzICSGYidFRjqiEN9060pM0kBvZtpZcBW0usDKZ8JtIKPKzX74qfHcPSn6b3EY6Qv2uah1M8mSgM8ABOW+x1CgM7vDxc1EXCCY0+VooqalrtQfkJK4SGVFkeABkIC/vbk3uyxFGwvcF03TGw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fb10343-28bd-4238-3c23-08d845387677 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:08.3215 (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: md5tfCqlmVU4i99HxRaWLtpVWoK8yKM8I0BIwY1nCqTnKcGRMveSGxbW8c2YF6RM+6+U97ZsnrsDP2xnlE6ZmY3yDG9uEURIS5D5lgIcL+M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:13 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, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" We'll need a separate function, which will only "mark" request serialising with specified align but not wait for conflicting requests. So, it will be like old bdrv_mark_request_serialising(), before merging bdrv_wait_serialising_requests_locked() into it. To reduce the possible mess, let's do the following: Public function that does both marking and waiting will be called bdrv_make_request_serialising, and private function which will only "mark" will be called tracked_request_set_serialising(). Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 3 ++- block/file-posix.c | 2 +- block/io.c | 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 Sat May 18 18:02:08 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=1597949263; cv=pass; d=zohomail.com; s=zohoarc; b=PvTuxRcMbdNXia+Jehz7WNDq4R3ov+VseMpDzzEOoOKohuENbvBqL4h14W+NBY1+xle4O8yIzBfHAckioXFvrjT86f73a3wusphNbVYH2jt7H6wBj1M4mV2N6TOhpKUCgJWmO4gQ/bE+McV3Ml9tn+jKqoX3Gf0LAu2CEdoMAHo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949263; 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=daE7ogn5KY9qp792iR4b/hx/7nN5VYXEN7MvCX2oEyVU96W0N85y4trdd0VSdbi8feFpoNo7yCmXa6GdnaG7xP/6yrzVw9gybE/l+qCF9OzU0/E1u5qZ2NNuKPZVVY+0oMJpnuBI20Gtyf/gzCPf5asuaxx8VsK9HigFU3Lb+iQ= 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 1597949263449704.2659208527385; Thu, 20 Aug 2020 11:47:43 -0700 (PDT) Received: from localhost ([::1]:45820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pbB-00028m-KE for importer@patchew.org; Thu, 20 Aug 2020 14:47:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUC-0000vY-KC; Thu, 20 Aug 2020 14:40:28 -0400 Received: from mail-eopbgr00105.outbound.protection.outlook.com ([40.107.0.105]:40648 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUA-0003Bm-JK; Thu, 20 Aug 2020 14:40:28 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:09 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:09 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fupogDV7MP1uXD+0/Fb0byuUUFg/LxvfTHDKRZ9Jk2o7YaUSIkvxvC0kC9n/rtugn5QZcUmswCNB1fvJaX2AJA0XMU2otaZDiHA59+30ru2tbM5zWWOomjJF5Dp5o71JWXkSHmg5gg72gyocGfbLxHUY96icAnzpH0xuxJkGUZnOHsSoxr99/SvpDP/dpvR9ygvy7MS6WGFTJNZdvDFDEda49a1cpubVQijOwj8sdkrc0WWwN2or6vOJ9BYWWz0uB2eo7hfcgsk7HkFQM6pzvP32rAlGBXCrExtUkBOyAB0Jn1qMUznvJ6HETJA/Qcp4e65z2cyii0fC5oGEiEyVIg== 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=gB84tIwsBsKAEdf8LiV/ii2z/taR2j9JdYN09ar16z+qrONAQvZA0xdPl/YZwmgHogPlCjHSYTkzAq/DGbfZg0Ht4f+yKQS8vGGmAqJdOKrgJ12UqXhxVGWH/nfjHvwvXxVZBnZyvN/CzTz/BCuZ0veeUGXUSiZiNXKUgpYGhs8M4DgwW8wfGjkicyqzbfpLUrOXYqXEgEWMGQH+U74Ar4zlBxknc1V/O1hjUFqsgAtVWybJZb4KUjncT/soXeN5m9unouYTNqqPEZlxqKmD4OrkF0cwH4eAf6M6LMsVc1qV6B1PKcCBHwUb4Ha15FgAei/F79EY46kJYuK6e2D7ew== 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=GC5l5XeffbNBI+G4rKtHMuVT3JiqTc7Z9k7OXG8cRGo4wET+2qPegUF0dAe0DWt1nHoe1wQwOcvUyQE5IIzbhl7JTbHMKe6O4zDomFlJvSHguCGuo9QBCYrR2NTkXRzYim7kZbgR17pXkO1z69zOpW0k3/RHNjs5pdWtTB95bZA= 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 v4 06/10] block: introduce BDRV_REQ_NO_WAIT flag Date: Thu, 20 Aug 2020 21:39:46 +0300 Message-Id: <20200820183950.13109-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: b646398b-683e-4b53-1fe0-08d8453876f9 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: 4gZcb+IXsCPNc83V44TYWX//rVSgJWT5v5OZWOnEFYhfIV8ugRWDxk6iFT02VczWL2FdwHXIYd/yfkapbrgctUH0gjRaj5zL8Ix6eVqg+BXXk9eJobu2LIArUEQbwvtuJJ+5uQNAS7Tfqs+YsDJoeSymNONjIGT4jaXVfYAFXYNZgUUbPzqoTHrWfFYJpqJpQj1bteR/RpWT7w0j/DTAmWRIoS920gAU1HFXhttQQJm9iMEFHJE5NgiWydAAk2i7mVp+q5ggBCQbAHepUG13kEsOf7NF2Sjbn16L67GfadpEffc3kkEi8aCRCQ/0Jm4Ap9vHaXy4axU0NXVKbv4pDw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: M/+vXkrmECJWKwrHqe+D0vGbhBdIMLEf62oyugK5aVBJzmVD/4vGdSI70qUtPfzD4UCIvoFsJpvxc7ghhamOUAPDHXSk+eWuAGoBLu5hTgMrvjbHXXYj4PfXEIs7nLCWTkxgKJodynDay86DhwfKroGHmC3B6df0rpCMKfPwI4OcQb4NdgpGUm8Ty7Q+VT0lK9XcvQY79fDbseBVkJiQeRoBkq0+HP9gYm2nNc6dd9KmXcZcLh8HQZbIvz7nBZF9nE6WF8KMOBIe9hC/4QoIi927DJoMqcA6Ntf12qwABHBoNC+myuIIm32MXhQt08XAOU22qFMIQ+pThuqQbfcoV9Oi5kTzXpJEI9YdBCEMAQI0ngeoGmcsNMGpqkfpP2fmEXQGPWn2sUFgGUnm3VTytnaYJYgFXtJbB2+S4gUC0yBjIRY29khzYlcn+M6+V9lPULVIEEHEU1fjhMYxxgipxBoEdIuPloG8WjpzdNKR95ShdUbNhNxvv0iqZQifLoR8km0bSBUZQhRLhEIexf+24/83kh+VfO+8dX5To0Njg94+g1L67aMagGi0/kO/simV8ohwUodXA7LwN7syoYctNgk5Zxxr7GMmVswfjz3u41mG5aeJ3/YeFQQA4fjr4DmLL7M+VL+3GSoGuSPlJ6Z5kA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b646398b-683e-4b53-1fe0-08d8453876f9 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:09.1618 (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: qxHVP0gmOEi5xgD/S6QxIopfbxOzpjFGEYdwwoiofZXWRyVwgf9V2ljlAfUsgsdrehtS7kw8w6Yd/NDxijNj80F3g8wMR67B9a+hfPdeVYA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.105; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:09 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Add flag to make serialising request no wait: if there are conflicting requests, just return error immediately. It's will be used in upcoming preallocate filter. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 9 ++++++++- block/io.c | 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 Sat May 18 18:02:08 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=1597949353; cv=pass; d=zohomail.com; s=zohoarc; b=hKHvXr5jlogtL9EWnMMRPAGkAVlrMRyNoNFM3a9uZfN1pZNNGy2/r777/lAhM3Ur9tHFb1QhDZIZp/REZT8O5R0SEV7xf4BCDI0nDynwePhHVdWPLCIJMYomcdjLF9IvvYSXykZKYsEjmHZh0QInQ2UMRkrwMLpulDwnLPIBmmg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949353; 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=TWFjHiaNjaB9fFs8lViJAyiO1YNArUDkiB+mFEMyoxz1Vm19d2HKHLoil7HbQg0hTu6Dp6gMJHXSvvn7Ci9FCBlYTPOEAmLfW1UTRKwhU2gFAr290GTmdLePFspDcIZHlTRFscOHjTGqbratzEDHKAZKO94RbiXFwGUcNRlCNX8= 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 1597949353600862.1156333141018; Thu, 20 Aug 2020 11:49:13 -0700 (PDT) Received: from localhost ([::1]:51700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pce-0004YD-Aw for importer@patchew.org; Thu, 20 Aug 2020 14:49:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUH-0000y9-Ah; Thu, 20 Aug 2020 14:40:33 -0400 Received: from mail-eopbgr00104.outbound.protection.outlook.com ([40.107.0.104]:1630 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUB-0003CQ-P4; Thu, 20 Aug 2020 14:40:33 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:10 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:10 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OSs4LfNixodFfukYw0w79TsUxAJf9GuJH/xr5rz79Ahrb4aYTZ9am2E+wDog/S1QPVEpfZAXGzcS9Y9TbsCepuYTnxFhDvoCw2HMnTlsBFs0C24NIv7dntIk1k8xEhiOaHhTSKBJHzWYnU5qW+amHaKSbc8+cpYh0RB8o2bDKh+iYTMYicCt8/48hiLvxtSUqKJ1GR662ZDggM1xozhVdc2E/BiA5qaFgwugirxW24G6QBD8omcM60TCsJretrIe6jSJNMWJ8gdQ329Aj422jh37ujMhgfnuoXvT2uUTxu4kOlpYUgAoxDRM42/h+ZU4Tx9pTwa0evXtEzD2Emr1og== 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=minwwzmCJUNY7j3bnviy78AOj8S+K9lZ82xaoiQUKdICjn5d6aNmMvP0PzFZRgIH/rQpxBZ5QUgdMpuJK8TKZqxO0pWFYKyrmAwzS3vbN0fZlY7DfLgp1/zIN08GoOrBdPYcK24eZx0ff0EeU0P+8dyi3lr3bJA7EqmD/F0EZgC5gD3eLVuGg3i5GTxNB6v8161O2mIkpjqFNQtPjfgby1qWcmIAqZfMuBH9d+ZdCDlfne5/7kAk0lNs2MpU9upN1z0SBSuvRATlv5hkU6RT6tj/sxssBWBu6jp6c9IpTho8s9/qDeK/U35zJdgXLEUYEXRjh9y/jBUkobMtVhS2ow== 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=bkglD47aJkZJpMXrl15xo4V8BKv1zLBm+e40SaDoQ14IolD/et4k0au7cqTQJRep9RBXZ9CrkvzV7VLtvaKDTn263Ohs0gRTMg0SYF1BJa/t6QcL2fcme32xqKMnwIaZrqjfKlv9xqTgycMTywxaRQlifmUK2IcU760VV4ynoj4= 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 v4 07/10] block: introduce preallocate filter Date: Thu, 20 Aug 2020 21:39:47 +0300 Message-Id: <20200820183950.13109-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 3f08633a-fd22-4512-a088-08d8453877ab X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: wI/hrzN0n32ZjX4rKvpUB/+vMCeMPzWuAtk3BnRAqwKLVTQAAb8dJ+4Vdr3oC9GobKF+mAXXwEPZsTGnGDNdDnz5zS2HEQ+R48Y9O5yOLTb2gLsLVr5PUFJOv1JM+KAyZ35rxFodINHkPKJejhlXPfNZz3IEoEPPQPZx2R3FFkCaCd5wl/nEwao7XS55hzN4LhbAL36kPVJCk4CQB7UNuf3dBxE2ja87dDAfATbZ4JL7d76S+tXl4ABn0W/jWJRcKssQs7SpVPQ4XhnnHQkEVGDmUZqqc3L1bazq3sjBPOGYKLsDnnVkUYCTnz4UNMpJsw0c/RQXP4KtHPdDdxbu0uTzzT4pXwBdp3k9J1FMoj+w+Rsz66V2QZVymOuzrSvLJEXjje5ViZCaDyL6ySiLM/gH9xNnbHigIof4/3EYFtsZxISj40qsXE6Shv0e/7n0lamtDUHKwa8b6OyObnsL4w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(30864003)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: qFfTqbMBaj0wDPHmq1TYUFDUkXUeeWKs1HeUF7du9Pf/NT4svlBAyBxGiQEIqrXGe0LJhOqeyoGSh3FzjyD2Sw/jJGinMFPwPdoqNR5JF53MxFc2kIeuKwe6VnjoUsFR2P+TYXCV1w5ah3LygqAZ3SS2cdf3aMAibBF9zZHpRx4J4rl3pNySloMmcaTLOlx3x1ovnwkuEUwLeQ8J2GdCxIjQDsEqYpnlv0p6MOwWgMvduPIjarpr50qsgsQ1fHq5dp3+/Fj44YzFkv7L6/5QgB4Q2yrMKnyfiE9YeXnuGzG8P/FOvRIFS7e2F5ZIYa2FpifSlqyEFLc/eQ/TCk1mnZ0MKACc7dtWWwAUpuvtW4N/Yk8uaokYyajiXmFPNcmpCJupfoNwutgfcwqLy2+u1mRdyAZkhYZThWBuyauxHGmpErLz6aVUif9QEFBfgi8daMTqhgBcdbAUYP+WRPeASjzpAT3N4GtQwmHEpJXcUpXjzxhd0fLaIPijoBdQ16SiZRSFg98wo4MR6HwueXMN703SCN6vpDFpzjUBjhaZfN+fL8S9udzptBMiePTC8XdmcLSRhxNkAcr4OOC9VUid9jBKouw8ySQ/nOcl4gb8BovQawXlK31zHPgNdHUgpkIzm2IEqL/qAoXooPLSqWiDFw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f08633a-fd22-4512-a088-08d8453877ab X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:10.3177 (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: S4r2nait6YFAiVvK72OPMSOJFtsdktvUW6XBDP9oFIV/SLMUA5C9WLJBXD10yeepvTAGT6Rs4WQ+KapEOL3qt0bPcLVPlpyGdV8wMWEic3Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:13 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, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" It's intended to be inserted between format and protocol nodes to preallocate additional space (expanding protocol file) on writes crossing EOF. It improves performance for file-systems with slow allocation. Signed-off-by: Vladimir Sementsov-Ogievskiy --- docs/system/qemu-block-drivers.rst.inc | 26 +++ qapi/block-core.json | 20 +- block/preallocate.c | 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 Sat May 18 18:02:08 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=1597949411; cv=pass; d=zohomail.com; s=zohoarc; b=dBYm6QZLIDLe5/MThRnrOJGkYCEZznvYuIrYLq2zeK7N9Nbf3tPwXfx/Ur0qkS/mtMj3223UjByPCkGAyYbexYbdrxAm97aoB4Ji96+BHaMKTTET/yrt1Xxl9JjBB7mmTVlljDBgXZtnz+2JWzC+sUQEGyJQR0SndKp3UsJ8JL0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949411; 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=f0KimpCIv/9rLHs7Qo/Hz8Izh/rstRbY80vnHIXsYa0=; b=BEeCtXAYF6Wju9dY0Tda0Xviu7vdr/1BlQ6aqpuhufySHaSTMtpiaQCscF31X180lK6zldxnSdyVLXWnrILerprkllFVkp0ziMcEjdhuW9+tD97j+7FNqumj6BsuZGlzKssykToy2jpU6ax3JfcnShnRf2fbNywXiWxfwrTceFQ= 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 1597949411676426.83379348251447; Thu, 20 Aug 2020 11:50:11 -0700 (PDT) Received: from localhost ([::1]:54026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pda-0005XH-Cz for importer@patchew.org; Thu, 20 Aug 2020 14:50:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUH-0000zo-Uk; Thu, 20 Aug 2020 14:40:33 -0400 Received: from mail-eopbgr00105.outbound.protection.outlook.com ([40.107.0.105]:40648 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUD-0003Bm-67; Thu, 20 Aug 2020 14:40:33 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:11 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:11 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CDVldhG9a/wR85WfIRf8IYRn8aUaJwHFLahtCSFPfhpvHbgGquJ+yftNGlAw5OHiDZNSwPDSaZH2sHe1F+30uSo6sRTYfnCBBBBf6OrDQcLNSKRLXUqtcTrRUvAN/XbmIbm6TnXNK/OUee3q23JPe2ADrvUzSTA+4ZUM4enBOmP2dj0VFLz2cXio5nTNA8wQAT7bqRIlxQlVZqi2InqhtpEjqHygl/VakG/Q57t9Ctpi/z96iC9aNjivok/41J61gSFK7wkuPNi8cbODBnRGK3wzU0HaLnGKpUM5NCWkB0Gk6WEPXvYnbOkOkVEHMNEtoyViukpyuAbWgbgm6wd1Cg== 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=f0KimpCIv/9rLHs7Qo/Hz8Izh/rstRbY80vnHIXsYa0=; b=gVDpIVuSX/SBeephs3S019UduVrp8I5wPI11oPGy3fUUhx9GLSNMcF6LYxosJ7AubqwykE7aVWDtAMUG1TnQ1sfmZqi/lPUBF6b9kyMsCqhEKPSWj7fRktn5bPYK2prnyJmjY4/NKD7TO7EOLSjsXcNBUbv5Ri1S28B0Lze3gqTGODQwYm6fT3HDBTtdYm7g3rI0BfjVgbgTTooMGCLFJKZqO4r4ifA3jsaqYHuQ4diBkXrb8txzqwKiyq2zxj6819igQOXLbU2hmjr5q3ekrJE3WHPOYxfJn+BX/9t1IBALaVM33Lb1ynOD/R3NVnrnF5NqZiP+2/auInoK7vuTGg== 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=f0KimpCIv/9rLHs7Qo/Hz8Izh/rstRbY80vnHIXsYa0=; b=SaFEz5xnLApJdJczqWd+k1HCJZu7DcYy76G4ep+LWfaCV3FHoT58WkYk+DaUGURw71sZTucpmDuDnvFYlS8XaOkEbwPEdTRCtN0sHLgV6d4dZqPfPALlwnF46dKzpQB79cz3JfpLD0WxgZDJg/YOnoFGNn65wRXYE978E41r0MI= 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 v4 08/10] iotests.py: add verify_o_direct helper Date: Thu, 20 Aug 2020 21:39:48 +0300 Message-Id: <20200820183950.13109-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: 90df6ed8-59b8-4644-1c58-08d845387829 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:510; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: awraZRy1c67R5BxkaMQ1IMCfcrb2qeYsuhDTljwm63Q+SnYpEffjY4XrjVgn6DNF/ghHxPAGW1F40XDLz5wLVb8YgQeCPK6MuYUEHVStUxGJ9fzTfSg++LcNxNlp1Cqk8fpBEe9rZ/K5zKt5o3u9it9WihMsgRLIcykDiN5Dem88Eyecvfy9zFwrQhEdEB7yZIpJtDkV+60IPJQVesl4H7tYJwxzuTXD9Vj0ZUSQoAvRFWq6hTlAWl0HxM/Dh6BWOuxeFcPvl3LBt6lUQLSA8BQLCncQcn5QDjXqTEPMn9Z0Khi5JmQd3QJTR+MFUA222IQuGMVEc/ucppQdL3vCHA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(15650500001)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: DbC/IL9zJB2MPQ30KUB/KXOIzaftTP9eair5tdLHudmdDpwr/rt8pJeEGYE8VGxFVsRhzO1vsKiEcE7NIq0Gjvtv+isf5mcAvSjdMw9S/a1lcbN881ybl/oJTj0t2JYQqv2aJIqDzpT09GK+PYg74FrD+ZyQ7hZeZCjRlnqK4aKOQGpYrBm5M5zoEx2SbhdQAgzz3lp1meXBVuQq4pp6re8tWR3tvJeQTUYc9DyrIFKKaNKPyHC4l9N5RB+ITvf8R01N9fiI1JfPhPToE4HgA4C22hsBOLk+XcJy3gSPJP0Ma3KSuUj3rcUtSBP9iyzOjJ8zCkpgLABpOYHj9F6l4ZmF1+VlWW7il09XXhzyhrVTMnsOLxPSAJCGaU7+Fhfm1rLWoqVP4phx1Yi0++HWFeXTGUoabgPbMxdmNXVwhrf5lf0Ly2m1ctewd74k4D4xFK+8M4sTM8znemxBajRrjoT0CPKKAtg2T7X+0Lx9UM+WeqxWSz57E3UMOH6PgZwd2VRMS1HKCZQdxBMSzHBBNLxi4QoHBPqQu75jT3MfTiifLb5hzVaENVCbRUo+XQPG9aH4lTIz/PUMoGeWh4q5vDlXV63Wdm+gzkfjZjhk6z8TyHWzv72OC8KhpS/pmPHaAUXrvitjub3JVH4FfuFwfw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90df6ed8-59b8-4644-1c58-08d845387829 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:11.1172 (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: dpXkWQif/u26LvoiQup6f9CxphmVCv5ne59Z4gFYtbZVtw9e2xK/Z0poqVh06nJsiR+iFcRzSPEcAhX3OZttRWjmj/yLMD7+lODFOmgmhrk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.105; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:09 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Add python notrun-helper similar to _check_o_direct for bash tests. To be used in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 717b5b652c..369e9918b4 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1083,6 +1083,12 @@ def _verify_aio_mode(supported_aio_modes: Sequence[s= tr] =3D ()) -> None: if supported_aio_modes and (aiomode not in supported_aio_modes): notrun('not suitable for this aio mode: %s' % aiomode) =20 +def verify_o_direct() -> None: + with FilePath('test_o_direct') as f: + qemu_img_create('-f', 'raw', f, '1M') + if 'O_DIRECT' in qemu_io('-f', 'raw', '-t', 'none', '-c', 'quit', = f): + notrun(f'file system at {test_dir} does not support O_DIRECT') + def supports_quorum(): return 'quorum' in qemu_img_pipe('--help') =20 --=20 2.21.3 From nobody Sat May 18 18:02:08 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=1597949537; cv=pass; d=zohomail.com; s=zohoarc; b=OD0EKZHgT3LTZjOFCqY5as4gjVkfg3v5l6OaxOvt3cnrcyfLkCW1QfCO8/+dSYquX4ZHD0uH3WFEkUkJcykBclm1MPKBg/u7t95Omrden20ulDCpu6UBrjbaH4LeAy3raERC89+nLjdb3HTjshHt9o5WSHNqtqT3rgCLi/6RT5E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949537; 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=Z1hZ5wjEyfzVH8D25IXioGcJE35tviOlYq6iYGJ+Suc=; b=SyHwA4DrEzc68fM0MUZ5KzPzJw1OnjXsO1wHO3sd7h1Nw8RpuGjKUTkFNo+SM/fVW1MiHoouQx5Rcg9add4IiGIEWJIxqAkh7H1pMKcbC1xs+br+UbdzMNKm9yiOP+I99/0d1+OIOgZFxeGQ8o+RTKH4fG+f36zkMuldIJjrzWE= 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 1597949537740176.94937112968728; Thu, 20 Aug 2020 11:52:17 -0700 (PDT) Received: from localhost ([::1]:58462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pfc-0007Tq-Go for importer@patchew.org; Thu, 20 Aug 2020 14:52:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUL-00018y-8Y; Thu, 20 Aug 2020 14:40:37 -0400 Received: from mail-eopbgr00104.outbound.protection.outlook.com ([40.107.0.104]:1630 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUI-0003CQ-0t; Thu, 20 Aug 2020 14:40:36 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:12 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:12 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W7nchhQnwCJd8Sg0hF9NkV1z1uFxM8vxbFz2y7gDWHFjklr83fCDQl1H9sreJ8h9zcUQ+U5S8Zti4/orIyhKvj5cnNto9lCqFxMCvm4Mj7sv14y71Le9r4Qz2T2eclsxpd/e4YscfCu2IvSDQHPnUlnlI+tUUnEbElSAAahC773TfDWl/NG50C9h5OlyAFo8OGFCDw93uIv/nMT72Nv+suJlne3wWXRfArTEOh37P1bWYSk3oJXB9uhI4W2MAx2z2or1uLDNymHh0D7x6urgvoGn8c54rLv0vesWpszy3FiuN8IAKj/GBnYE9Lum2NG9o7YCgneFwo6BRNJ5YMmhDg== 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=Z1hZ5wjEyfzVH8D25IXioGcJE35tviOlYq6iYGJ+Suc=; b=fuy8foXbUc1GnTSoctE5MMVM78vKzJHEHNnDiaHoyXVaHjn4wbwC0MX26YEI2eT+6Txw4VyFUMjwpQYYMZ/hKQuQK3guK6qSpjdueVo5aJs/xjiKDAwcESStmjhlukce76Wr4LlL4sIxnDvjrH0DXpmewI/PgIDvSdiWzONYwAHimMBFRALzO9Qc5rivs0k6U4oXu+9Q4v6zD/QWvUiL1DsZ0xC7m0OEBBrq/6Itt0m19l1QkXfSth8KIeLxAZuog80OPf3UCB7xrIZgzQIAG7bIQIFvN1ndbUTfDzpoRHn47ytx46gTZmDuq3iD+VlvK/AF9JLsminJAssGxiUC/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z1hZ5wjEyfzVH8D25IXioGcJE35tviOlYq6iYGJ+Suc=; b=a3jsXGrvd2Wxo4VH6IIIq4F51BksiwADVFW5WCAFNq0ilYEG7Fk3VFt/ackSQ7V1FRW90ym4QOiCo2MPuyNQCSusotUsq7AIdJ5ey6Gv6y/gH7aBs2pR/1Fg+U9XwS1fFIKUsg/mA8a/YCHR8CLasi056WM9/t4HPt2ZuQYj+hg= 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 v4 09/10] iotests.py: add filter_img_check Date: Thu, 20 Aug 2020 21:39:49 +0300 Message-Id: <20200820183950.13109-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: b34768db-766d-4f3a-6e3f-08d8453878ad X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: 3vXt3vco1pmk6R2jVp3rOWUkFj/NAyA+FRK3kkXx4eZxXm1BBunoAjhzB3tUes5fK5TfQZjb+ZNqotH5kG0INONh0+RAHfZgw9Dcf7d698Ej8DDFv4YxGM4WWVE5rNaahQtEmOIvNjC+irmfXjmObRFs976eSc+L2B/a8M6MMkEcSdda8oVqgEr2O7+3s6LMNkFSMPJ3tDNnsmqPznH/vvYk8wnqmjtzR7zlQM7P1L1lMkMMq+hh1077Xt4NN+Zn0qpfaOmCmIVQfC34z9q4EfzjaJqseFTvAuzqu4ipha6KcWPync6+yZv2pFoEonZAagyg5c6AYyHtR6DKaewsoA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(36756003)(86362001)(2906002)(478600001)(6916009)(4744005)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ZNhrpE/g10yXCvwERZROHDnxpM5auiIn/D7Ato0QZV2Ume9vB+K9CdDDKV8LyiyoluOwa645/pkC96wEv+m+fPvoaDqA848eWb0WJrFIJHUwb4P4SQH+qyiTkZjsRgkrqxyA/tDgn3FoDctZZOJhwyzJ4fwhikYD0Wy9DJIm537xMTjiK6RC72ciO5TSMWMfOqdhPYMGTH22q07gYCFVXN9SP/91+0t0Nq/iZ476rrgIX+HnWhTQUxvbxlrXGvhIhCVYKHPKNlUO87eHoRpeg0WPf3RMJb+0dD//EAR6j9r11K6+v7B2A46iROdsI2lr7lxzazD4g547IUapHkYA5SQNt+8c7aoiWKLaCw5XQlxl7CdhvoRlu+xj6F5jni2P66LeO89IcdMpvNhE1m874Y2fhmrxCuwQOvXS2zf+H6iYHBsvYQD18fmf46pMwVSBNttMmVxzKKeFh/ybdkQWU/JqQjvNxR4hSBYm6Kylk8KOv8eDuJYNnOeFX4ybqaXZlva5f2APYeiZMNHiEVDugVFEMf5JpxjcjA8W7RwyIaWFrQvlkl3ZGZ3MaqCUFIEe45DhjkxqE99UFMYqN4sivN1f9PdiurmuYOgkZb44E5XqYuxmKwHpV5968CXEeYbN66ODOcks8b2uV8lw324HWQ== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b34768db-766d-4f3a-6e3f-08d8453878ad X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:12.0361 (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: z9ltQVQ7vDpK5APSmJiDgWWEUUA6PPXejNrhHM1Ce6ZEuDXhMW7pT1O1Nc5Pd1RCgMOmtYN2ArkdTd7TdfOX/sihmSv7rEkNExEyflZ9J6Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.104; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:13 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, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Add analog of bash _filter_qemu_img_check to python framework. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 369e9918b4..ef3da4ee61 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -402,6 +402,10 @@ def filter_img_info(output, filename): lines.append(line) return '\n'.join(lines) =20 +def filter_img_check(msg): + msg =3D re.sub(r'.*allocated.*fragmented.*compressed clusters', '', ms= g) + return re.sub(r'Image end offset: [0-9]+', '', msg).strip() + def filter_imgfmt(msg): return msg.replace(imgfmt, 'IMGFMT') =20 --=20 2.21.3 From nobody Sat May 18 18:02:08 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=1597949476; cv=pass; d=zohomail.com; s=zohoarc; b=BAkCK7q2IiIGvCN9sQc/wWRBWjKX6S+jO+t0Jd86GeaiyQ+g1YjazBKZBe4wqlOxrvo0PaIvy1uvPkby82dbVsbNAr7jMfDQpeP1RZ8wJD70AuEcJWz5RIpW9gfDp2SVzUbGPcpSiN3NHjEBvRvk3S1K/Fhe2dBaOytz/W6PWMk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597949476; 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=np7UeKSFarEW6PBJSy5AcluhabaTug0c5LtbL8eRrxwmz/X8662FVSZ50SeOBKdYAwcjpXXw5Xcvbxk35sBLq4izmIp6nexFZ/iXkFCLzLmLAvN4U8J63X51QaLAzMIvYZrfH8dPtPgTi9XSKm3rbYN5/GyQE6Zzd4Z7YaP3/xo= 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 159794947623532.132501453783334; Thu, 20 Aug 2020 11:51:16 -0700 (PDT) Received: from localhost ([::1]:56148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8pec-0006VQ-Ve for importer@patchew.org; Thu, 20 Aug 2020 14:51:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUK-000177-In; Thu, 20 Aug 2020 14:40:36 -0400 Received: from mail-eopbgr00105.outbound.protection.outlook.com ([40.107.0.105]:40648 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8pUI-0003Bm-J6; Thu, 20 Aug 2020 14:40:36 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3032.eurprd08.prod.outlook.com (2603:10a6:209:43::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 18:40:12 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::8c0c:c056:97a5:484a%3]) with mapi id 15.20.3283.027; Thu, 20 Aug 2020 18:40:12 +0000 Received: from kvm.sw.ru (185.215.60.171) by AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25 via Frontend Transport; Thu, 20 Aug 2020 18:40:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LP1z2W7Rz7oHuJfY4/kaFXgbo5yy8nmmIqOfkWitEiBhSLgnw5mLznmJZLjeQ3eSjLyGdMw61bQXXQkv2yPoTiZzBrsFStjvMqSOtzK3EXGrFlPv090UXxXEo2xMUX1WhhbuqymCehkm6vDOYqzlwEN/t8ZJ/vWPbzrd3W6PzoDaVJPCV14PWFpEnKCdoOG8c/CztqJE5iQrqE0x9VNqpG25ZYNPfyDFQw8JfoYf2hB1wIAgATZJRq2Np9iLd1p8CzOmwg1zTWZtdmIHYjOdIQYnI3tAziJqe/f/CmweG57TpCjLzKSaFTc8tz8pB4pUSmsN0fxIDCL3Nr1Yr9EIYw== 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=RGWo4ituEu5mw84kcldHM635pNZAtr8OfDMQGAsVTeoEEweHoiQ0N9UfFCrERqNGKBS692roKvAQSiTwlSmd+MPXY1jQn0oOlXZzb9F7CAEXElcW286XS5aQchy8SFKR8Eehi44TQJ6NKZ3BQ8QHkpSLuczg9OR9gGakkWA1BiC5yTSBhUbkDt5gfE02ZbMyAKyl14emY8v5SVsuQWozjPt/0GYe5FwQ6XslDALXvt1zfCbG3fKGvmyxBt6UFXysCg3XCIv7otv640j4SknsGa45XYAPRkZtNkgZYW1/3R8elYXlo6z1SMGCkRB3+vXXvRaUcDk5YPh/0AF8c23B9w== 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=iOQ3L8WzYBoOJLc30YMRDeJQsZHNJMados4xIkq8Ohc2B2bnwh8wv/dJIp92ZdrKdGNIIKkQst7gWgOL7aVv0jz7XCnChs7ZxqApsSJL6c1QaXkjMv+BEVlJQzs84AE6fzLWL82U10J4PECByS7sxhx+HNRRfwK7ClATzb+3x3U= 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 v4 10/10] iotests: add 298 to test new preallocate filter driver Date: Thu, 20 Aug 2020 21:39:50 +0300 Message-Id: <20200820183950.13109-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200820183950.13109-1-vsementsov@virtuozzo.com> References: <20200820183950.13109-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM4PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:200:89::13) 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: b35401eb-43f9-4d15-f74c-08d845387932 X-MS-TrafficTypeDiagnostic: AM6PR08MB3032: 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: YsAA7DLFvE5sJl6rLsOLatGSMMMugGYY111kPqiiYrhosPu9JqRqRWcb+EwAKLGyrZN+Mtw4tPgVleo5iRPk3NuucII7ouICahc+Oj8OyurjLrwWeXR7DJda+ciUz0u4yshu0swQgkft+aOxId/K2mvdOySQ5AusInYtPQKvpx7t06z71pmDlDUMuusBKtQYtY4YoqaCEGcC8J38b/oJNRCOP5meooMrnqGhpm4c9v4CyIILkkKEjHn0LTGsQJhtHwnkaomyMtw4BZJQu7+lv+fSJBFJel/KlKgkDdnCAZgQ+L257H1amLZLhrFMXnujBjyRdRVh6Q3WMrTe2vJtPUBa+qn+NSr4YIrw26U8mz2hIyrbN9ZDDMWCLldzOp/hj+apg4PB7f1A5N5j/9OAYJUuunNgPGjp/10Z6SsB6Gpojlc/+IOGnxkDd7t0/YbxJ+rDqoAjodBXcqlzk7oyQk3QBwVcgMRm8CVR6ox8yKc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39840400004)(376002)(346002)(396003)(136003)(4326008)(6666004)(8676002)(16526019)(186003)(26005)(316002)(107886003)(6486002)(83380400001)(36756003)(86362001)(2906002)(478600001)(6916009)(5660300002)(8936002)(66946007)(66476007)(66556008)(6506007)(1076003)(6512007)(956004)(2616005)(52116002)(2004002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Dlde9cPbQI2+sGX+XJc3E682MXS3OylXTkhXzEiBeWC/IogNv0hCc+rN2dZQo6w63qLH7O9qpbcmdJnIQFzSBORC2Mp23MQmCJF5eHog1E1EfETtfmvJaBGnXeJQzxRtkHQZ4FsUSmFtBqq8WrYHy9od1aByP+AbGzxNQNC1WoP63VvM1FBwzkIJvvyE5nWzWriVaOtLBShGUFOiKDLwc6d3C6yntVNKPDMzaq1IJNU7QXTudZ0/F3i8EN/0+feP2NMZohvnK8gQkPXS/65G39FdfW9cwx7KeplyPuW2/ZTAYE6sCLvyjZHBaA9561X3T6ZQKKQrm31TdMy35WMFFGPBMBYimI2NoEnKmkn94P7pHjsWugPWudLuALwdzjYuAwcOoyhmV+sg81ujoKPdx613lFuA2EGxadMcxiFAioMVy3Rs0AIG/p3bM4Aq50duru+U12v7Z35ZwaDgkgi7ohT8BjVUpdAc/5x5iM31kBGhacIXUr/Mi5n2bdk0zst18R9hy+pWSyK0lmWOYXyQsykeCig81/2UcAuK2ShmOAAHGbuTIIK9dtVDloBTUm/qpM39RqdIPtCyzOW2/Kl4Qy0/upOSTifC4pz/d7V5w9lbuOPmPMaTSwrXB2q6ckodpbNfwlhBASuz/EsJ0/6W5g== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b35401eb-43f9-4d15-f74c-08d845387932 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 18:40:12.8117 (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: jT7NNvb55AuLxPxtXtSFgijA5Ym/oPB91xWuXfRE/HLHfKODNiIlawi5kOx3NygkI7kniVRzwyPTKHeEZ7NnF7eg3c8J6f3DFdsTrpHLdaw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3032 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.0.105; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/20 14:40:09 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy 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