From patchwork Thu Jun 11 16:26:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 280742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE16BC433E0 for ; Thu, 11 Jun 2020 16:37:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5D9D2078D for ; Thu, 11 Jun 2020 16:37:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="WXx8NBGw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5D9D2078D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjQCR-0000H8-S9 for qemu-devel@archiver.kernel.org; Thu, 11 Jun 2020 12:37:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjQ2z-0002LP-Gm; Thu, 11 Jun 2020 12:27:21 -0400 Received: from mail-db8eur05on2110.outbound.protection.outlook.com ([40.107.20.110]:32417 helo=EUR05-DB8-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 1jjQ2w-0006oc-C5; Thu, 11 Jun 2020 12:27:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SatIJpzrRyUVQBq3THKiZv5Y3jskB2dKWltYlCqqie5QkUvccbRvq9Jyef4OfSfqDZNXDkWU0vRGHqfmBx0g7wctFu1T/Y0TaM+IJOC943cDPajw8KoZxtSyJCAIYNJSSZPgqNUNfAq3fWeSw180dxc/4eY8xMhEGEvjjsAeB1xkW+/5UFGGd0roZwW7if/Jk9oe9W0drDeaGPvz6h6FK3gQnroIurO5cu39ULJUaUBpGDYSjUe7iZf9NnvW2ZrMIMMNR+fqgrTRQfih1biDEjZJ5RKK/9gfgLB+11UYkRAYLAfQr+pSOBGlZbgSzB2QvqJgRlOcnd4KXK8cK3F/Fg== 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=r0SO4DX7DNyh9nqVV/vSG+97GsZkC4/oklrCyDg0a4s=; b=FlUYWn2a3iP4oZhv4AEMvLjLDnabpVxAfRwWta6y/Kadi5vntkno9fZdCPPPyAKGZHAJErVq6LxT/cfn4ZyA2nZ857Nz/SDXOjzINKEUVdZraB8fwW5TDqW9rGRDcT5SaLoLQMykLxtWIMACyI5JZMqzjnvcSQZrbW8aEK+9J6mauxfclWu74s9K7sEpBRlmT4odL/wuJr1+OVKx6JqKuCmBohC8LfYr1+lgXx9M9Z8Hc1ohyyEQn1eqsDNS7wCpJJKtLLUsKM1Jvn4Ds3+H5aIzoXGfVroo+uhoiYArG7pctmfaFUHXBxlXOHa+EyZh48zu2lZOjz0TOP5Q5YdCeQ== 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=r0SO4DX7DNyh9nqVV/vSG+97GsZkC4/oklrCyDg0a4s=; b=WXx8NBGwtv6jaPzjgVCu7DxefIu6g++HIplmuBbZLSvB+VLw9BMvWhOuu9pbB3WDr8sIr+o+j23EVxtNQeYgD4SR0RXPzeW1zR2IflVK8yZsWfPh/0BwAsKEOsnuYwJdyYqnx+W0MwF6ExOJz+8w2V8zPn9LCU6QK5ygF34dYgI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5493.eurprd08.prod.outlook.com (2603:10a6:20b:102::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Thu, 11 Jun 2020 16:27:12 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3088.022; Thu, 11 Jun 2020 16:27:12 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 1/4] block: add max_pwrite_zeroes_fast to BlockLimits Date: Thu, 11 Jun 2020 19:26:52 +0300 Message-Id: <20200611162655.4538-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200611162655.4538-1-vsementsov@virtuozzo.com> References: <20200611162655.4538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.159) by AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Thu, 11 Jun 2020 16:27:11 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.159] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78e6da88-40be-4346-1ccb-08d80e244b5c X-MS-TrafficTypeDiagnostic: AM7PR08MB5493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:538; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: creaBap4AMfCNZ6LosCaY3+HHVjeE6sY9MDPxlKr24ogi9ftvDVFmCEdkL7UJqeTjUfb6VsbvZjEf1R7Zg/s2huTke2GjYhhatuYHiFe9S7CfwQ0DUKCO+c+9UJCxyquK3C6V/cgjAhVi7RJutBoOf9uSuF3Hpbx3Is1GY8BicLB6b+RvqVa44wiK39R9qrV7GY10jJ+YVUUYESQ0hISDK+hFYeET8su/lfp2Oi76C9k/Erwz7Ng+9SEs2dO/WaVcJOpfghbQFqRD2J5ZI91qQ+GwSaED8Av3unmrXF9oaT2DJxoYT6NWRaSNuV0R5SOEh7wsh9w+QDVmIkrWSUpZA== 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; SFTY:; SFS:(4636009)(376002)(346002)(136003)(39840400004)(366004)(396003)(6512007)(316002)(478600001)(16526019)(186003)(8676002)(36756003)(6486002)(8936002)(52116002)(83380400001)(2616005)(107886003)(6506007)(26005)(956004)(4326008)(6916009)(66556008)(6666004)(66476007)(5660300002)(1076003)(86362001)(66946007)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: /RNDZtVWhHyjAMMuG8zX7COIOjmz5bvoJLY+5WS/qTkd69vRQB3KZwNrzgJrjXkZbAX5lUXhJYOgJK74ydsgfwEZnkkFn3TS9F1tZb4iKWjEGIu5gwuap2H/juJ5KBSedntr7bdnbT0OYTbb18beZ5DgvU9Pu19tGdXPXt09/VwyGnR4iwQRXqCxIrgmYg6RuO1yuS61Nj4j4jtBZZQHO1hPLr69NIxYVwRcOOgTs1y5fRYxZZt/6//CRvRA2RSVFOX+y/8e2kbGawpkHdu5U4EgpwH67RPrDfFiKC7aRVtdcVsN9j6nmpGYBtv2OANe1u7br/cNFKnLe8pS0QL3REYW8GLYOB0PpA4HEeAZceSVXbVC75NKOF26s3n+K8vbvkkTk3PKrA7vGe6CL8ZZXqq+CDXnq6W9I+2/eo9ELXD5D9DG3w+nCxVKkbDGEeYQ98LWGEIGBzHswtEaLAFJiKBylQ2DGlwa29mMnnaq4kUXHM06fZcz1fR2+jvertpb X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78e6da88-40be-4346-1ccb-08d80e244b5c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 16:27:12.0447 (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: W5koqcg2vdOvnizq0VEVuU2h6RJ6lN945f2gaPmYL6Fqtde+d2FpiCbuP8G5HgGqlbjqRXy8nmxCs2kSgZnIdrcc6Sr/SFej33cxgj1axz4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5493 Received-SPF: pass client-ip=40.107.20.110; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/11 12:27:11 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=_AUTOLEARN 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: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The NBD spec was recently updated to clarify that max_block doesn't relate to NBD_CMD_WRITE_ZEROES with NBD_CMD_FLAG_FAST_ZERO (which mirrors Qemu flag BDRV_REQ_NO_FALLBACK). To drop the restriction we need new max_pwrite_zeroes_fast. Default value of new max_pwrite_zeroes_fast is zero and it means use max_pwrite_zeroes. So this commit semantically changes nothing. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 8 ++++++++ block/io.c | 17 ++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 791de6a59c..277e32fe31 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -626,6 +626,14 @@ typedef struct BlockLimits { * pwrite_zeroes_alignment. May be 0 if no inherent 32-bit limit */ int32_t max_pwrite_zeroes; + /* + * Maximum number of bytes that can zeroed at once if flag + * BDRV_REQ_NO_FALLBACK specified. Must be multiple of + * pwrite_zeroes_alignment. + * If 0, max_pwrite_zeroes is used for no-fallback case. + */ + int64_t max_pwrite_zeroes_fast; + /* Optimal alignment for write zeroes requests in bytes. A power * of 2 is best but not mandatory. Must be a multiple of * bl.request_alignment, and must be less than max_pwrite_zeroes diff --git a/block/io.c b/block/io.c index df8f2a98d4..0af62a53fd 100644 --- a/block/io.c +++ b/block/io.c @@ -1774,12 +1774,13 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, bool need_flush = false; int head = 0; int tail = 0; - - int max_write_zeroes = MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, INT_MAX); + int max_write_zeroes; int alignment = MAX(bs->bl.pwrite_zeroes_alignment, bs->bl.request_alignment); int max_transfer = MIN_NON_ZERO(bs->bl.max_transfer, MAX_BOUNCE_BUFFER); + assert(alignment % bs->bl.request_alignment == 0); + if (!drv) { return -ENOMEDIUM; } @@ -1788,12 +1789,18 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, return -ENOTSUP; } - assert(alignment % bs->bl.request_alignment == 0); - head = offset % alignment; - tail = (offset + bytes) % alignment; + if ((flags & BDRV_REQ_NO_FALLBACK) && bs->bl.max_pwrite_zeroes_fast) { + max_write_zeroes = bs->bl.max_pwrite_zeroes_fast; + } else { + max_write_zeroes = bs->bl.max_pwrite_zeroes; + } + max_write_zeroes = MIN_NON_ZERO(max_write_zeroes, INT_MAX); max_write_zeroes = QEMU_ALIGN_DOWN(max_write_zeroes, alignment); assert(max_write_zeroes >= bs->bl.request_alignment); + head = offset % alignment; + tail = (offset + bytes) % alignment; + while (bytes > 0 && !ret) { int num = bytes; From patchwork Thu Jun 11 16:26:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 280744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1C6CC433E0 for ; Thu, 11 Jun 2020 16:34:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C11F206C3 for ; Thu, 11 Jun 2020 16:34:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="u77ITSb2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C11F206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjQAI-0004lh-Hg for qemu-devel@archiver.kernel.org; Thu, 11 Jun 2020 12:34:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjQ31-0002Qx-Lp; Thu, 11 Jun 2020 12:27:23 -0400 Received: from mail-db8eur05on2110.outbound.protection.outlook.com ([40.107.20.110]:32417 helo=EUR05-DB8-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 1jjQ30-0006oc-0z; Thu, 11 Jun 2020 12:27:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IHQGx+AsOM8Rgf3OVX927d/yROPImF+qtoae2oUhjllqy8Hs5Syb8tOCmcWiMCT/+om3CxbKLZ298GI2bPn6rp3ohNK0q6/jFlYHAOVdLHAOVe+v6IMhxCKc7dG8893mOPNe3uHgFoSA/bxVzss3bFPzYSlkgY50YqDSBzemKBSTmrNRLMOaa+QS8KTt2etPijRqxE+ANgQrRIYyPPbXdmhrcJrWyRXAk3o4tRR7xjIPTz9OTjbiBqOTTl1C8gVFh8vL9NflXGYeIEd3Bfhpvk4ROGyJX1kNa13Qo2DPjMjVD57hqpet1SSEUmEmPZ55xNuHPe2V2IKakb1Q+KHdqw== 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=O0xrQeysTFjb+GCyru1t/kK/l7QxTARdCZVDvohnjes=; b=ERs1Fz7UN0bKw66eJxy5SOK8GurZ7ZxpNpsY5lCX5HQ4IRQjJ43Ia2RF3+rxt7q5du1fKISrRZ93wGnklKkS6SYAiDcUXJCE6zwA7ftIHkPDmAHnrtLhfw6gKkpPCrNY5wMkscjw+YbvQKtiZDLbC2wY/d6refdiCz6HDPF/6TWJ61qIxdk8WgAf0bn/MU8T9udW+74iT7CWFe2pXaOXKVmk1p6ObF9/zIRKB50f+y3oqdeXTgdG8HWJjEqmHu4lKdK6xGOE5R9sLAfl7KtpS7gJfpsyTaH/vPybBi7gxN4ARZ3MpNdWKcnVzinFJa/30tI3U8L1d251Lj/J5VNLOA== 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=O0xrQeysTFjb+GCyru1t/kK/l7QxTARdCZVDvohnjes=; b=u77ITSb28ZeBvhGFFbgujFUUDwCF8y1RvLIJe5EHnVH74DzLinfRhqNRExVNTk5NhmTTpb1+7vvgokQvT1HfjgkhN7A7gRg/bB8Ly4jvqzwdKPquvsdH70oGSXTc8GaTSwARrk1axVm7HF46NOp2TejAoLtCm3el9BMQCZOoUfI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5493.eurprd08.prod.outlook.com (2603:10a6:20b:102::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Thu, 11 Jun 2020 16:27:13 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3088.022; Thu, 11 Jun 2020 16:27:13 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 2/4] block/nbd: define new max_write_zero_fast limit Date: Thu, 11 Jun 2020 19:26:53 +0300 Message-Id: <20200611162655.4538-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200611162655.4538-1-vsementsov@virtuozzo.com> References: <20200611162655.4538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.159) by AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Thu, 11 Jun 2020 16:27:12 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.159] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c12c565b-de40-4f3d-c7a9-08d80e244bef X-MS-TrafficTypeDiagnostic: AM7PR08MB5493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:206; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EtUPPue8DLLVLDu7ejjWdnmB+Ud+FaiSbGkTei00nBUrweUwAVGKQoZEl6L4LI4ShJ+/zfKWwby4VI1BRCMcm74kBhjwe+g4Ted8CG2I2nnXtLWjzHinjmRL33nbxH9Y9Eb/BhORRkSQt0VHGmERxMkGaurnz4u8YrBH/k2kjD9+LX1Fe2qz2ZOduDH188fZhSQCt1IsXumoVcFIw+QLb7VlVLvc8PvD+Kpqf7V90Yb5mrEhOaozIzWfKTFeu22PG2+SwVhziLJIN9MPd3hhWQf0ZHHAHQLoypaKhOyvVoWnRLyJKGnWI5apPC6LGz+A4PZyV0o/nmzg6Mign/Uq6g== 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; SFTY:; SFS:(4636009)(376002)(346002)(136003)(39840400004)(366004)(396003)(6512007)(316002)(478600001)(16526019)(186003)(8676002)(36756003)(6486002)(8936002)(52116002)(83380400001)(2616005)(107886003)(6506007)(26005)(956004)(4326008)(6916009)(66556008)(6666004)(66476007)(4744005)(5660300002)(1076003)(86362001)(66946007)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: syY9TFXlGFoeE2oiqgKY8uK8Ba5G/s0woulIk3gb4vGKKUFv+/BFgz7e89pH8IRbZ2HYzVjspkhVddPTnIRkV5HmAc9gyNdr6bgxO81O9+thaUg0TplaHqqrhghEaXiGGPsgj7vrXHoqFi/ZTKMkCbW+4D3wGci+iyTxzQnIQaiRA5IvWZL6rYUOctlhQ7paqP7+DxaW2CDpBFXR2aq3329IlFN3pZlGeqZAY3T3+t3JUCPifFwWEHNyl4Ny6Q0RLLTEGUKBxAdbgv0fFTz1wM0vRPJAdSG+xxZMzxPWzx/Sf1oVz8z+ml0EbtKFBiS7gml1/is+C92iNpsfOw4St7fr47xs+mmr20Sz8dkqwGj3QWsl+VfpdBRXX052VoTPwkkMkAjPeFsN0L/PH2O3gPyHUA/gcpJw4LXDk0fGXmbDUG7+YimyXxnP5UFrNMvyT6fQFBH/y6vd9il7FXMFS63JUtV/bW2XxG4EqmlgI4TWrxnex5Y68NHJpXwgDx6i X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c12c565b-de40-4f3d-c7a9-08d80e244bef X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 16:27:12.9746 (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: wfc9RpgOlHflZ+sLybNM/Hki5qn3TYO1HdslmOXsvUzO/6UkpBJAl+U3t0ZFh04U03K+g0UF/xNdbNBUXG0xfT1PlGcsyv5X7sTH8feVOrY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5493 Received-SPF: pass client-ip=40.107.20.110; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/11 12:27:11 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=_AUTOLEARN 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: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The NBD spec was recently updated to clarify that max_block doesn't relate to NBD_CMD_WRITE_ZEROES with NBD_CMD_FLAG_FAST_ZERO (which mirrors Qemu flag BDRV_REQ_NO_FALLBACK). bs->bl.max_write_zero_fast is zero by default which means using max_pwrite_zeroes. Update nbd driver to allow larger requests with BDRV_REQ_NO_FALLBACK. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/nbd.c b/block/nbd.c index 4ac23c8f62..b0584cf68d 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -1956,6 +1956,7 @@ static void nbd_refresh_limits(BlockDriverState *bs, Error **errp) bs->bl.request_alignment = min; bs->bl.max_pdiscard = QEMU_ALIGN_DOWN(INT_MAX, min); + bs->bl.max_pwrite_zeroes_fast = bs->bl.max_pdiscard; bs->bl.max_pwrite_zeroes = max; bs->bl.max_transfer = max; From patchwork Thu Jun 11 16:26:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 280741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B74CC433E0 for ; Thu, 11 Jun 2020 16:42:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4351206A4 for ; Thu, 11 Jun 2020 16:42:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="X2N2OUXN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4351206A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjQHt-00071H-RJ for qemu-devel@archiver.kernel.org; Thu, 11 Jun 2020 12:42:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjQ36-0002dM-Jq; Thu, 11 Jun 2020 12:27:28 -0400 Received: from mail-db8eur05on2110.outbound.protection.outlook.com ([40.107.20.110]:32417 helo=EUR05-DB8-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 1jjQ34-0006oc-Nm; Thu, 11 Jun 2020 12:27:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GsMbsAk4uJyCUqcJrSh6UJGJu4gUg7qRhgD7JtycVS7Qf2Nry/3xkrvne+BG+JdtH/5+oVWmlpc/QBCBsQEy/Q18+98O5uxafjaxQW4mP+M28RUHralUKbx9Yw/wm3iOmMa0dSIJW7gxDB8wfPK845H6+FGJ+s+Cor8uAbCElqCrDRwSun4PHdeRFx8g0p+Vk/iYnmEQ7iODy/VSmUPORnEJZe7SoMo96PyUllvogLnqRwSkBQ6Rebd95y4FZF4rXhrTGtCUO85tcryMfzyA1sl2WgGUzR2nLUuCBmfYWHctrgQLZlzqCt1+0RJwuouPZjiEEZhcsr0UoUNGPRLUJg== 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=ARsDwo3NL2rF2drTnTEncmtKWCAtf9odtNkvr+PoF9I=; b=jEJegKilqZjuiJATPRU08Zf4ltfa8gbdHYcQfe3sj3tKLaoC/cmOJGH6hv5kROfHCLzuX51S2SWmwjYPuppdLKLmE99NihRNkLxA5S9ERxZvhRXsil6QEW+KEIL1ASG1FjKQGiSWmAHNU8qHGiXitUv3Fsl4gPJqVYz4oGZQTnvoUI7RwdC9u39obdhwiermKMXTHAt+OYdDhZ8UlsvVWpw3b3+1NF6mafk3r9Kl83lQZWPkGViv5VVuuN50At5+CU27Uiwba8oU+ujSO5u3ZEEVbeha8/AHxWkMhgerK3ZSpEoVJO0drJTcoWi9jKQ95ky+T77T0NKvawHFu+TQRg== 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=ARsDwo3NL2rF2drTnTEncmtKWCAtf9odtNkvr+PoF9I=; b=X2N2OUXNDrUK7UUTFMB3CXEfArBZ7lFqd+CsovvH+hOkjyIivsvgAM3VraL7dJsFDEbXUEZplduV+7axdW395dzM5Zq5T/S+iFG0Z38L9378aN8udKdZp4Hix48p5GAKk93hYh9vVltfeTAzCSpH9dvuOfISu1yTVdVX6LCScq4= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5493.eurprd08.prod.outlook.com (2603:10a6:20b:102::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Thu, 11 Jun 2020 16:27:14 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3088.022; Thu, 11 Jun 2020 16:27:14 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 4/4] block/io: auto-no-fallback for write-zeroes Date: Thu, 11 Jun 2020 19:26:55 +0300 Message-Id: <20200611162655.4538-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200611162655.4538-1-vsementsov@virtuozzo.com> References: <20200611162655.4538-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kvm.sw.ru (185.215.60.159) by AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Thu, 11 Jun 2020 16:27:14 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.159] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 071e37bd-a663-4879-49ca-08d80e244cfd X-MS-TrafficTypeDiagnostic: AM7PR08MB5493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:381; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 31D/3P4cGnF/rn6yZPpjFMKCYkipvOKHQ3RAK//diq7toScNbm+KwNeTU4II48vu7afaM1wAdiNER0VV0A+kZg9qXJJ7stoHibPYUMoq4+xyey9W9Wz6F6z7fscEOh/PEkcVo41iznKB8OumaismPSonPr+ZUXZse7OYeMCnKnxhz9hvwpmm1R73XJHSb+eFcX7xBkGE7BbJBAIx/pDVuGWAMwzAL21kPu8pObQlTV4SGiRHcLT0Ah6u61enjTynshc1QkaBHbSF/osN73lHfRwOsXH2A1LuO7lfcCIETWc0NEq/xLFPl9dSED4F7keZtYjF1Jf9OqnnmjkrTNzUSw== 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; SFTY:; SFS:(4636009)(376002)(346002)(136003)(39840400004)(366004)(396003)(6512007)(316002)(478600001)(16526019)(186003)(8676002)(36756003)(6486002)(8936002)(52116002)(83380400001)(2616005)(107886003)(6506007)(26005)(956004)(4326008)(6916009)(66556008)(6666004)(66476007)(5660300002)(1076003)(86362001)(66946007)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: W990FI9mTfT4aBO9oUzOsY4jaXbOxXgPADE3TAk4C6dvrr44o2DtS8ACw3mQ0fnDVt7QbooohLUrFJuxejdhK4Z3HPpIX0q2R+F9n7ytELCVQ/W+hSGvuiIEl1ncgJhfuUAPOSKn9RAm+a2Z+vdHu9MoTZe2rrlV/Zo6XhUHuq9Rsho7rsvacsz5m6FKjJaUDDYbZ0Yf8y68KaZxkSAHO+sEDoQ8JTV6yMAgH+b8vr6kXqie5TEk+VDPXhedlNsh+Y8KW3133EcyLgTrnCqX/Ez7rzFwdzYm5NTcaRolLlHPhg18AMo7qH+KpgsX6M5z44QIoxvZ5lSil57luLhwEx6T27IiHnvt4XOZuWOxgJjkjKbC/VhklFaD/IqvAOO4Tmjbuw3eHKzQN7fGPMXdfirMlqt9JQXxBGfCl6/1O9SsiwD5J5KHoq3Wp3f8ME+HhMOs5VgBz5F4urNxY7FWLyuqwSZUkWa448VtBEPcalv8pJPI9xicOwNYBKWOvRPp X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 071e37bd-a663-4879-49ca-08d80e244cfd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 16:27:14.7394 (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: RV5TrI4Q4SErdv7Xq7X+8Prav2/dKT2fPFrKDDu2T1ZcyORDKDnEyYizvwtX/TjHz7DRAj/3iKDLY7523Efsdpwtw4rcCHP5gUJFnCUinA4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5493 Received-SPF: pass client-ip=40.107.20.110; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/11 12:27:11 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=_AUTOLEARN 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: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" When BDRV_REQ_NO_FALLBACK is supported, the NBD driver supports a larger request size. Add code to try large zero requests with a NO_FALLBACK request prior to having to split a request into chunks according to max_pwrite_zeroes. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/block/io.c b/block/io.c index 3fae97da2d..ad219cb220 100644 --- a/block/io.c +++ b/block/io.c @@ -1778,6 +1778,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int alignment = MAX(bs->bl.pwrite_zeroes_alignment, bs->bl.request_alignment); int max_transfer = MIN_NON_ZERO(bs->bl.max_transfer, MAX_BOUNCE_BUFFER); + bool auto_no_fallback = false; assert(alignment % bs->bl.request_alignment == 0); @@ -1785,6 +1786,16 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, return -ENOMEDIUM; } + if (!(flags & BDRV_REQ_NO_FALLBACK) && + (bs->supported_zero_flags & BDRV_REQ_NO_FALLBACK) && + bs->bl.max_pwrite_zeroes && bs->bl.max_pwrite_zeroes < bytes && + bs->bl.max_pwrite_zeroes < bs->bl.max_pwrite_zeroes_fast) + { + assert(drv->bdrv_co_pwrite_zeroes); + flags |= BDRV_REQ_NO_FALLBACK; + auto_no_fallback = true; + } + if ((flags & ~bs->supported_zero_flags) & BDRV_REQ_NO_FALLBACK) { return -ENOTSUP; } @@ -1829,6 +1840,14 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, if (drv->bdrv_co_pwrite_zeroes) { ret = drv->bdrv_co_pwrite_zeroes(bs, offset, num, flags & bs->supported_zero_flags); + if (ret == -ENOTSUP && auto_no_fallback) { + auto_no_fallback = false; + flags &= ~BDRV_REQ_NO_FALLBACK; + max_write_zeroes = + QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, + INT_MAX), alignment); + continue; + } if (ret != -ENOTSUP && (flags & BDRV_REQ_FUA) && !(bs->supported_zero_flags & BDRV_REQ_FUA)) { need_flush = true;