From patchwork Wed Mar 24 20:51:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12162373 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,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 BC1DDC433DB for ; Wed, 24 Mar 2021 21:03:04 +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 38D4761A1B for ; Wed, 24 Mar 2021 21:03:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38D4761A1B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine 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]:34594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPAed-0000v7-5F for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 17:03:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPAU7-0006fa-A7; Wed, 24 Mar 2021 16:52:11 -0400 Received: from mail-vi1eur05on2116.outbound.protection.outlook.com ([40.107.21.116]:40416 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPAU4-0005Ie-Hc; Wed, 24 Mar 2021 16:52:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aB2Rwi0potVWuk/Un9yPlefaiTKI55T2puym0oQ9zPFjRpHkSe0sDP/98PGWvnvntCeP5ZvxI7Zeb1KT+UUeIMZa9H+m6XizCsX3tmjoLpbjsm7MT3wnJqy4ItErcwsrrsf0G/AtojHvvwuSwlXT/HANEW2sZUYDXQc3bT3Yid+hbtQhbg3VYwCHTbM2WhzZFgALWEZ8oV48zEWErCMxaCiLRVTRLdBslGsYKjzmEW7iM0bZXVLYMoJ3Rugb24zbOnl6mjTHRP37oFD/3pFdXg5zREqKbba30b6B7ub+fpc05HjdYVKee9L0lQcPO9su0WBwMCQ/ICz2ajI9jvVvcg== 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=ajHSNZBLXJdejHFx3sNu2R9jm4Sw5Pru+WDibOJOH8A=; b=blYJNrt8z7qB7MdxTLIVrN5kqViD76eKngvs2M8iKUtCg5L1QUPzYH3AFg8j4y23x3Xlo3QATIwktdlViSEXZKvWTaDRpoKKOtbk0UyYNL1x6TVrmC6JjAWrTtq5EdjR97f7MJRANTpOZCUWr1fCN6eGRQCOb7KH8rjCjiXeXK/x57YAXj0BGyHfbB47QN/8haUNftiym0LL3sCp4Qmrj7Vqkm1AtiNebuEzgQHyLYMHOtiZ+AVl9LvhMdqT5CQvielXtcYu28pNPM7tcWmvUiBpXwV180FH3REITkM12U4YkVjcuFInRxQFmnUyBaF6VfIvnALaHn8nhpwkBNb5Xw== 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=ajHSNZBLXJdejHFx3sNu2R9jm4Sw5Pru+WDibOJOH8A=; b=vN3FAf5pA/kLqg+qvzH2DhTgieKCkS7DIVldsvvsQubCjBsa7XsdawurndUFw2EMm+PrwT1ZISp3VdWX3AL2BxUtVo/yUrMNKv0qm9P1RiNhlWnLNRBZgIShkrPEv0f4ETw+yyTTEEhJVN+D3jaUcz3T0iO2X9Srb2tjoYdSHMY= 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 AM7PR08MB5447.eurprd08.prod.outlook.com (2603:10a6:20b:10b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.24; Wed, 24 Mar 2021 20:51:55 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a%7]) with mapi id 15.20.3955.027; Wed, 24 Mar 2021 20:51:55 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, integration@gluster.org, namei.unix@gmail.com, dillaman@redhat.com, berto@igalia.com, eblake@redhat.com, pl@kamp.de, ronniesahlberg@gmail.com, fam@euphon.net, sw@weilnetz.de, stefanha@redhat.com, pbonzini@redhat.com, pavel.dovgaluk@ispras.ru, ari@tuxera.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com Subject: [PATCH v4 06/11] block: make BlockLimits::max_pwrite_zeroes 64bit Date: Wed, 24 Mar 2021 23:51:27 +0300 Message-Id: <20210324205132.464899-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210324205132.464899-1-vsementsov@virtuozzo.com> References: <20210324205132.464899-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.202] X-ClientProxiedBy: AM0PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:208:ac::35) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.202) by AM0PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:208:ac::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.9 via Frontend Transport; Wed, 24 Mar 2021 20:51:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f0ead44-08f1-4d30-5597-08d8ef06a8bc X-MS-TrafficTypeDiagnostic: AM7PR08MB5447: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xEl9zlsi6V6ar4bWU8+fFWezvQZOWXq7bIZ8iWWTTccmH4j2Xw/g63iNqiBg0VbXg4+jF63R7UcID898HE1ScUjrCeRckGFh7/Q467V/i1AlrVzjMtiO11ImKLQOAD0y2TbWnh02iZSKZJmVFeIM5uvB5ZAC8DLSWOwbqc4QjmGnSOFpj4SsEdIz848BmBk16taMe/uzahQFQdjo51p7+EH8xC5WtIGLuoFPDdNVwEqSzVj3t1HjTzsrs6ulaWPMHBeHPnksY1beh0Nt1TmTprdVZnF6PnCW+1pt6DZ/6RoKttr7mzzJqEEK/HWcvi4v/hgqfCt4A+lkmgiw1k+oJs/4blFSlSd+AL5Kv/r1Vq9JAFhCRTHXgSfhxDhOj5nRb5jJdawvH3QGlHKqyo5BkH5e7knW5l5L1LsXjPqgC1gwEAEiyeDlIE+4e90ZYfXKJ4KOBIdRq+TLqOf8wuiwTQTUyOoOm3K1S1qVCf5QOqKB2heZ7xA2xyDFxqrnBy/zFomG7g1nyqnlVL80OdFKmSUndIN83h4SchG6p8K6xTZy9Us4yXVkNltJuwP4B9eyCa24woq21JlnrqW3Y9LZclRGo1+sfAvAGiRyp6e5E9Kjn9qQi2oKL8X3smYQv7VFqf16lw2QCybn/WUMeSCS8kBa/BLpfs7oC3L+g6vCig+RJFU8SRj43Wnpae4Td7N2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39840400004)(346002)(136003)(376002)(396003)(366004)(2616005)(6916009)(478600001)(8936002)(66946007)(38100700001)(956004)(66556008)(6512007)(66476007)(6506007)(6486002)(52116002)(186003)(5660300002)(26005)(69590400012)(83380400001)(7416002)(6666004)(86362001)(2906002)(16526019)(316002)(1076003)(36756003)(4326008)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: kVXU10pSsOsMYTmHi3ZcP7R5zv2SYl9kDva27xYPAu8L1j5GsP8jb+72bTYTL4uheXa9PW2s2wWfj9ch6O1gJwA5q8bBnOORKsmrgqsAvFplQOP0loDUszanth2aY19QXAzW2sFYv9ZaP0u/1EayJ5LHkfEA4+wScrrwSOjuulinsABadRSQvWbaGxX4fc2F1PUuXrkg5+QUGA1IlTu6izFhEswixWZNX+WnR5lCLrAtP5KfDEHRIBB4Zbqb28pDX6GrjuNsbuRSJserKpiNlr82XX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change-CrossTenant-Network-Message-Id: 3f0ead44-08f1-4d30-5597-08d8ef06a8bc X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2021 20:51:55.4016 (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: Q18XFVmhcbpYNCdumYQUNNVu6aymNgCL2owPaX5oFMLYGLZijdDeAifN2adplcDOsnoGi2KI7b0MYejfS4AlmGgU6h/OmeZVZZyO8nrBGoU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5447 Received-SPF: pass client-ip=40.107.21.116; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to support 64 bit write-zeroes requests. Now update the limit variable. It's absolutely safe. The variable is set in some drivers, and used in bdrv_co_do_pwrite_zeroes(). Update also max_write_zeroes variable in bdrv_co_do_pwrite_zeroes(), so that bdrv_co_do_pwrite_zeroes() is now prepared to 64bit requests. The remaining logic including num, offset and bytes variables is already supporting 64bit requests. So the only thing that prevents 64 bit requests is limiting max_write_zeroes variable to INT_MAX in bdrv_co_do_pwrite_zeroes(). We'll drop this limitation after updating all block drivers. Ah, we also have bdrv_check_request32() in bdrv_co_pwritev_part(). It will be modified to do bdrv_check_request() for write-zeroes path. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 7 +++---- block/io.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 88b19db756..71e5025534 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -676,10 +676,9 @@ typedef struct BlockLimits { * that is set. May be 0 if bl.request_alignment is good enough */ uint32_t pdiscard_alignment; - /* Maximum number of bytes that can zeroized at once (since it is - * signed, it must be < 2G, if set). Must be multiple of - * pwrite_zeroes_alignment. May be 0 if no inherent 32-bit limit */ - int32_t max_pwrite_zeroes; + /* Maximum number of bytes that can zeroized at once. Must be multiple of + * pwrite_zeroes_alignment. May be 0 if no inherent 64-bit limit */ + int64_t max_pwrite_zeroes; /* Optimal alignment for write zeroes requests in bytes. A power * of 2 is best but not mandatory. Must be a multiple of diff --git a/block/io.c b/block/io.c index 55095dd08e..79e600af27 100644 --- a/block/io.c +++ b/block/io.c @@ -1836,7 +1836,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int head = 0; int tail = 0; - int max_write_zeroes = MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, INT_MAX); + int64_t max_write_zeroes = MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, INT_MAX); 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);