From nobody Mon May 6 00:47:24 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=1588245557; cv=pass; d=zohomail.com; s=zohoarc; b=NgPzVBgjZI3OX/AuyM8m6PP+njxGkVPRy900HY0XoEOsQjAsNAWYXQQTqDQOVoyyN3X/5DpBUH/pev/nvUrJE2eTqPvl3cXOwsFRUlX8CT1PNWiZX40JYkVSo+AA5mQ9K4uJnpuSqwia1maVQGb5UO39KF13TtGGh00/CuiW69A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245557; 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=gF05sRHYizg+u644p4qnPQeW1LsP7vuUemd46yD+PME=; b=LqmPmuSWBaLijMDsltQnSFTjvGSvz4eHtGZqBpwjLYGSQhwORRZmbTPaJcBbVDCqlEmmreWgQjv+JJT4o1syq0STEOGgMP1SDb9R9n2qj73ZwEvGvrmepNjZ0DiK5OcHwEhqrKPmSBTanMIf7PWk4VlX4zr5gRtFoarC4a9XKZY= 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 1588245557059991.2751440064281; Thu, 30 Apr 2020 04:19:17 -0700 (PDT) Received: from localhost ([::1]:58538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Dn-00058a-NE for importer@patchew.org; Thu, 30 Apr 2020 07:19:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57706) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78P-0006rZ-07 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76t-0005EY-EI for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:40 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75g-0003SE-Jn; Thu, 30 Apr 2020 07:10:53 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:48 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:48 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MC+CftcrZJfS9kyxHob0+ZhcAGQr/yIQxDtLhh8ElqKz/EfoZvcgK78NJrZOOfGHKnyMxy57ZHk9D2mkyQLs0q3VbB5QCCsOLmhtuGhXMHcc295jq31ZuiRLuP/RhgrQJVdq9cOxzM130BOzCfLBgf8rvRKyu7wMpPCUdlOqJIHS6cZqO8fRuNCtN+FA6v1eY1FLTZZlFPXTftE0+9VfUOSZ6Yns1KwHEI9XBkXUDH2blkqZX0qw4Sn9+6js8rPrP2bD2WCSp4HCZcBPo2ekLInuixX8vmKfobVrZHz6qPU6+mvBhMTQFY1j5dUSoN0gQThkojSj3Ijp9OjSr2N28w== 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=gF05sRHYizg+u644p4qnPQeW1LsP7vuUemd46yD+PME=; b=awpxObDfip6CchDE7Fy4olm8wTIM74F0PagNRuhuvZav8wh74hd7znU4+KBBvT85XSVlg/hGUYVT2JPEPTWW6M7nU7seBsye8aBhb3dBkHB/wXVRPxWlC023y8kLzc1TD/+yHpP9u0p2uGpzL0BjkdM+poZmDSyQN4ACU5yEMJQIMk1DCpIzcT8s04rP7iwTuIduCaOwM8K0kheTYSBtsgNTFphK/24BqP3BQ33VPUIdHtzivIAyUhHu8c9JW3UYq3nnCcAVWSVWlNuUicNOdG1fWjguFGOngcnAM+3Lkl0UIhMnAZY2GSHZOIx/4gYrPTNKZAVWV3kABDEAOvQjKA== 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=gF05sRHYizg+u644p4qnPQeW1LsP7vuUemd46yD+PME=; b=TF3Yhw8Ak66aWherY7P5lwIvVkqBTgUmGF33471VF3zjgYXzNscmwtBp/29c0bAr3b0mQGGOC+ffcXgVA+G9sMmQ/APamtIxTNgoSyXqrtG85H9k97H4SYDqUYlm0PYRtpeRlBy5PwnMoiOtq6aqS7xndkhZQLGL6LnSWLQkeAk= 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 v3 01/17] block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes Date: Thu, 30 Apr 2020 14:10:17 +0300 Message-Id: <20200430111033.29980-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c992617-3633-4b55-1d01-08d7ecf72319 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3vkFgPpczJiZxHJ+CHwhBlmYqRsdv2uA6GtVhVt7D43QrosaXIbgxGML7eOKt7hEvrCrzaQm4+WbBZ1RChoJzNgOK5/MWRwrozDMms7ZH5XYNn0iAJD9EPiZHGBGOG6gUc0AXZqESFsQI41yljI6FnDjGQOKA2RejzJv/VD7gE6kj8RockroClLuPx1cbiHI03QVY75Lb5UxLfv8l52ooV6xDQogcp+G7C5YtTIVaic6jg7gbQ1hB3OjvbqepCtvj0fXesvjxbcGlcr8lTTSon3uW0Q50FndFPEiJ2QVFpeRYwQcPxjTh5RLV6CuBvAH1+6c6k2ck7XRjVgrELyrdjGgSLaUFirjSqQIDnn4BCd4JpTL0bEcCuvnwGkLx63QBs7OTCMtE9SnpH2to55Ox+lz086qZSmOFBG0fHSsK5HD1wlhOy8qS/0aaUCwuC8z 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)(396003)(366004)(39840400004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: q78d8Jp69aeS0HkHanXYWzL0sJvU5Q2uk7ot62rXY207SJEOHNYagSwIy9oPwePkExB2A9vxglR6GifgrEb1TpwM/Vdfhl6f3esQsX74hDBhjHraNRIATZIu2o5To/6a74BJGlcaTUX+OsSmxZn1ER5alixgA+fpPcUZ5FdCxhgp8x+bHDGdKAE7DvZDzBT65iEdrMfCb5INByZrniIFK0ZgYuTD45SZFAGDjVll+G5Bm98OG3imUzmUmXFuFmQjVNG4gfHFDH3VBMzUTd/7ok8K17LHuLkRSNVZ1ff7BEQBE9oYgv9HCww+NZZVBLjEWfQcHQL1iKFSHCColuY8V1Q/XkY64O7zOze36RqYP5X6N3XCPRR8DwAbLO1G/1sKOXVaUk3CAba8MrhTnl++FNml2KCNT5ZM4w69AOvHzDj8rcyrBoudO/LvadgjiDS8F6hOye2uHR6fdsach/t/znpjQ2Xk6Pmq6ZFJjf5LKDmKz1U6lAQohS/hETdNbCdDFOnbGvabouRsidtNYFApWCklnAjRnzMOlds5/v7OvcWRsyBYw4wzzAMen/qMK/c3Y25+mkzNrspF1k8lFmBGZDN8aRzOVgMT2GbDN+g1gn8Hm9QSPtbSdIqgwJhA0mb0qSnfe70BOyHFeegTnZvAnfsQzY8xTyxcZdrcQz5ciEstUlnDDv4FvvV6EZkgx82FWAkwL8zUpy7y336wIH6WqcwcJdCOnRYEMjVDbmloJwQr5fb4+7t1cn3vrDBY849fQsBl67AFwVGrvxulBhH21qQIKWFK9S8cMhgm3EkkvvA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c992617-3633-4b55-1d01-08d7ecf72319 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:48.8569 (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: oiiEcrtyRwzQ2YuA5nDZ3XZe0I3w8UeOJsNVH15kvz67XJ4LLKxpvrs6u1cDxjSp99wl7N5A12jfR3SUyO6+6/En+p6MoQyHv+ApfmfUczA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 function is called from 64bit io handlers, and bytes is just passed to throttle_account() which is 64bit too (unsigned though). So, let's convert intermediate argument to 64bit too. This patch is a first in the 64-bit-blocklayer series, so we are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). Patch-correctness audit by Eric Blake: Caller has 32-bit, this patch now causes widening which is safe: block/block-backend.c: blk_do_preadv() passes 'unsigned int' block/block-backend.c: blk_do_pwritev_part() passes 'unsigned int' block/throttle.c: throttle_co_pwrite_zeroes() passes 'int' block/throttle.c: throttle_co_pdiscard() passes 'int' Caller has 64-bit, this patch fixes potential bug where pre-patch could narrow, except it's easy enough to trace that callers are still capped at 2G actions: block/throttle.c: throttle_co_preadv() passes 'uint64_t' block/throttle.c: throttle_co_pwritev() passes 'uint64_t' Implementation in question: block/throttle-groups.c throttle_group_co_io_limits_intercept() takes 'unsigned int bytes' and uses it: argument to util/throttle.c throttle_account(uint64_t) All safe: it patches a latent bug, and does not introduce any 64-bit gotchas once throttle_co_p{read,write}v are relaxed, and assuming throttle_account() is not buggy. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- include/block/throttle-groups.h | 2 +- block/throttle-groups.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/block/throttle-groups.h b/include/block/throttle-group= s.h index 712a8e64b4..f921994b8a 100644 --- a/include/block/throttle-groups.h +++ b/include/block/throttle-groups.h @@ -76,7 +76,7 @@ void throttle_group_unregister_tgm(ThrottleGroupMember *t= gm); void throttle_group_restart_tgm(ThrottleGroupMember *tgm); =20 void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMembe= r *tgm, - unsigned int bytes, + int64_t bytes, bool is_write); void throttle_group_attach_aio_context(ThrottleGroupMember *tgm, AioContext *new_context); diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 37695b0cd7..14b74b7b8f 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -358,12 +358,15 @@ static void schedule_next_request(ThrottleGroupMember= *tgm, bool is_write) * @is_write: the type of operation (read/write) */ void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMembe= r *tgm, - unsigned int bytes, + int64_t bytes, bool is_write) { bool must_wait; ThrottleGroupMember *token; ThrottleGroup *tg =3D container_of(tgm->throttle_state, ThrottleGroup,= ts); + + assert(bytes >=3D 0); + qemu_mutex_lock(&tg->lock); =20 /* First we check if this I/O has to be throttled. */ --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245356; cv=pass; d=zohomail.com; s=zohoarc; b=GsGcJ1ZYopY/+9rKJanyZCaRbx9BfSGY3vjQZcxI3xmFyhK5TpK5rEeWyfs6bN5c8ONkDwkeFTAvakI7WaTi9PWhXPi6M9EEWUwJVuWj1T3jtP7V/f2Vg2tqk+OS/2VIP7Kj8YmxDWFHOaV9Q/sNNUWfMiqkr2mAKpbEnpJmqns= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245356; 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=LL3Bz10/NFJ05J9+HBjGU50uN2HqJxcTOa1wXkkplME=; b=bHwMTyaEz6R3Hm/hqb8yC8hgY7f5SRlOmcAGQ5mdjCie8K7zRC5PPDDcFxOqEZ2i++EAbuHNHHBSECLhY/h4SGG4sNWug9D5UmDFa02GdJIvtrFCPNhNipNVLNTPKWOcUWQN6x4Acr4xCiEu8JCX6cCZdND8WzpdWMFCwQ2UBKY= 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 1588245356546705.9031962277578; Thu, 30 Apr 2020 04:15:56 -0700 (PDT) Received: from localhost ([::1]:49426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7AY-0000gq-CC for importer@patchew.org; Thu, 30 Apr 2020 07:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57712) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78P-0006sl-GM for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76t-0005Ek-TX for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:41 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75i-0003SE-2D; Thu, 30 Apr 2020 07:10:55 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:50 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:50 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fKbOWzS9f6vPRtO+Z3rewI9DHSqS5masQ4EAhDnzux+3acp/+IMofdjdoXFhcEeGMIzWsgrr12z3LZX8uE13F5xISLbq1PNp7UvYHraHp+z+sXFnr6UMCVI5hWjQS9IEQ83o20Exa5mpKo1msK8B85zY4joksKwkag2IcVQXfdcIQ8+9Lufbw7iu0lytKlQyyfkVMd2sB2apCqavjMpKgFe8JPPIwCSqEHQ8Qkqcuru420k9I5+VxwccASgWlUk9USv2CEJObrZlBIBLZFvN9Cvs3EHYnD1OXpn32J2YPii9+craD0tgmoLZU56Q/rfTDThYqNbdlFzytTgaxSGa8g== 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=LL3Bz10/NFJ05J9+HBjGU50uN2HqJxcTOa1wXkkplME=; b=Mx3rIu3v65WgcUyyXbKFHoBghMfbHPFxZqGndKTBS1IF5qgD1h/gZKpFrrcgLF1ijqAIG8vgYCG/0kSAz8N5k7829LQpBjfy0M5kYtO61gCPZ5OMRA9OlesrAvjkYjXFKGh0npXyWIBVtieouj+CDX1xd+SpmE6bvM9GljbrCvJuv7gPFa/t6z1BLEXgsbXPSE/B+SlCDOT1oeQIKMkcBwXVbI18f15zIgfxloGc4Vh5grB97EzjWN4rxQDYviprZLPSGzlD2b0za17ssgG8fwLagXfD0YmltYQpo9/yhwHLnwLjeo0Jq7/fiu9oxlH026z7hFtOVspDVPSyybWfZw== 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=LL3Bz10/NFJ05J9+HBjGU50uN2HqJxcTOa1wXkkplME=; b=suvHPPo4capZD7WpA5/xEHXwn8ZOuE2wn7vuk5OJ7LEEe/ASFvvdWWwsEAU3oN0Suu0YCYhJtBi46PAxE+y56I424o+d85JDR1RqLTiFbDCsdVQBOuFzANpjDKY36jYuJ7NW9LBVKkH9BDk3U8pZLxdLXJbpMzfro47MriwW45o= 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 v3 02/17] block: use int64_t as bytes type in tracked requests Date: Thu, 30 Apr 2020 14:10:18 +0300 Message-Id: <20200430111033.29980-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 61844c1c-9c52-4ff1-050e-08d7ecf72432 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3jOlWzf/KSHmoY2xq9ASMOLQp0URbcg33ms0K0gfxwDTtbCK2e0VAhPJAT9ZdkXjOP47b+CcvgPxAQjxqiPGnOewvpBXGmOHMWMwWOm7fko+7Btrclp21Na/p/KaKSmDWZpA7l5QHS6Zjh5EpvdKnWa72MVLYxrJssNEeVkjBl1LG5dzhkogU37mYyYnz/QqwAPjo59FwjS1fJOXZXvDCFSsKiJ9BIdS450+uxPf+vCNa+5bA48wSEJCtj0dikCiMEtokoUqYTFL12buMwxuyc79lWy5If6lo2cldSSWUUaIfwchXJJ4shUmaHw33HI7a/rIPfn2PEIXdryh0JYlnW3BI+Ou94gEuilZhkX20JtuOy405+o8/1RoznBM6z78CZRwu1KudZ6G6Gq98hf9e460a4YEimuZQbBQ5JsUKFkjuQdhj3PdtzxfyVztyx4i 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)(396003)(366004)(39840400004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: K+GAmFXeK+CwR7twgATmU5LHty5Efqm9tTys2JmI5RIk205gqM0GyM78bYHKRiuqJKdyWoHT3da/9Jsz3iB4NYjCVzn6dcOQogKDW9ado/onggnWPPG7OzKHfF30Ijzi3rjd6H8uU53q1LWYNUf5FmFwJPUFTtPhaB+hGNOk9k7GIYWkN22Gr4rt4+CGOJG80thMDsoXkkQMTroCY7wif5+rqLYWboEXHQnhEF+YXsPHDekGbTEi+fgixI5Jm6IPueGZUBPhRfsQXwnpI0iluJC5z6tq2i6JWIFAEIbtHJidSbPSYOcTpN2QM+dELavQGQSYKLK1JZM5SgR7xXanlAz8jU89AThYWAFC363mDTJqPSU3rULB7dVm0unkKhIKUCua5r+4xB6D2N2bKLxf/QkpKCm9O0An0JnjA17XnOnjwlTQ/N6yBQ2bC1J2MelRB1WjZdYjlWafCoQ7rB90EytemZXH3jqqx3GDtYfenOX3xrd+Af6TCPRmbGcM7ZDBPIsFQjEfqIrW99Dg626rHvwgwXcOs1S1/rZi1/6LkFiyTHKpPm1oBTk5s4RKwQ1kBiaGXaOLPjpbfWnyQUz2LjbtCUdsrsJiMNR+wqSfIe94Sf8uG2H8c+yXo1/c4NV9sWjSQykRQ+zjX33BtsPpyGWl8HmpZAsKpfhSilcQMkQhq5FbkZgy17utZ8S74TsEAGOcEGW2eiQZrXjSBcCKQMFiLC/xCiP/v7v2dfqLW0jP3KtaMDxkMU/T+Rf+v2MJpIpdnB50a6JrIAP00WhSIEukihf8+b4P3AiHgk1RMQo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61844c1c-9c52-4ff1-050e-08d7ecf72432 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:50.6262 (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: QCnOTIvzQ5gaQxHWje2SanYqBfmm5O1UE3KWa+ue0X4z96hmKV6yLIdzzOEajtb9xA1/I5KjqlbT9tG4LdUs9TO9PEW4XLVmD8hhxd1drgQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert tracked requests now. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- include/block/block_int.h | 4 ++-- block/io.c | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 4c3587ea19..c8daba608b 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -70,12 +70,12 @@ enum BdrvTrackedRequestType { typedef struct BdrvTrackedRequest { BlockDriverState *bs; int64_t offset; - uint64_t bytes; + int64_t bytes; enum BdrvTrackedRequestType type; =20 bool serialising; int64_t overlap_offset; - uint64_t overlap_bytes; + int64_t overlap_bytes; =20 QLIST_ENTRY(BdrvTrackedRequest) list; Coroutine *co; /* owner, used for deadlock detection */ diff --git a/block/io.c b/block/io.c index cd5374e6c7..20ebf3c536 100644 --- a/block/io.c +++ b/block/io.c @@ -692,10 +692,11 @@ static void tracked_request_end(BdrvTrackedRequest *r= eq) static void tracked_request_begin(BdrvTrackedRequest *req, BlockDriverState *bs, int64_t offset, - uint64_t bytes, + int64_t bytes, enum BdrvTrackedRequestType type) { - assert(bytes <=3D INT64_MAX && offset <=3D INT64_MAX - bytes); + assert(offset >=3D 0 && bytes >=3D 0 && + bytes <=3D INT64_MAX && offset <=3D INT64_MAX - bytes); =20 *req =3D (BdrvTrackedRequest){ .bs =3D bs, @@ -716,7 +717,7 @@ static void tracked_request_begin(BdrvTrackedRequest *r= eq, } =20 static bool tracked_request_overlaps(BdrvTrackedRequest *req, - int64_t offset, uint64_t bytes) + int64_t offset, int64_t bytes) { /* aaaa bbbb */ if (offset >=3D req->overlap_offset + req->overlap_bytes) { @@ -773,8 +774,8 @@ bool bdrv_mark_request_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; + int64_t overlap_bytes =3D + ROUND_UP(req->offset + req->bytes, align) - overlap_offset; bool waited; =20 qemu_co_mutex_lock(&bs->reqs_lock); --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245536; cv=pass; d=zohomail.com; s=zohoarc; b=EhrmIjUBuEpeHLVcpSDzGFzjo9gzz3J6c75jwAJeNMB/KI+bSE0A7NoNehgIMtPd6X3fDE5hFZ/70IVQoz/x5xTQNWl5rWi80cILlbfpt1KKuuexDOKM5N6wo1iZmiFMXbr7LJTe/SpyI2sPae84vaXmGusdGam3V7/FIHj/RPM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245536; 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=qp/+IHrL9SLyfDyjEw0pgqE9JJ2GgJtgzNE8110+KHA=; b=IyEMx8ZO2z0xBaPXOgTxKiG20li6G12YPdTQqPP3Oqy5PbizcfZOb9ZUd3V5cUbilfPxJji4qTh/+DAKHXcZXID7uA4QXoCwOEnaz3isuN2m5cgVwkVDYosuX1Bv67AO83bBePoE1ozwesbM9F6OaeQzWahwv5edo1QTj96P7tI= 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 1588245536452178.585413395787; Thu, 30 Apr 2020 04:18:56 -0700 (PDT) Received: from localhost ([::1]:57932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7DR-0004tF-TS for importer@patchew.org; Thu, 30 Apr 2020 07:18:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57716) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78P-0006tb-W9 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76u-0005Eu-Fx for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:41 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75k-0003SE-3N; Thu, 30 Apr 2020 07:10:56 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:52 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:52 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jLDaxp/uVMrJhSh5e3DyroqJKEyFVgNVsvIaRwYs50v95u6SoIfwpuH/fQSTcrUtDVy+Ao2pKyYp6wNMzjKO2Nf8grqEOWCWQpdKeFw2oxu2p0NGA2MF5hMAOW4MMLgVyvWAmIK73ff6Vrr4BES9B8BZDTDan8lvpbx3Ap4q1sETwvl6wu1pofntQhnrrCs6XVgvDkWssLdjM8Thh0pE1EmaVDrBWs4cmKPAVw2B5mBp30XRA7PP9i+wGDJJFo0r8oARnlhQwNkUJGxL91h4s1bKt994U7KLW7NUHbzcFKK2gCQ35BEJD29ngo85IKGqmK+PDV+1/omxup+xW2TpCw== 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=qp/+IHrL9SLyfDyjEw0pgqE9JJ2GgJtgzNE8110+KHA=; b=kYZBiamoEZ4XtDpyFe8PDlpo7d+xNjeoy7H/w5NwPBX59l2l+r6UX0zoR51I/ao1jq8BaMSMkzfh/L0nTd6MvbAf4EEwQI5B7u843Yol9rd/a02SuCDdH043hzJwl/q9pgXxXnEzNlzfIMobSIRq4S4mdy12qSfV1v6KWsH8j8qWBJUh7tW8B8RETB4n3w16j11e2r6YZbY+awa2yJU2TAkPEVo0X5Uqmt6R+UtGZQncJozQ0MRjHJl/QNe3Y+hqsbbPojtRw7onjFpUlckYQ7qMN7ZKFaDcVzPdF+Y2RHXDi928rA3LlmLpjbv3XZ6wuYByRAfLeh+sMtWX7+YtHg== 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=qp/+IHrL9SLyfDyjEw0pgqE9JJ2GgJtgzNE8110+KHA=; b=deXbGbifIdW5oKnWXZPt3t9IUDQQAD4JIAbtB4srMJn21v6TrIj8A+GYzsTUbyUkc+j/74PEl/PPvi2UYrI+sD+dTYekp+7l5F3Xbf4PMA5rvyRE1x7h7IZlO/tNi2+rVBj17D9v1qpgWEze2K9eQBYf8mK9rKRS7BCVPQbD3ig= 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 v3 03/17] block/io: use int64_t bytes parameter in bdrv_check_byte_request() Date: Thu, 30 Apr 2020 14:10:19 +0300 Message-Id: <20200430111033.29980-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 61618f09-7f52-4731-e916-08d7ecf72539 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DTqOAL4V1LZg+8gMp/mq/2nYaVLm4CZBCCMm0aPdyiJ5xxnTjBFGT0o+dZj5EsL/M6nlGQzFHHD9X0AGLFlIdZFgS7dnYBv4Cwh+IKdjBZ0L5YW5vVovXbMUP3vOPH64BVbvoEJ4Hnc9GZx2qH/nLKB6fz/MydsBYPatZZjNSzWIAdSrBUEZS+CM8wAF3zJsG+OK0QDnfEDRRN1id82C8JcE8OBZsyb32Ub7++gSPrCOljdAXnVdvW2ox7wqsiSU7GIf90TQFrQvJF00Rg9tbRAb9EEzeSB6ySrQB74rkGHRq4o2VL+3tW3NU60nY2U1NqB/Tk3F4w3kHY4Nc2HmX+v1P+mylvzx8UyftvXuhrUpv8rI7Shl5NdSnElbDmUJW6fW7fFDzpclqKU9MHaWvB0NNz437o30Ie2VorAg+xQpcgXW1DSY03yKdMQoh0kn 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)(396003)(366004)(39840400004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NEO79wH/Ic4haz7MxOgTHIqRwC6DknjlVJIP6YABlsaC0v19krHzH6G0rzhtvX7MCJtUuS0ol5//8+2Xt7tpDOGaRpiCac8KwyORPwjPKAGMDYmrvPNKyG2Bj0fQwYrJP3px8rItYqkKWjL0azZHgpf4Hx9x+oyt/AeoUH3Mcrtf4k91ESAi0TnKYgIP1xREEsBDJsgTaksOKH0GTwC1Ec+kH00edkyPAWlxjCA8GlJjhfxGMCOHo07NlOzB6e+Pno/OT3wW4E7P5pwh9xztiYPQBPnHZ6AQQJi0RuhVU2L5EAqtiNiu4Ttr2J6rQ9B7lvdHcJhM11Yuk/31SJRwZbTA6oHmmiTTdIVO8hqZfzMEypeFY0P09peatDBxfSELT1SegRMNZosCeLJ/+Op65XOQs4kCV1sKhsFsccR6WxechLASlKfpnh2NDLygF3egwxw2tKbkuTdUeS0oAqIegDpq1Blg7zRNKja5wjmpyHgInHOhWxNc+EIoDTz76tV6igWoPmqBD7eZKIw8Wx/2vh2xRsrQQXC6JH7e2BdFBD2XaUJiZTAZKxuXzgWyEPUZfZMtrbsfnBZW9LD9TGrXQFMvbulcxCp2d1yisk8a8Ho8NM4c/sVLnAyepeRCNrXbvg1mSuCompbLj3NG1htvjMjuK/6rRJhfB4eQrs+Wlcium7p5NS1URLVEhqIXz1du7FuoUmE0GIHSNtIi92NbCYTWrtuFUF5kQUczuG/VSlA/NYuG3ueyM4moAxrMdDzDugF9mXudRPxU9cKX6ZD+NUWl8az2jQrtYw5U03pwZp0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61618f09-7f52-4731-e916-08d7ecf72539 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:52.4233 (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: WDe7QdQej1ocX5e9O3bpZMWGnQvZeBsh8/W1y670CY8eJWlTBW9HVjADv7iZ/AjExm855HBy+/c+aYfAffCGIkUYcYLn30bwGIBXmquX9EQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert bdrv_check_byte_request() now. Patch-correctness audit by Eric Blake: This changes an unsigned to signed value on 64-bit machines, and additionally widens the parameter on 32-bit machines. Existing callers: bdrv_co_preadv_part() with 'unsigned int' - no impact bdrv_co_pwritev_part() with 'unsigned int' - no impact bdrv_co_copy_range_internal() with 'uint64_t' - potentially fixes a latent bug on 32-bit machines. Requires a larger audit to see how bdrv_co_copy_range() and friends are used: block/block-backend.c:blk_co_copy_range() - passes 'int', thus < 2G block/block-copy.c:block_copy_do_copy() - passes 'int64_t', but only after assert(nbytes < INT_MAX); also it has a BLOCK_COPY_MAX_COPY_RANGE set to 16M that factors into its calculations on how much to do per iteration So it looks like at present we are safe. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index 20ebf3c536..7a7d4e578d 100644 --- a/block/io.c +++ b/block/io.c @@ -875,9 +875,9 @@ static bool coroutine_fn bdrv_wait_serialising_requests= (BdrvTrackedRequest *self } =20 static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, - size_t size) + int64_t bytes) { - if (size > BDRV_REQUEST_MAX_BYTES) { + if (bytes > BDRV_REQUEST_MAX_BYTES) { return -EIO; } =20 @@ -885,7 +885,7 @@ static int bdrv_check_byte_request(BlockDriverState *bs= , int64_t offset, return -ENOMEDIUM; } =20 - if (offset < 0) { + if (offset < 0 || bytes < 0) { return -EIO; } =20 --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245364; cv=pass; d=zohomail.com; s=zohoarc; b=mDwaIMgYASOqczQJ4vzi175GBGTjL8V4AgHKgRBx9f0gR0TReFtv1vuVJPgWfYtCpmkU7BHC9iOwibtgH1ZwDi+csJhm8tQGvjVQtia+7NJDylFdyunSOTuEkUlwh40plmacSwTfigfeSTmTAJUWGQqGZpVTHFOZ2Sg/JvAAC6E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245364; 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=m/X8z63edrEOxxhzoG1B/7J3UygWJU5Ku2Fj98P+Nq0=; b=bE4jdqS7GJ1gZllUhN1nkgZQFR7YNDizC+pKpD2CxdGZ52u4CCriI+GMXPJ7XtcC2+10CW1oSfH0jh4A+apax/33ZSxDsHntPD1h2JUFM7HUDPWnYOHd0z6sPGMQIO5kaH1xscfzHUk6iqRvLAph8XB5mwqxTTXf4uOBARKkMrg= 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 1588245364011199.2169761249778; Thu, 30 Apr 2020 04:16:04 -0700 (PDT) Received: from localhost ([::1]:49726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Ag-0000rq-2I for importer@patchew.org; Thu, 30 Apr 2020 07:16:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57720) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78Q-0006uk-Hi for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76v-0005F1-4v for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:42 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75l-0003SE-4k; Thu, 30 Apr 2020 07:10:57 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:53 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:53 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EhM3xYOs1IzWL5EpG8dhPX715NkfScXXYqo2VM+oap3xzFx4ywzQZp5T7rwO2PrD/IW1PIrsoDC5kXI0F8f97GP4P9mMOHYy6ZeC+iI/SbHkOXWFGSe4ktdIBW2gobMEqQxNQWY8KtxaEgxo1cRQ4wW7ruMzUsYSbs8CmUMxRF7exPlutWSjvdg9bbquW0t6+n8Dz5AWUGdJhaQzZIFUoLtCJTkaBuxIefqE5anpqpPVu+/JfyU7BOZClKL0GkvZrClGGKfSenWgzrsjwLzzq8n+n18waf+0OddwdeYVmvxwojGmnheFmvguWrADR4H0pHDEpx3EyeBEJvbj07YAMg== 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=m/X8z63edrEOxxhzoG1B/7J3UygWJU5Ku2Fj98P+Nq0=; b=Z9FRr0ngtu6q3nhqOvn/kT7qO0i1u4rl9hIl3HaLBumNkNvLXx90sxQW7LkGXikTZYb7XC7jeKyFv668H7JLb82UeANuottaLQgs9DYAgUId8djHFBDRZPT4fdD8wKzsXUcMkagX0jX0JCFOkuT5yn2oytUZidEWrb5lLawrLCofQSnyDaOSQ2Q3UCBsolzeRbeXR/FzxG/+HMDdA+HORPk2iIUeGBjV6JkQ/2bzNSfVdRdmaCpn53qRILoRRH9jKfEBwB0MdDphL5beDfpQ3UyABon060+ArSPpQyJxCwfGJSdf3cy/FaXPRuJ4Hp7JAi/HODlgTVPSEDze2KT8ow== 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=m/X8z63edrEOxxhzoG1B/7J3UygWJU5Ku2Fj98P+Nq0=; b=ivrDDutFaQGlYDF3J4kk85S+MIPIfrr6Pbx5BP0rt9v6vcexWVlAdyMMMJPyJ4qZBRu+xS3xE7K2zeyrra0+pOFuArWkF2lJ7EmSKGlRAInMZLit2nKs3K+46sGo9Fvc14KGsSCrAmE0gjj57jp5y2/jUJvo3IP7l/t5mzAttKI= 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 v3 04/17] block/io: use int64_t bytes in driver wrappers Date: Thu, 30 Apr 2020 14:10:20 +0300 Message-Id: <20200430111033.29980-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5659ffc7-e5df-4479-7485-08d7ecf72626 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x+q+cuLlhqgVr/Jy2quVvDq1v5uP+vAO53VGBwskyecX14+EymWa6f3tADI6ZD3twElHwOGnBuESeKDQAmWBn32MBXepcyv0B1ybh5o1z8wiRmMoFLcUucex5NyI12FHYbdI9fU5CqPtuRWCfxDpXj6adzoz2dv+wceK3a9xR5xG7PLaEsp/2vfxeTJwzCygCSvHgl3N+TMHQII9kLdjOxv2crxJekbiiaoKrV/fr9Efav3/VjipZY/QmG0k2mcqwQ2k6SWvByCH3qmxlQbu2mNoJQgldud4YdneLnRWh8AqZKf8PLhgRw/+/GKUVGoE4EfFERP4Gc/CSmmsSf9nRuWgjYcK4ZAxSmgRpqBDxcyKzjVx2beX0ikobuGCY0PDpAk1oyQ+WOZAtNzwdQaFic5YnWeiTW/KM7LI5yOWWhatOybHCtmO5f0vHTWOQ5PF 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)(396003)(366004)(39840400004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: E+uAGRMVDCiPqeMgPfFcb4pbhSTqeqGbTwpILswnksqC7YaoPPeMEWj8zs692Xk4gipmIr9xntcgYDc+aCB9Bt5BB5YJ20fjBI4t9V5nAkFkaYPcsdNXl9Sdn2NN0IR+nXNLxhLyZwEto33TzOyGnPZyewDt3q+/3K5DMxYdwwe1zdzZ5tt4LqfxQJWKqgtgv5ZlePFCAOC/WOcu14+nwtJehhmRyp30ZFy9JPJjfWyQ0mvcyIaIpfrg7Fc4bVGAT0HRD7E+HsqCEnNnW2zLx3eMM0RCfGSu1+x5oQOVF5yYr0kVnSplcmvylIHEHVX/yogOCUTEXXFQC+MKZWErh6/Hiv/Br4n1GtwlFE9IyCkayufy76ZRmEA04vWvINS1PYopAFyhVA5RoiQG+zv07jyes06DAQYcuXcsdoKDAKbe8hLuPUeiC/xQrqn2iqMYgBlmD9sH7yMMv9zUWvElTN+JGfifTiMthq1cKnhYHZByCoeiE7VN6PoWJQvrIfvlaCxc2Tweo52QXrlWfbEJKnUoNWvj+HCU9qHfmYTYuWFP0eqP9HiAsbu3PYxBJzrxRv0Va2M9omtO2MSMWPtkOfydF4t1GBmWc2I7/oLF53Z8/cu6Qv1uybGg/NvKJcu/I1blnsC/vQstgB2YJtWWbCBKuIF60Tx5sdYCrxFmFa/kcnpZXJD5FMafo0WSk9EmxVjMgSsxx0D5ZOwLqqR8lrberzGaKhcliQjF85IvUu+9rVCD23oL7YWfMBySz4BysgCD5lBfmhd5T+fERgxsc2KoJEI2ydnTY6tBN3eBbNY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5659ffc7-e5df-4479-7485-08d7ecf72626 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:53.9158 (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: xdwIrKAfKepTtkOJQvwUhbU7ybxKO5YkUu32GvV8tr0H7XY9v3zJEl96akfj3ePRPSae1sd9lA40KM53iZasaXmyeghMtQTwKAOKaKWNOcU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert driver wrappers parameters which are already 64bit to signed type. Patch-correctness audit by Eric Blake: bdrv_driver_preadv Remains 64 bits, the question is whether any caller could pass in something larger than 63 bits. Callers are: bdrv_co_do_copy_on_readv() - passes 'int64_t pnum', but sets pnum in a fragmenting loop, MAX_BOUNCE_BUFFER when copy-on-read is needed, or max_transfer bounded by BDRV_REQUEST_MAX_BYTES otherwise bdrv_aligned_preadv() - passes 'unsigned int bytes' further limited by fragmenting loop on max_transfer <=3D INT_MAX Input is bounded to < 2G, internal use of 'bytes' is: drv->bdrv_co_preadv_part(uint64_t) - safe qemu_iovec_init_slice(size_t) - potential truncation on 32-bit platform [*] drv->bdrv_co_preadv(uint64_t) - safe drv->bdrv_aio_preadv(uint64_t) - safe drv->bdrv_co_readv(int) after assertion of <2G - safe bdrv_driver_pwritev Remains 64 bits, the question is whether any caller could pass in something larger than 63. Callers are: bdrv_co_do_copy_on_readv() - passes 'int64_t pnum', but set in a fragmenting loop bounded by MAX_BOUNCE_BUFFER bdrv_co_do_pwrite_zeroes() - passes 'int num' bdrv_aligned_pwritev() - passes 'unsigned int bytes' further limited by fragmenting loop on max_transfer <=3D INT_MAX Input is bounded to < 2G, internal use of 'bytes' is: drv->bdrv_co_pwritev_part(uint64_t) - safe qemu_iovec_init_slice(size_t) - potential truncation on 32-bit platform [*] drv->bdrv_co_pwritev(uint64_t) - safe drv->bdrv_aio_pwritev(uint64_t) - safe drv->bdrv_co_writev(int) after assertion of <2G - safe bdrv_driver_pwritev_compressed bdrv_aligned_pwritev() - passes 'unsigned int bytes' Input is bounded to < 4G, internal use of 'bytes' is: drv->bdrv_co_pwritev_compressed_part(uint64_t) - safe drv->bdrv_co_pwritev_compressed(uint64_t) - safe qemu_iovec_init_slice(size_t) - potential truncation on 32-bit platform [*] [*]: QEMUIOVector is in-RAM data, so size_t seems a valid type for it's operation. To avoid truncations we should require max_transfer to be not greater than SIZE_MAX, limiting RAM-occupying operations and QEMUIOVector usage. Still, 64bit discard and write_zeroes (which doesn't use QEMUIOVector) should work even on 32bit machines, not being limited by max_transfer. For now, we safe anyway, as all input goes through bdrv_aligned_pwritev() and bdrv_aligned_preadv(), which are limiting max_transfer to INT_MAX. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block/io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/io.c b/block/io.c index 7a7d4e578d..eeba3b828c 100644 --- a/block/io.c +++ b/block/io.c @@ -906,7 +906,7 @@ static void bdrv_co_io_em_complete(void *opaque, int re= t) } =20 static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, int flags) { @@ -975,7 +975,7 @@ out: } =20 static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t byte= s, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, int flags) { @@ -1055,8 +1055,8 @@ emulate_flags: } =20 static int coroutine_fn -bdrv_driver_pwritev_compressed(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov, +bdrv_driver_pwritev_compressed(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset) { BlockDriver *drv =3D bs->drv; --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245554; cv=pass; d=zohomail.com; s=zohoarc; b=TVoXkydSFHvQiQ1M4Lv5XBC3D6w3uzs1bM/R1FK85FQls3ht8eJ5mrVMrssqZ1KH8iph/D2KE6U8yt5FJKkroI32BrchUJ7ahIqtbPb/OtfUimrlt8Oxooz6pHuS0SFVNJB5XQTbPTACx8pLlBrBAOPDf49Ee4OFcjsKy9LIqsA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245554; 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=dtPlf/oE8vAuiNTry/E6NoEu5Rrio9+5gDt1YkLZynw=; b=Lk3IRAqXXrlYVqKOFaB4qfG4ctBM9vnHxAqpH3Mwmo5Jcti5b6EP1QXn1C6c/iQewqyV0rxIoZ/2SfKirMh3ohLIx1cKo5bwg3EJWffhTZpbFRLZ39bGW0elb9wdmu9yF8CMu/sUpFFsDGEI16XmXeA3X8bW4sCcwmKS+z+YZyQ= 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 1588245554807862.8384399773661; Thu, 30 Apr 2020 04:19:14 -0700 (PDT) Received: from localhost ([::1]:58290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Dl-00052V-EC for importer@patchew.org; Thu, 30 Apr 2020 07:19:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57734) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78S-0006xr-G4 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76x-0005Fl-27 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:44 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75m-0003SE-5o; Thu, 30 Apr 2020 07:10:58 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:55 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:55 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bv2M4cIiGg8N1Ty6a+UrITXGgzL6JhH9UdcjkBfnB4I8a5MDuUTXawMxhKawcwE4IriQ5OmBI+P/+ozjhNC5u//763NGVwXyjhdkPyZ6FSeOwa47BLIk2Qh+xH53GZWEk7MSrk6ofLpvovy5Lhhnq9W23i9Votj0mihYpwEXcugridtqEfspfZ1kfHpsveZq1+ICLT/dA5r2gVuX7eyiCvEYy5DgREdML2jetfEpFcxEl7J5ylTf59+7ygp+B9hVHyWveBTEEjiv8bH2mlQIdk8jByQHhTzdKqHKqRuWqQ9PvbfYsk3q5b7YSb60alFf9Sm0dLaNEM15zTcYoo4XTg== 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=dtPlf/oE8vAuiNTry/E6NoEu5Rrio9+5gDt1YkLZynw=; b=CKQTwst876NI4/hyvzbdNZAisiZiGLNjaiDd/lqe8HN7JavYaKYzsMmiLoVdIPsPCNuSxFL6upJFZ8pVde1PTEUpm+16/NjrwPbep8ho/Zi/A4Z/CZOsvwrG6VBl9cN2Pv5/oxhy0kwI9dfU9G3HAVT0otWPYFCQ7MsS0hag2fOOxCpDzmrexM6QIsNvN184uAELCYMTfaYnELdebhqIBxvGPh4aaGtzlXrUFxBxvaw1+hSXqI+86fVxaSc+N9+/mU8d6Xmju0FWPIMesOAEI01wE149Grap0B/XSly3XJQ4kQ1Woatr9ixd65vJdeG5dKT3ETCLBKlgtjjf53lc8w== 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=dtPlf/oE8vAuiNTry/E6NoEu5Rrio9+5gDt1YkLZynw=; b=n5T1qA2OKKlGndD8ORJlnzETl/k70pPOAHx+KXYTgKVxSaBTjXMnl1cJLIIsN5HPK6qTUXlKfpNSpJq8xg3nYvKiY3Fgi7Xjvtktyn+MgYwY4c0SDgW0knAXE8WJ5OITPVOPBpvalqbbI62QCBpspWpoMkFU6j/50/Z6NbH1gwE= 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 v3 05/17] block/io: support int64_t bytes in bdrv_co_do_pwrite_zeroes() Date: Thu, 30 Apr 2020 14:10:21 +0300 Message-Id: <20200430111033.29980-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e37d5a7-1092-4a3e-0fb0-08d7ecf72708 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ch8V5DhwuZ0ExWWzahVIYZfsVsxqsNaGGdHRP8r7VDA8QBc7Gs6XnegGdbPwTqWVI2Z2G40tIxYEKwOr8A4lExj2Kubfi6gs+XRhDoQ1QZxct7Ep6xBMFsQG2hCXhZkLq59hDpb2XVE2q4kIRKeTSHIR8S4UQy1i6oX2ClOLzynkEzbyaTCaK63+AfJ036kth+EMx9Te265ZVNTXCTtOojGsw+hMDlNsxphS370CkBMtzh71dPSQ1s6TfryYdE4FAWCUaUQi7xVWhqdXw3vldT+4J9x9+jA/BMqCYdNV+Tw6xrTYKYuCZiNDIQIFEbBj6OOq+qVPLd1nD/Usrg7UaaZB8q2ASZWoIZma93OiRvbt2La+0wWankBllHU172p0ZYjG+qnODREaaEyfKhNDx0hvbcdwDW6Yjq12YGxV0mzw2zMTU2Zr9ADVupEOrGw5 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)(396003)(366004)(39840400004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: RHbI61pESYS/PMhbC/A8voABlCrAkTBqpx0UwzXCgU5QvnBizaJSSvmYFd4fdj5ssZBxjHi1E/jXNqRoPgecl+/NEhG8QIQS/fBC801S5UmYPrjO1xKvTLKni4IVfzHEMERszgY08RNxpkFrr2DJ1WXmvjWEkgIue9yui2yySjlEcRgc53+sNtd4GuQdnAvMRTECgmCi2Fmm+QXmT2rdwRyNMxv3sZ1pTKS2GrU7btvRfy7hzmTpZZ/HIZEm+K917gZSRVryCddBzUOK6CTDZ4uWwNAV/5JtPoAVXew/W7TgjMPCG3NPW07a8Tyo9wKjoRiToL7iExN3b52xRroxoXkVyAjv0ilY2adKS4PE/1xjM9Uby3Y3UMa4urVj1gdmIjGXmDCnGfzDrLKhHD6J/W2MvC767GHof12biW2T91iRAXcsomiotcfCMprcB3DmZY4ZJ4B6b7pAY6PbhSMrmuQylqj3SVRdyYPGTAGcXEreKC953N8rI+idIn20XYuIeT0x7mfsse3MjHsUuoOT+YaXYbkXfVB9lyyvOO1ul2URoI/m+aHKGAREzsKWGxS8CGWwweOULpwH2sm2AtNkbQrNDSCWDZwhHJP0J4oqx1PHt5sAN2npZnnzTj2LwGHaS1+017GAVfLhTJPNkydmTM11tNsaDlqFVNwAPhUco5yV06A0ZuoOZLi/bb/t46mTdWxHdgGRZr5F5xAr2RZbeLC3eiwfkawIRdfCW5h9RFZMzuPPuOCFvf08Onbap+xAgBWxvnMtxepXS2bF1QLo4VeTxyKgS9x6Aq01u2Vy9xE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e37d5a7-1092-4a3e-0fb0-08d7ecf72708 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:55.3814 (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: +LtnyMTN6VFx+frHwCa7hGvFnl7vqghGLCHtPj8CdHdwvfVwkssusoi4A1zzE3Ji2lB30rYrNCtxjRJ6Nn8Q82StY9z5Rt6GLDUZRYHsVyc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, prepare bdrv_co_do_pwrite_zeroes() now. Patch-correctness audit by Eric Blake: Widens from 32- to 64-bit. Callers: bdrv_co_do_copy_on_readv() - passes 'int64_t pnum' bounded by fragmenting loop limited to MAX_BOUNCE_BUFFER bdrv_aligned_pwritev() - passes 'unsigned int bytes' - latent bug fix for sizes between 2G and 4G, if any to see if that bug could be tickled, look at callers of bdrv_aligned_pwritev: bdrv_co_do_zero_pwritev() - splits 'unsigned int bytes' into head|body|tail; head and tail are safe but body could be > 2G bdrv_co_pwritev_part() - gates with bdrv_check_byte_request() continuing the audit, callers of bdrv_co_do_zero_pwritev: bdrv_co_pwritev_part() - gates with bdrv_check_byte_request() okay, all callers pass < 2G per our current code in bdrv_check_byte_request(), so there is no actual bug. Use of 'bytes' within the function: compute 'int tail' via % 'int alignment' - safe fragmentation loop 'int num' - still fragments with a cap on max_transfer use of 'num' within the loop compute 'int head' via % 'int alignment' - safe clamp size by 'int max_write_zeroes' - safe drv->bdrv_co_pwrite_zeroes(int) - safe because of clamping clamp size by 'int max_transfer' - safe qemu_iovec_init_buf(size_t) - safe because of clamping bdrv_driver_pwritev(uint64_t) [well, int64_t after 4/17] - safe So even with the wider type, we aren't exceeding the contract of anything we pass it on to. Later patches may improve drv->bdrv_co_pwrite_zeroes and qemu_iovec_init_buf to be 64-bit clean, at which point we would want to revisit this function to use 64-bit clamping rather than 32-bit clamping, but it does not have to happen here. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- block/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index eeba3b828c..b83749cc50 100644 --- a/block/io.c +++ b/block/io.c @@ -42,7 +42,7 @@ =20 static void bdrv_parent_cb_resize(BlockDriverState *bs); static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags); + int64_t offset, int64_t bytes, BdrvRequestFlags flags); =20 static void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ign= ore, bool ignore_bds_parents) @@ -1575,7 +1575,7 @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, } =20 static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { BlockDriver *drv =3D bs->drv; QEMUIOVector qiov; @@ -1605,7 +1605,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(Bloc= kDriverState *bs, assert(max_write_zeroes >=3D bs->bl.request_alignment); =20 while (bytes > 0 && !ret) { - int num =3D bytes; + int64_t num =3D bytes; =20 /* Align request. Block drivers can expect the "bulk" of the requ= est * to be aligned, and that unaligned requests do not cross cluster --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245695; cv=pass; d=zohomail.com; s=zohoarc; b=GXsNp9+roTMvuWEOT7CfYhDzmUMG2AiNBHK7AsQMGG2E3w6fxh1klC/RT84p13OkFwmKCMpWFMSmoQGW/BNurYmLilrI5sNq/QA23iQqsL2WTD5dTeO9xu7celKfUuYTOePj2+JiYOsRclUg9cBWI3SLNWHZimKxiETjmu0zh6E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245695; 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=aQLHfkrzAIN4DFGRA0i6kTfYA/424J/RhqUISyzuxUw=; b=i4itfJL9xRuaL1azpomm6g0qiw2DLGTJ6NjY52TekMxyD4wCRrM9OAHLlEW+r105plOETWO/rNDFScWq7GOWWJnflus/Wo7kDyRmR0kYtUwgznjonk0hrWISglcmUP4fslF/WBhkSitEBzVz9r1NZfhG/v6yYmlEglCo/LIN9Ls= 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 1588245695598738.211626081078; Thu, 30 Apr 2020 04:21:35 -0700 (PDT) Received: from localhost ([::1]:38672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7G2-0000yZ-20 for importer@patchew.org; Thu, 30 Apr 2020 07:21:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57740) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78T-0006zq-QI for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76x-0005G8-Mb for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:45 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75n-0003SE-7L; Thu, 30 Apr 2020 07:10:59 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:57 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:56 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ytt3M3h8kH7dXTP3iJAhp0vOsXNL7r7O3wnGtWYK7MnVUiTIEXbY9MicMOzYmDOglhqJKdmTtgbJIk9/3oEhw7mF1xQZyXpm5sqEoYNvKMFdaWjpOSte+vBvg05HRzIvJnh5CMI3/9go9HSC2Pvr5kPuljUTtLXXR3AXn3D2tHu3gOoK5HIr6jw/DDk4pMh9oJb2/x4jopjkEM4pkQ+qkZisPVBP+Iq4aHyMTQiRYnN8hZqXZPfb8xOIfJDtWof1ltCdvO+TewJBbfWji6zFArdvBNgDY1y2HUrt1ob9TJJ+HIApvQLNspnoQjvhggb28L81JCi6M3FWD5IbeqnZKA== 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=aQLHfkrzAIN4DFGRA0i6kTfYA/424J/RhqUISyzuxUw=; b=djObvAaagqqurE/Yo4zfW0qRTTMmTiiLxTUnlckcYH3nvFNk1nV0oixOb2UJhVF7zw6r+B4ETPSTuiJBzTNQGl9eSBHOMwhkBK1Kyf14mgtHv6kg0WX6b1XadcOpU3D25Vd9hAI+EFQ15lVYEdS3hVirMA4lWAP9tq/iZVs1JGSA9d3JBKk0bj+iDxEJN4ZGxBltLOfdwYky4I0BSpT/lXvWioBuPsoXvOy2ryvyS1BrWvcu3mrzsPVkWI8EVfxIhxKTsBVjB2pqNHRl99Y1ScSf3W1IHi6m3qEjzJkOYDGHwNbtR3MjZ5w/GesCnuS+cLnrdU1OfyMk/2dVVx5EMw== 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=aQLHfkrzAIN4DFGRA0i6kTfYA/424J/RhqUISyzuxUw=; b=I1/cp/3PwgjpewMfqthnw3JDuK4X/BN3B5mZJY3XN3qxRyPQNb2k6TzGJro+Bo0NgXQlKEFTSa/3qd5ewDthM8WpIeeR2N/eABxi2OSoJF1EXhXqMR0z/rA/eijMJtdBiPoRI4RhFvis08d6Mk26B0Ol5oha9hj2ADQAt5IEg4o= 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 v3 06/17] block/io: support int64_t bytes in bdrv_aligned_pwritev() Date: Thu, 30 Apr 2020 14:10:22 +0300 Message-Id: <20200430111033.29980-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cba11a18-38ab-4867-73b3-08d7ecf727e8 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:773; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qd2OqrVcuv1RcgdlNUhAhFoHmnZ2yzXWcpao75gHgwRG55DCk5CjQvnMjRJMSYvfxHSl23oIfc49Wqn57uGli5CjgemdpKxOsDisSc4VlvhXwsV5nmkAdik4HhRwkYk5nnaDHMsizm8Doz8kpkjjl7LPFX3c/6Qc/JM5A7pGp+rXiSvjN24e7d4IOs0uEICzuQLXXEZzYAjun4io9UP2V1nBxlJUxfVoqbUJnJkTEwFUi8w1gBUCIMNVx+C7zN36pm27+AxMOk145dtH3s1T9yXqk+0eAWa6d61YEqN+CU6tp3nNDn3tVdJxlCP7kM0UsulxprEvRYhWXKMhY6tfkCCkXGHxZCSC2ibL6jlISIMwVJXvrZTfpQYUZFhpEHzonBsCGY2qlBqR76L2RXSgQXwPfXpeULDf+l+LVOUMaBjJzZncjVT4r4iFURovXQv1 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)(396003)(366004)(39840400004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: q/NBX88CEPOMwp6B5z3SDRQ1tA6cxNUq6xBsvIxgsQRXAx3bRCtzqs+jYvq+d7A15P3+UdwyQGyY2oQva+wL6p1qdhko2s6RD4enYhvhDLdtM0O6KxSOX8DwxY1ucTN2Y17rsJQdNFLgAcQ80XrMWTcGtkcIRSRu2I4R867OF1NCGAt4XJkG0c7mhL8loS8WyhOxx3FLtCTBxOVsbrvXP5aoxDVI+5yaZSLgBa2qXDcwUiQ3WC/d4cs6rJZ0EQW5jFmdsFrd2tNbfS12C0VEmLM8ZwPjEUZm98tKEh8kYl6JMDH6nY+UooOFsGx0KUXR3HXFv1dgvQXBl21oeTAA2N3DqA3krAPCrJNB+KB5duzA+68nF/f6wc6dhZExWfUI+PqTfNIVi49NBpLH9VRHhQJtEGrrg9lpLPGjiKmFnWaHslJZ75o8M3slE7tSlKUpc7ZkOTnd5yxjv5jututrWhZdMBr1ciLjB4mKaICB+l3RmORH2D3N/4wo1kHcEgD01aMf3ygvBO0O0u4reGgIw+XJAD2BGk8GWXCy4RPcU0u0mxqkd8HVeJXrMfxX1XPPqpXZWQ8/yZ9HMOC7gAxQ/sxO/yBHabHeAl6Csac0VA9DjARJ7cvLz5pvbeErcpOunM+7wCgYJsB8K+3hTyA2ObyDI3ktfGwb4mLSfWn7hw+KWG58CpfZ8n0ATOObFE5e+Ux9chEqtz0iT2EK/NYb2j2EhUvenJBLGrZ6CajtoDU7cxLNvlDyNQrB9t3a8WaFPw1K6brJPrA/XZPS5vMNaOga1a8yQxtG9l2i4LklvHE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cba11a18-38ab-4867-73b3-08d7ecf727e8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:56.8808 (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: MXIji1iZ2qcpwxJvDVTnyKYv+7BXTJQszQOUYyW/e08Bgh7UK2K8jremcq3T/00+9wovACVXvAPELwHD3kdZislJM5/ICqSTb5PhPdnSY10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, prepare bdrv_aligned_pwritev() now and convert the dependencies: bdrv_co_write_req_prepare() and bdrv_co_write_req_finish() to signed type bytes. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake --- block/io.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/block/io.c b/block/io.c index b83749cc50..8bb4ea6285 100644 --- a/block/io.c +++ b/block/io.c @@ -1686,12 +1686,11 @@ fail: } =20 static inline int coroutine_fn -bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, uint64_t bytes, +bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, int64_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) { return -EPERM; @@ -1716,8 +1715,10 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t = offset, uint64_t bytes, } =20 assert(req->overlap_offset <=3D offset); + assert(offset <=3D INT64_MAX - bytes); assert(offset + bytes <=3D req->overlap_offset + req->overlap_bytes); - assert(end_sector <=3D bs->total_sectors || child->perm & BLK_PERM_RES= IZE); + assert(offset + bytes <=3D bs->total_sectors * BDRV_SECTOR_SIZE || + child->perm & BLK_PERM_RESIZE); =20 switch (req->type) { case BDRV_TRACKED_WRITE: @@ -1738,7 +1739,7 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t o= ffset, uint64_t bytes, } =20 static inline void coroutine_fn -bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, uint64_t bytes, +bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, int64_t bytes, BdrvTrackedRequest *req, int ret) { int64_t end_sector =3D DIV_ROUND_UP(offset + bytes, BDRV_SECTOR_SIZE); @@ -1780,14 +1781,14 @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t = offset, uint64_t bytes, * after possibly fragmenting it. */ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, - BdrvTrackedRequest *req, int64_t offset, unsigned int bytes, + BdrvTrackedRequest *req, int64_t offset, int64_t bytes, int64_t align, QEMUIOVector *qiov, size_t qiov_offset, int flags) { BlockDriverState *bs =3D child->bs; BlockDriver *drv =3D bs->drv; int ret; =20 - uint64_t bytes_remaining =3D bytes; + int64_t bytes_remaining =3D bytes; int max_transfer; =20 if (!drv) { @@ -1799,6 +1800,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChil= d *child, } =20 assert(is_power_of_2(align)); + assert(offset >=3D 0); + assert(bytes >=3D 0); assert((offset & (align - 1)) =3D=3D 0); assert((bytes & (align - 1)) =3D=3D 0); assert(!qiov || qiov_offset + bytes <=3D qiov->size); @@ -1899,7 +1902,7 @@ static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvC= hild *child, assert(!bytes || (offset & (align - 1)) =3D=3D 0); if (bytes >=3D align) { /* Write the aligned part in the middle. */ - uint64_t aligned_bytes =3D bytes & ~(align - 1); + int64_t aligned_bytes =3D bytes & ~(align - 1); ret =3D bdrv_aligned_pwritev(child, req, offset, aligned_bytes, al= ign, NULL, 0, flags); if (ret < 0) { --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245699; cv=pass; d=zohomail.com; s=zohoarc; b=ObtvkpCK0zJqoW64RrKuB0Osdx81t+vYzNvTxzYHr3KbdzuK3h0UheE34wDsoUqp2568DdEvuyy4YvAdveJggv5km2u8jZ2bnc6qayIqQF0ORGzVTu48Wbi3BGNxPQ1eo9zALXo93AsOpRKSQv4NbzQaVGdlfTTzRaq2Cpoe4Jk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245699; 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=757f6Z3WKwiTY+zFjH1qq38WS6NgsNyUR3fW613bfWw=; b=Qk/v/jmLWQftaqvYIlum1W6cYnLwBCirUVFkUxvt+gVIjC4oerCQkAhkeSiiUbvOMSfb9oyhdy81AuQW9EGYR5HZNBdRnxQ13ATYz8TwFr+nbiB3SemqGbYsSubxB0g3uNA+XZlgHVystyLF69MkbjzaahbuDgYlBpoERPVkmDk= 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 1588245699299858.9822461269666; Thu, 30 Apr 2020 04:21:39 -0700 (PDT) Received: from localhost ([::1]:38958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7G5-00015p-SQ for importer@patchew.org; Thu, 30 Apr 2020 07:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57748) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78U-00071J-Mu for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76y-0005GU-Kb for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:46 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75o-0003SE-9u; Thu, 30 Apr 2020 07:11:00 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:58 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:58 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZwhntE58zyV9lSDa2PVtkRdh6jn/ph5uIpixJwKn4lZV3V1DsYXDIgSzci8KNfINzUfIhuaKA3dLrIgpcvnZ1NQDjrUd4uL2gADQ48Ak/Vyy7mTW1q+bYgGDmdUyCJN6rv8phHwJ9fg2Ptrbl7UAoBOH3Rptd2I9eofG3z3QlZdVHSJBpg86JZiPBK1auvUz5XgzOAU6wfaatt8twMxTQyuW0VDAnIpDPOgzBKB/ujrfzCw1yOJfioVbnCdG54RtLT8/KIX8ofhjYBAKQtJrGxGJuR4KXKwRul18s4b2BK4+09zjbZ5oVF0WwsgwNednZZHKeQVc0CnpN05XFc1JHQ== 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=757f6Z3WKwiTY+zFjH1qq38WS6NgsNyUR3fW613bfWw=; b=AbfwsSK3/OGIw8n57tMG48CX5v67JmTTg8I0T0M3YKjbCTMMMtwFoqP/TuZJj9PCpO8SIb711xlx9E49SNZWrFZdeH5tkaGjt+bttunMNUee834mzqEb149HMHDhcjLXTFek6PO4IkwpaL1M3Ajf6BJjKIGwfNUA+9yLhxwjhykZV79z0mRWtGRRB14Ion+ukTX/ey9ki6ZTuN7G3e6Sp8JL4lVVXn5H+Iw3dm0vwQS9vftQz4C6jsl7trOhT2XGqIT14tMdUT+C6BR6gfDhMgzQS53mz26KZlz89MCHFd9FOFTKRyKMRTW/1isIPSO+1MQNg26L7IOYro/4w82JLQ== 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=757f6Z3WKwiTY+zFjH1qq38WS6NgsNyUR3fW613bfWw=; b=oAk4ViQ+kx/7OCS3g/2xN8elDnq448EyePo6PwhPxGIiqE1uBkMBqAI1KwqdtYVRQy3+6xSEVWjXQ/gC++0K4mPreyqkg/PrreivKK4HuUyz5suWK2WUvuqm4H6+pTHLnO4YmwAodqAp4DQzzXCjAs4NOaWz1JL2te4TYXDNHd8= 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 v3 07/17] block/io: support int64_t bytes in bdrv_co_do_copy_on_readv() Date: Thu, 30 Apr 2020 14:10:23 +0300 Message-Id: <20200430111033.29980-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8642500c-2b08-44bf-6389-08d7ecf728d4 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:590; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yOPr7ViXI0QrfW4YXIoWRevjcKasVIAyhvE93201K8IhTaJwwCnSisavaZRv8bTrO44C0PpbfWYJVamu9TyK/1zxmiz/QQfG6cG8aKBi7DA/9mEwW94PapFd4rKX2txlDCqSTPDHc0jOCCO6+X7bdhdmgdKDH2lTFbrj4TFBkzcg3Ozr5Kdf93W4PXh9D4vSBJYxpk5cYFCEiyW2f1o4FM17tkn1/KJGsl2SrA+pOZY3xNalxvk5olynOa2lLlFXBWQMJeZlfUTkKAKVotXqlzwNZZTuzXJt6A38UDwE1ScGAwn5w40mZTCUZvs/gnJx8mD+SuBa09OBoFPFpBdFd+NoU0w+CDG/qzgp/lg3Z/AMasECd7Q50qdpgwDQHmp8lr2vnjL7FYGI2jBEG0uYQEVVXfwyQYfSvNsbbmdJ+kfd4rBtrf9H2bohRc0Ckm3A 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)(39850400004)(396003)(366004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: rUIMgvGlMWpbSRt0vsojJqEhOUolOZBdvyFBPc3aalOYM2PqQdSokXJsmuzBKjizcosumKi7gP6Klrvic+8BLD927VIoIu1nldvdICN6a/19NMIsq+8cy/7GFj6RFEQRW/1zLt641FKvf2wIhMNisEK0G/ROx7r6qaAzgu6cwLJjK6K9Go8DT9219A0yLXPF5aUXRPth6WXZxS3jS8W0n7WMqVr5hUsQwOT9qAK/jVl3dEFda+9lBppQN0IS8xte/3bk8ZYnwt5MMVpkpH2dIHx8MUQ6oTqWEn+OfXQhW5WhW51g8Qbl+S6NByh+RDDFT60Oh4tdI1BaiZx2c0wThs4q7K33QjQ1+7IfUfFgVlk0bjgO4vjn/zz7gJSSucrr5Z+gx9WFcGQZ5xA8GhJWVtGYllXLu5cfwnFcxvuoKhGjNRvVWDY804ChC0/MVKVoWxmm6dblS9zymFdWq/ywyuIKIZ9Q3M8KvSMwRXeJ/HOexu1YTR5OJA6zqF7phbdl8IzQdrYcx+fhwjTRRl8OR7mVJToznh2IQGtC3QEZgqj4tS5H49lzLqcvWQ5EplYOyKo0n57w2nzjiBT257ZO+WtjaAt52GNSlOzsxeC2fLVxjBzR+E6K6kFzirZSxSZ0fZ0fYZW62i5Yle4wln8qbqfXc/RvtMGzVj2h8sKh5ahW6jbKhnms5TTqqOle7iEOCPEeL5bqt8rdJHsCfQuJN0nwklUUB6NDwu3hOyHB86wFgOI7pNBKOvBQERhqxuQ33bYK0uG7jBCxnEUV2wnrWoEAtl1d4MZkKCQNdlOy2pA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8642500c-2b08-44bf-6389-08d7ecf728d4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:58.3952 (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: fvw2LldEefjkBFJyGC22ROXeCkn/Dg1mlk3zl/aM5LohIkbfXBwoqzDyPvjHC3KIctW+8b/HoYnql/SHVBt4bbRsZLn++YzZ1eX/MYziVDw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, prepare bdrv_co_do_copy_on_readv() now. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- block/io.c | 6 +++--- block/trace-events | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block/io.c b/block/io.c index 8bb4ea6285..6990d8cabe 100644 --- a/block/io.c +++ b/block/io.c @@ -1088,7 +1088,7 @@ bdrv_driver_pwritev_compressed(BlockDriverState *bs, = int64_t offset, } =20 static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, int flags) { BlockDriverState *bs =3D child->bs; @@ -1103,11 +1103,11 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(Bd= rvChild *child, BlockDriver *drv =3D bs->drv; int64_t cluster_offset; int64_t cluster_bytes; - size_t skip_bytes; + int64_t skip_bytes; int ret; int max_transfer =3D MIN_NON_ZERO(bs->bl.max_transfer, BDRV_REQUEST_MAX_BYTES); - unsigned int progress =3D 0; + int64_t progress =3D 0; bool skip_write; =20 if (!drv) { diff --git a/block/trace-events b/block/trace-events index 29dff8881c..179b47bf63 100644 --- a/block/trace-events +++ b/block/trace-events @@ -14,7 +14,7 @@ blk_root_detach(void *child, void *blk, void *bs) "child = %p blk %p bs %p" bdrv_co_preadv(void *bs, int64_t offset, int64_t nbytes, unsigned int flag= s) "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x" bdrv_co_pwritev(void *bs, int64_t offset, int64_t nbytes, unsigned int fla= gs) "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x" bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs = %p offset %"PRId64" count %d flags 0x%x" -bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes, int= 64_t cluster_offset, int64_t cluster_bytes) "bs %p offset %"PRId64" bytes %= u cluster_offset %"PRId64" cluster_bytes %"PRId64 +bdrv_co_do_copy_on_readv(void *bs, int64_t offset, int64_t bytes, int64_t = cluster_offset, int64_t cluster_bytes) "bs %p offset %" PRId64 " bytes %" P= RId64 " cluster_offset %" PRId64 " cluster_bytes %" PRId64 bdrv_co_copy_range_from(void *src, uint64_t src_offset, void *dst, uint64_= t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offs= et %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" bdrv_co_copy_range_to(void *src, uint64_t src_offset, void *dst, uint64_t = dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset= %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" =20 --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245691; cv=pass; d=zohomail.com; s=zohoarc; b=Uf1q+DeqtY4oAwENIKMb/4htyTAnzKOhPirAFcR1D68JTz3La0ITxg4HH1Kw+SdFpJWyfIl3c9Q+XNPPHbV6eSHsOir4ySXPgq0NfdT/ZKtOnU9WL7eg3A4QZsUx0c2pIGK4yQ1E8+OAYbPV5RkhvmSFeu7G8JMabiyLIuTfHwg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245691; 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=7gjOK5UxtXkqcOWzEXiwz6TmFN33jXxQX9IKNw+i2bE=; b=TGYyywg3kO4NdXkr1HsrxcGUISZrZNqkh6vS98hMjc7QHafUrUPE9caIDLBYtuLutNd5BCOY9NBN3ugVJgEvRX+xuLbtdeWFM4qefpms8+W4/Y4Cc1AsOmPxKsU8e2cYeldMN4ji2XViaK3iltXKORiZGPedjmN/fl3ybvskA+o= 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 1588245691790927.4901479987467; Thu, 30 Apr 2020 04:21:31 -0700 (PDT) Received: from localhost ([::1]:38304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Fy-0000pc-4S for importer@patchew.org; Thu, 30 Apr 2020 07:21:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57752) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78V-000722-5D for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU76z-0005Gc-Eb for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:46 -0400 Received: from mail-eopbgr70099.outbound.protection.outlook.com ([40.107.7.99]:12710 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75p-0003SE-Dr; Thu, 30 Apr 2020 07:11:01 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:10:59 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:10:59 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:10:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JGFmKQ3qpPkTsuZpo5ti5Akc5DwQmm2qiAHMikZt8Dd4ER/BwcWEKq4IYgvzTCULKEfd897YzlURoPiz3tt/3PgTGPYLYnXAChaTPeu/BXKElLGpAXS+pDZ0BvQrRlPAS9oEhRuAvv3ljCJfqHYzW+4hp40rOPLFu7fCU2RTUHxI1OhHIe9bWSVEZDN4xgpuC0BJ+Le8I3t8mCdXp9ekDJeSbDIA70K9wnA+NBIBfDM8mQXxbWV5t5HkjK+pMvtIZF6Xj8HoMfSE4r73KPMWZQ3yVNxRGqCX0GtR2BExoijn3KbBlUjRoBQBqwEse3zruFNxWE0sRd/8q5j2VENlIQ== 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=7gjOK5UxtXkqcOWzEXiwz6TmFN33jXxQX9IKNw+i2bE=; b=BoPfSVpQgy6xUZ4RZOxWsrDbc05qGnxO02b8kmoFtGs2heAUUy3QWK98jt2bxvfxur7ZurBu/FxxG+3W5IxuMOgUB2E3XvibuGkDa9PN4jhhD/dG/XwzQBrgP6MAVWmkppVjjFvqssVHFBUOjM6n932mDeVPdBFztxoLqYItWE4PR/a7e848mrPalUsj9p3BhhBGvkI5L9p0VrND7NVha66S/LL+4bTuC8fCTOb2m3/DCwaqlq1HYjQh5tipz4TlYtII/1eotNN8IkVwEzV5otnMmdkhTb31BNxEp+MaTZCdwbTcaYugRZM6zr5G8O/bflF8C+xOAp2HjbGrVS5hCA== 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=7gjOK5UxtXkqcOWzEXiwz6TmFN33jXxQX9IKNw+i2bE=; b=mpQZC1I/sZ4Yi8SBY6GZiKk3As7pSdPN0wiWMa2pJ5rJ0mQXGwf4HUwbk2y6lC0vCyFayToGq3DQoayaue4P6iLrVU7B6xk6dxRrofbIATZJZCoifkanlaa7MU0MnnMPyNyvWsnAegMOnQDa7lKV3NJdyCAEqgd05ONZyxg/9SE= 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 v3 08/17] block/io: support int64_t bytes in bdrv_aligned_preadv() Date: Thu, 30 Apr 2020 14:10:24 +0300 Message-Id: <20200430111033.29980-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3cadcf58-0e35-4516-1bb6-08d7ecf729b3 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1388; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kiZYm1zDkvmiU7Sf7SwoslBAbQIO8ZshrTuWZiwKZzMtw8UCJfpRuzB96Fisw4I4TCQow02G5ogXAZDtsx1dYREfzlJgNQskwpRlLF0/yhaEkfcWUqKMMRhnGbXA54IcZatuUDVqAhiscpa6VK7hlNmfqAk2WQlnb7wdo/pSSKDXOREBWgHI66f3vUPH4O/MaPnIhb3ByB+2mDZvoBhQd5+qLUkc7/34Ilg6YqYad+KMbjtgFW5kvqoSFS826LifrYjTqllNokI9RPJm5jsabwpNbNfIlbF5HjGIXHpvNnHBnO1pUmGaGQGnFc9Q84PYn07xg0jHdBCYMw9a2B47i1lSdohjWXnvo2g6OjW6i2H3hZ/QcKVvIVsjMITEtYr7dUIZHjts1wSHP3wFjvOdg8gtkrJG/6iSEGl+yuoCMTGc8oDd026X9PAuEiAw2e0r 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)(39850400004)(396003)(366004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: T+NqZq7MuR6q9zqz6YTylLaTp8jnfBct2Q3XzlquL04EVrEkk2hL2gjswZ624u9yEzSz4c8HjGp2Oc/+YfFwlKLK+zc9dG9aWTM8phP/1BAquu/r3zDHKA4U2i761zhvylKXD3fYDf0BSP9rgJtf+5aC+Ld0aDR/uOkGAHK2yMcw83MQLglE9C8kcB+5P76Ac+QwLMabR4ZprnAFsqBqpqE9qqMWHm2sYJZ0PvcuNMuG9QGfwd8gWJ2tJwJ7V78+0BHcLkW4BUrct/RaZcGrmOysvEMvEgywinSIj4dCMhrbiY6/QwbcttVGSZ5maVZDCdGrP37YnX9P+YwvYVbrzMXyI7lFogFFS3FpwfDNkMoyFoBAQfTMpEA2oCzLXxT0UkYz9JDKC1TCLYR5VXEcW6tp2MbnuyZOAQJe9CmYLXMGPnuxZkLUdVl+dDVMc3bKq7qmZRBHOk0A9OAsmaI4eZ5Ufz93tRtyJmnAUMZyQIfOLGDWeNqArSpPjWgMkdo2dHpdwTRIRqwSmggGM9V1Cix9h+VS2+ma9ulrxLK5/QhBiB16Ffpro2lNPCJ/SCQqHwsp1gdiSSwuMUsdJGmVzixtz4Zp8ZUQSdQEkj3O3k4McGnBLQSeehN1lxOmgHgCi7xzxUQwH5YDsNGvQ7Xi8cgeRWMsUob0RUGpRkT5Rrl64abNz6zulv2hG5f617HRRbg2o1Scob2Is0zJmvISqPAUltzMEs7xc0sR3+LbhTOq/SrfHXw0aGAnpt1jJBTqYz3a5OuVgJ+vOUcJybBaOyKNlkCzhBb1IDbMnvNCRuQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cadcf58-0e35-4516-1bb6-08d7ecf729b3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:10:59.8618 (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: als/fOD1IDGfPHLfOz8/91jUOvDa9FevX7DC0o8slwQgKiGcIwNHCfU7u23lJRcsSU+Q1jaAhnUM0tRjcmln4qU1+mrRGpYQVDOtu+GGZjE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.99; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:10:48 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.99 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, prepare bdrv_aligned_preadv() now. Make byte variable in bdrv_padding_rmw_read() int64_t, as it defined only to be passed to bdrv_aligned_preadv(). Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- block/io.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/io.c b/block/io.c index 6990d8cabe..d336e4e691 100644 --- a/block/io.c +++ b/block/io.c @@ -1250,16 +1250,17 @@ err: * reads; any other features must be implemented by the caller. */ static int coroutine_fn bdrv_aligned_preadv(BdrvChild *child, - BdrvTrackedRequest *req, int64_t offset, unsigned int bytes, + BdrvTrackedRequest *req, int64_t offset, int64_t bytes, int64_t align, QEMUIOVector *qiov, size_t qiov_offset, int flags) { BlockDriverState *bs =3D child->bs; int64_t total_bytes, max_bytes; int ret =3D 0; - uint64_t bytes_remaining =3D bytes; + int64_t bytes_remaining =3D bytes; int max_transfer; =20 assert(is_power_of_2(align)); + assert(offset >=3D 0 && bytes >=3D 0); assert((offset & (align - 1)) =3D=3D 0); assert((bytes & (align - 1)) =3D=3D 0); assert((bs->open_flags & BDRV_O_NO_IO) =3D=3D 0); @@ -1315,7 +1316,7 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild= *child, } =20 while (bytes_remaining) { - int num; + int64_t num; =20 if (max_bytes) { num =3D MIN(bytes_remaining, MIN(max_bytes, max_transfer)); @@ -1416,7 +1417,7 @@ static int bdrv_padding_rmw_read(BdrvChild *child, assert(req->serialising && pad->buf); =20 if (pad->head || pad->merge_reads) { - uint64_t bytes =3D pad->merge_reads ? pad->buf_len : align; + int64_t bytes =3D pad->merge_reads ? pad->buf_len : align; =20 qemu_iovec_init_buf(&local_qiov, pad->buf, bytes); =20 --=20 2.21.0 From nobody Mon May 6 00:47:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail (Bad Signature); dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158824581742879.20563587605295; Thu, 30 Apr 2020 04:23:37 -0700 (PDT) Received: from localhost ([::1]:47526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7I0-0004Ve-1M for importer@patchew.org; Thu, 30 Apr 2020 07:23:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57762) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78V-00073D-SA for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU770-0005Gi-6E for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:47 -0400 Received: from mail-eopbgr60129.outbound.protection.outlook.com ([40.107.6.129]:22328 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75s-0003Xs-7s; Thu, 30 Apr 2020 07:11:04 -0400 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.2937.22; Thu, 30 Apr 2020 11:11:01 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:01 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSaFWrDSZMfzakb8COsVmE+ByOkrQH5n1WtI7hQYS/n0ixv6caCcimub0vPKLHZUlXswHDj4eXKaISA6ZMwmEFFt5INUqUgUpWllMfluFw4iI+eXdWXLRcFx5o2M/RRTGMYkjzhuc0zKAaqxNIxPzl949ttj2VWaOds8Uu5M2P081BU/09hFwwqIOZn5QeGB1Hk/G0IRIYo6cJ8hNE3LfaGu9OP5HBj/y2JBCqmZu5HRFWMvclN06hKDLJp45dqX4Iv2a5SuE7NUh4N6DM1dxu2dQ+FvN4BiEc+03Zkn9qffFzjhg+V4LpqFI3+/AEZGFsxXZYveXQooUxmtsA5dLg== 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=hUkTTDThD4tWgPkpzYZLn22MWCM4YFEnWTss8BuYshQ=; b=DsXLG3wrxxk8570KNN10r6UaQMDpQuFoywaw51qg2CzihFgPBj0tgZBA4LfxBCD9MNsmtu3lO/uYYXe3qF5yXIMhKPz/XjLntkUhn7+YhbR+X4Ec29mVyowxyxGiL4Pul5DmTWf6gUYee9L9NEDJZMy4/UORJxjlh1lVvmPwSace+YF0drrh9a7QhUWEq+z+nOxlV/zA/L+B4mCwzZ7a+5Rjw//IOYd+MPSoS5dN4JJ8p6ZAoC8ctCo3lU8rWHHFkprQ18QXbt+aIpdZwxybpS5X9ffdwSvnuu4w/AzElcIflkSyX4fmoL6RewDNx356Y1Dg9EFlDaedKK+33SG6Qw== 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=hUkTTDThD4tWgPkpzYZLn22MWCM4YFEnWTss8BuYshQ=; b=ZEYU8elH0yDzD4HrDkeFei4ZSmVc/pyodAx+z530ZbHlzPiBgXdIGaxrSXerdK/bxrGxbhAcGvMOE36K8Gk4mWZXj8ZnfX0o8JNta7TQhf3FhWwN3mBUc5yYxHL08BfgyGHH9ctU1H7WlDGfjvXW2/h/K1MhdPKXyOeNxBkGAnA= 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 v3 09/17] block/io: support int64_t bytes in bdrv_co_p{read, write}v_part() Date: Thu, 30 Apr 2020 14:10:25 +0300 Message-Id: <20200430111033.29980-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ddf97130-7f46-4d37-d3e4-08d7ecf72a91 X-MS-TrafficTypeDiagnostic: AM7PR08MB5447: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 0389EDA07F 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)(39840400004)(136003)(346002)(376002)(396003)(366004)(66556008)(6512007)(107886003)(316002)(6506007)(26005)(52116002)(186003)(478600001)(956004)(2616005)(16526019)(66476007)(2906002)(86362001)(5660300002)(66946007)(6486002)(6916009)(7416002)(36756003)(8936002)(1076003)(6666004)(8676002)(4326008)(142933001); DIR:OUT; SFP:1102; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3p1ll+HZDYnbQIFy9/7nql2W2nqo4/TG1KxJ3ZBt5xyhax+WEFqT7+yaoid9tnK/wuhrmOHDKDd4SSVfVkULgmLz8J+GrdiYjVSQsLCxhRmM+tikjGn9QhVT3NI8tpyR1VDEO9cyb/jXFi7ctMH41kU6lzEWXxFPPp0h6roD3Yn5uAqJ7amtIxwLku1CxDo+DoT54egqt8/wSF36T2cG/IXNLm2JgOlQnTz+jPxEmDu8znnNC6k1t0/DwtIofq1APn4DtOaTBilqo5DpSbFD/Gk6KII+D7DXSBMRGvtU5CXBSqNrTdUimrZ36SUwb1JOFrgvahbww0xGlN30EMJYgx5C1sASEMIYFB2Nw1h2lNN4oMOVeiBwDDttwNxYNLDx1Zx9aa64WnDkj5jyxoJSn5gCeKB5vURTrePVT+MrAuWPKAKOioFbKiNpOLQjt3odtZ6r0qeSEdBy4x6Vo5xhBET6aeOIWtnYbopjQWQMI2c4K0SsvrN4UiRVVhRHZCDY X-MS-Exchange-AntiSpam-MessageData: 7PpwTfxPSw239q6I/fPJJbsgSHKQDGeN5ku0RE0o4asfPKrebyYEI1WixJIPSSGeF9IamtC3PJYnxuQYgmD2kdI9vbUe94R/+mkX4Rf9VcNEwFtRCTQ7wCJn+gQi+hSnFqE1Jgv83nicWhLQodjPiY6OcKaycQL1mxVzuJfJcqq2fngP2gzbT7uHBMa1O8NCL3ePf+iT/kC2zJCHQmWT0yDMJkLVB1etSIqXHE8pN1m10hoXpI2I3gl/HObLTfQ/OCRVjTy2ioW7r1J+BK8fMYR5oA5OOx7B/fc3p7nuCqTu3jRpyupCJ6acuymh1B4Tl4mpd0goAKB/35vsDdohrmvjggRe6zvzFkbLb51Z2lRDWh2GY7931VVp04FGmHeILRE0MqzifjB0sg2yQNHn/Qmg1hWA8odgs4lPS9sA2eipwtC2nYViy8Ov4+478Vyl612WZXLxr+v31JIzzCKm0prINt4qqPgEgdMB6k3muEmQh6qD9BP/oLS38/hy9aFvG4xHYhnJAM1hw6ZlOvcbPE3SQ8t1e9ISQGOr4b+R+ReiZ2uXCgPjXxBsuc9nACHnIERyRgDpK1YtncrfPNudS9X4e1nptewl3VyzfVDc24Xfw+Tphpzii1BzFTzmDWhn9E65nX4kvBFvftItSuSLoZ9IgKLwoJABb12vPCm0xvvdiyOIXSGXho15tjDfzptruTjvXu/4md/Zhvt9dEXTbqP+H2CtDnb4XOwjuQ6abHEqVNkiZj/iztCQUX0f+mNX9rB6MfwRRaCrLzTTDU/D3W8XIY+3Pr57LuAXvx6CuVU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddf97130-7f46-4d37-d3e4-08d7ecf72a91 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:01.3582 (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: ltZRwFaBGu8o83Vju7i2V+Uf7rlrEVWMEtZp/opbKvLVEZNtKCfRX9ET8pIqtJxtCxCeIgfNssX0VZAN4vVa6lM8hStpWnmYMJmr/s74AA4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5447 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.6.129; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:02 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.6.129 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, prepare bdrv_co_preadv_part() and bdrv_co_pwritev_part() and their remaining dependencies now. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- include/block/block_int.h | 4 ++-- block/io.c | 16 ++++++++-------- block/trace-events | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index c8daba608b..3c2a1d741a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -975,13 +975,13 @@ int coroutine_fn bdrv_co_preadv(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, - int64_t offset, unsigned int bytes, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags); int coroutine_fn bdrv_co_pwritev(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, - int64_t offset, unsigned int bytes, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags); =20 static inline int coroutine_fn bdrv_co_pread(BdrvChild *child, diff --git a/block/io.c b/block/io.c index d336e4e691..d7fd429345 100644 --- a/block/io.c +++ b/block/io.c @@ -1488,7 +1488,7 @@ static void bdrv_padding_destroy(BdrvRequestPadding *= pad) */ static bool bdrv_pad_request(BlockDriverState *bs, QEMUIOVector **qiov, size_t *qiov_offset, - int64_t *offset, unsigned int *bytes, + int64_t *offset, int64_t *bytes, BdrvRequestPadding *pad) { if (!bdrv_init_padding(bs, *offset, *bytes, pad)) { @@ -1515,7 +1515,7 @@ int coroutine_fn bdrv_co_preadv(BdrvChild *child, =20 /* To be called between exactly one pair of bdrv_inc/dec_in_flight() */ static int coroutine_fn bdrv_do_preadv_part(BdrvChild *child, - int64_t offset, unsigned int bytes, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) { @@ -1524,7 +1524,7 @@ static int coroutine_fn bdrv_do_preadv_part(BdrvChild= *child, BdrvRequestPadding pad; int ret; =20 - trace_bdrv_co_preadv(bs, offset, bytes, flags); + trace_bdrv_co_preadv_part(bs, offset, bytes, flags); =20 ret =3D bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { @@ -1562,7 +1562,7 @@ static int coroutine_fn bdrv_do_preadv_part(BdrvChild= *child, } =20 int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, - int64_t offset, unsigned int bytes, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) { @@ -1866,7 +1866,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChil= d *child, =20 static int coroutine_fn bdrv_co_do_zero_pwritev(BdrvChild *child, int64_t offset, - unsigned int bytes, + int64_t bytes, BdrvRequestFlags flags, BdrvTrackedRequest *req) { @@ -1941,7 +1941,7 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, =20 /* To be called between exactly one pair of bdrv_inc/dec_in_flight() */ static int coroutine_fn bdrv_do_pwritev_part(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, size_t qiov_of= fset, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) { BlockDriverState *bs =3D child->bs; @@ -1950,7 +1950,7 @@ static int coroutine_fn bdrv_do_pwritev_part(BdrvChil= d *child, BdrvRequestPadding pad; int ret; =20 - trace_bdrv_co_pwritev(child->bs, offset, bytes, flags); + trace_bdrv_co_pwritev_part(child->bs, offset, bytes, flags); =20 if (!bs->drv) { return -ENOMEDIUM; @@ -2009,7 +2009,7 @@ out: } =20 int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, size_t qiov_of= fset, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) { int ret; diff --git a/block/trace-events b/block/trace-events index 179b47bf63..dd367a9b19 100644 --- a/block/trace-events +++ b/block/trace-events @@ -11,8 +11,8 @@ blk_root_attach(void *child, void *blk, void *bs) "child = %p blk %p bs %p" blk_root_detach(void *child, void *blk, void *bs) "child %p blk %p bs %p" =20 # io.c -bdrv_co_preadv(void *bs, int64_t offset, int64_t nbytes, unsigned int flag= s) "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x" -bdrv_co_pwritev(void *bs, int64_t offset, int64_t nbytes, unsigned int fla= gs) "bs %p offset %"PRId64" nbytes %"PRId64" flags 0x%x" +bdrv_co_preadv_part(void *bs, int64_t offset, int64_t bytes, int flags) "b= s %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" +bdrv_co_pwritev_part(void *bs, int64_t offset, int64_t bytes, int flags) "= bs %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs = %p offset %"PRId64" count %d flags 0x%x" bdrv_co_do_copy_on_readv(void *bs, int64_t offset, int64_t bytes, int64_t = cluster_offset, int64_t cluster_bytes) "bs %p offset %" PRId64 " bytes %" P= RId64 " cluster_offset %" PRId64 " cluster_bytes %" PRId64 bdrv_co_copy_range_from(void *src, uint64_t src_offset, void *dst, uint64_= t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offs= et %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245940; cv=pass; d=zohomail.com; s=zohoarc; b=Vq/yiVpF2WkTk/NbGS9qiWc/r3RMiLB2MpIj4KIcZYvtYtEtkjftrsI05eK0Sw3cpvH9M084tkLEOlOycHSrfvPEhkGaSJ1YYDH4Keu2aDbT9JtuTcbXyeYgpxJMkEOW1WAyIf4j2nAYuVgH9AS36nX0cRBFvb3mHOiNBEF3V04= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245940; 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=qFCFonnyj2ur+Ohf+6JgB7bHgAgqHjZJlgG6pCgp5BI=; b=mUsRRb9C15u1wuSxi4peuNYQ5/HSquxfyeKBxYcUgIaKDrl8+qVU8/mqDdGEDYnXbb+FSBxfbcLrXtzeFSgnkvIGfcJfnOchJOlP2vbAmaIltuZDA0etZRj00QV2W3EArR8+jmUOfFd0NPwQ60n9a/3M0foxkA62TjF7IUGfncE= 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 1588245940092484.1915494724991; Thu, 30 Apr 2020 04:25:40 -0700 (PDT) Received: from localhost ([::1]:54894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Jy-0008O5-K8 for importer@patchew.org; Thu, 30 Apr 2020 07:25:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57768) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78W-000759-Ji for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU770-0005Gq-Uy for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:48 -0400 Received: from mail-eopbgr60129.outbound.protection.outlook.com ([40.107.6.129]:22328 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75t-0003Xs-6H; Thu, 30 Apr 2020 07:11:05 -0400 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.2937.22; Thu, 30 Apr 2020 11:11:02 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:02 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Htbju1lOhFWDzlt4R7HSFTCS6f5Vk6Odm/AHL068JmcTO7FW7Uj2Xiwe5qrJN0p4Oow/+7P1Y9xzw0RxEGq4VN9fgO0+rLXS0YLOC7J2Pm5gvt2T4T4ubLq7z1R1jP2n+D4XDmBGDTHEaX96OZt0g4qk7s6bwAFS9TN38GiX+rJltfjMlCshR0kfTqG8dej3Kt+X67s+AYS57l6XzIhy/+wu/4V1mYOed97CxYb8Mjk1TX0k+34t+L3ksIlncTB8Fq8Vwrf7arYxKohBy+mbZ3N0l97HdDVqOghOpTzEgJoeW8jknDabooBRw5WELXMXrplwfCUtYkq3izko24GADA== 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=qFCFonnyj2ur+Ohf+6JgB7bHgAgqHjZJlgG6pCgp5BI=; b=NN7iKxMiWcDQJbKJZwiWYdJnYO5kdJWt3PFrfE7Nxgm6cuBidLs3FYZ2cc5REckFepPErNf/etBWOthrdPYDNXqMpL9+81lQv4ZEmKICs0MwkhlW7r8ZWKcCPEm0NsZ5xjldTRZDwI+gUHVbo6f1gkdkFh9e0KiXzED/wMcO9FXZz5kngrZAtVjdv577UPJGzq4bY6YmfChj1cjdzXGsoys8CyVuU9dKthIngpLVnu57ovkyUbvrlJoIw1rBI1KljpdEu/SRC0oQRF0IN0Cy3AfdItMhkw4aX2n7xljHVLPnX12eLput6oVAbRwcVth1Uh/4ORlWv3Az7jKNryQV9g== 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=qFCFonnyj2ur+Ohf+6JgB7bHgAgqHjZJlgG6pCgp5BI=; b=MS2oPolhDw81Tpt2j4Ko1fzK+/I+xDxwuqBKHoxpFKBHNMJdk0XUGiXsJ4IK3Kk08c+h3R9aoG0qHKkWzMwA8T+znUKY6uuwLobLeM5jfaoYkEdEaVZbgvYq8jis6IVyuwkSm8iba6HXQ6QavocW1a1AiB0V145W9QKGQQSByAU= 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 v3 10/17] block/io: support int64_t bytes in read/write wrappers Date: Thu, 30 Apr 2020 14:10:26 +0300 Message-Id: <20200430111033.29980-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d87cfd9-07a0-4b1e-f763-08d7ecf72b79 X-MS-TrafficTypeDiagnostic: AM7PR08MB5447: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:972; X-Forefront-PRVS: 0389EDA07F 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)(39840400004)(136003)(346002)(376002)(396003)(366004)(66556008)(6512007)(107886003)(316002)(6506007)(26005)(52116002)(186003)(478600001)(956004)(2616005)(16526019)(66476007)(2906002)(86362001)(5660300002)(66946007)(6486002)(6916009)(7416002)(36756003)(8936002)(1076003)(6666004)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NxLYp2j6GsqnyRx/hj4xn4c3lhAFH3pP6CjRvA7MvgyXsRuqeAd1h7UwRYCBAxiCh1nNQbznhaf5sYeHkS8u1yuN4DO2Rl5rxaCVD1RnGBC/JE7Scuh9tc/fUFK4TR2xRYX592Z1lJTWj5uU2JW7mZtFgJjJq/mdxb7KiHaUvlomj4RCUTxaz4VDp9qfRLuq7Ox+Y+3k0gmG01aUn88APaHtGY5rHKZQfaglBfyX8G0CytvB3Y1Bsdf97LmlDVlZYlHQjDcw0uFpFOctzOqSVyKDBYxAdAa1SPU8IB4TgKnrPHkn72RGlGXOPuGHmXWuHkMypv60qUV1K0S5E1fHd1mosXK3HV3hEvu5FAJ31o3mMD8t9u1O6bKE8o81xs4dvlpv7HdQD7zhglIZllagnUVtw9GubvU6A9wjN92NfLvhWUU5T7qi/miZVjprnoN0 X-MS-Exchange-AntiSpam-MessageData: 30Q/nxD0FgykoMNhjO9iEOr+36TXY/SY9uHgKDZFy9SutEhN0Pif+yemRl4lRWzWgd9DiVnMSeafzpeb7EZDOVSlHq6v7LoxYeorNfsc77uRQYr8yB96zvMTv+FCggDpFNOCsvj7pLN1irLJlmQ6uJan0U67DbE/TIw62mTx8SbtIiNzA1zxNfRjj7q92G/UczXpc29/0Pq6SLXVfnqJXq+ky21BuNH5fBh0rnBexT9xyMIH0jCYXW34FGXapTDTzeDvoDI4UmqSSCg+xQHC/6M7sBQn0AfbirK9LLKyDG76xbYzEWJ8JYmXnFWq/i/nn7A0uB/2G0Q6TK1/NcV9pgoJLdDaDkgB9qcH+T/Vhz1ZULVQJjjxC18G0rJD8MB91hRuh4hN0lS6NYPo95M5ewx7p493Ni1E/vobnPFFtSpnTU8UJXZ/GGRo/U7PjJ64jUCjNMOAWDSie2VbPoT6Oecx5fPV64QdigrqJ3MEdwqr0wgmJ5ON1Zd258CZPpFxfk2oFttneE4hHwxaPheSno4ZIl5camO41SCkVT72+XRDB7QYC7mD0hsRPNDNIb2uu6Ev61yz+LlWnJBxR0Iu1sZyvsxo2VNEev9hgRY6zh9Ji3VLgoe5/wL21I68qMZBvpSrmjmKOikPbpLY4WdWr6qghc0ivfURaPf+H2FSCaWlN2nHKclw9x/gLAyH2J9PM5Xq+yBDUs7GbGE5vPeOGIb7UuQROvJ6jlAkB3RoSD5BVKBL9FfxZE0Gx9VgjofTZTlO1qQgBYS6lD6MoF/Kl0M4tpo1AkWDCO+DVex+IJ4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d87cfd9-07a0-4b1e-f763-08d7ecf72b79 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:02.8596 (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: hlt/nRVT39se/FAC7Bs0ookBSLuEBUhJGjDRY5FWuk3vFC7zA6dU24pFKpAv+68arxGbZcGiulD6NqVBpEMtjBNBDPH/+tD/akNfIpFkCk8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5447 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.6.129; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:02 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.6.129 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). Now, when bdrv_co_preadv_part() and bdrv_co_pwritev_part() updated, update all their wrappers. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 11 ++++++----- include/block/block_int.h | 4 ++-- block/blkverify.c | 2 +- block/io.c | 19 ++++++++++--------- block/trace-events | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index b05995fe9c..1688e7fa55 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -318,14 +318,15 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, void bdrv_reopen_commit(BDRVReopenState *reopen_state); void bdrv_reopen_abort(BDRVReopenState *reopen_state); int bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset, - int bytes, BdrvRequestFlags flags); + int64_t bytes, BdrvRequestFlags flags); int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags); -int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int bytes); +int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int64_t bytes); int bdrv_preadv(BdrvChild *child, int64_t offset, QEMUIOVector *qiov); -int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, int byt= es); +int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, + int64_t bytes); int bdrv_pwritev(BdrvChild *child, int64_t offset, QEMUIOVector *qiov); int bdrv_pwrite_sync(BdrvChild *child, int64_t offset, - const void *buf, int count); + const void *buf, int64_t bytes); /* * Efficiently zero a region of the disk image. Note that this is a regul= ar * I/O request like read or write and should have a reasonable size. This @@ -333,7 +334,7 @@ int bdrv_pwrite_sync(BdrvChild *child, int64_t offset, * because it may allocate memory for the entire region. */ int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, - int bytes, BdrvRequestFlags flags); + int64_t bytes, BdrvRequestFlags fla= gs); BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *backing_file); void bdrv_refresh_filename(BlockDriverState *bs); diff --git a/include/block/block_int.h b/include/block/block_int.h index 3c2a1d741a..b4b42d0cd6 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -972,13 +972,13 @@ extern BlockDriver bdrv_raw; extern BlockDriver bdrv_qcow2; =20 int coroutine_fn bdrv_co_preadv(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags); int coroutine_fn bdrv_co_pwritev(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, int64_t offset, int64_t bytes, diff --git a/block/blkverify.c b/block/blkverify.c index ba6b1853ae..667e60d832 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -31,7 +31,7 @@ typedef struct BlkverifyRequest { uint64_t bytes; int flags; =20 - int (*request_fn)(BdrvChild *, int64_t, unsigned int, QEMUIOVector *, + int (*request_fn)(BdrvChild *, int64_t, int64_t, QEMUIOVector *, BdrvRequestFlags); =20 int ret; /* test image result */ diff --git a/block/io.c b/block/io.c index d7fd429345..7564153dbe 100644 --- a/block/io.c +++ b/block/io.c @@ -1507,7 +1507,7 @@ static bool bdrv_pad_request(BlockDriverState *bs, } =20 int coroutine_fn bdrv_co_preadv(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { return bdrv_co_preadv_part(child, offset, bytes, qiov, 0, flags); @@ -1933,7 +1933,7 @@ out: * Handle a write request in coroutine context */ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, - int64_t offset, unsigned int bytes, QEMUIOVector *qiov, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { return bdrv_co_pwritev_part(child, offset, bytes, qiov, 0, flags); @@ -2023,7 +2023,7 @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *chil= d, =20 /* To be called between exactly one pair of bdrv_inc/dec_in_flight() */ static int coroutine_fn -bdrv_do_pwrite_zeroes(BdrvChild *child, int64_t offset, int bytes, +bdrv_do_pwrite_zeroes(BdrvChild *child, int64_t offset, int64_t bytes, BdrvRequestFlags flags) { trace_bdrv_co_pwrite_zeroes(child->bs, offset, bytes, flags); @@ -2037,7 +2037,7 @@ bdrv_do_pwrite_zeroes(BdrvChild *child, int64_t offse= t, int bytes, } =20 int coroutine_fn -bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, int bytes, +bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, int64_t bytes, BdrvRequestFlags flags) { int ret; @@ -2109,7 +2109,7 @@ static int bdrv_prwv_co(BdrvChild *child, int64_t off= set, } =20 int bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset, - int bytes, BdrvRequestFlags flags) + int64_t bytes, BdrvRequestFlags flags) { QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, NULL, bytes); =20 @@ -2118,7 +2118,7 @@ int bdrv_pwrite_zeroes(BdrvChild *child, int64_t offs= et, } =20 /* See bdrv_pwrite() for the return codes */ -int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int bytes) +int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int64_t bytes) { QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); =20 @@ -2148,7 +2148,8 @@ int bdrv_pwritev(BdrvChild *child, int64_t offset, QE= MUIOVector *qiov) * -EINVAL Invalid offset or number of bytes * -EACCES Trying to write a read-only device */ -int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, int byt= es) +int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, + int64_t bytes) { QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); =20 @@ -2166,11 +2167,11 @@ int bdrv_pwrite(BdrvChild *child, int64_t offset, c= onst void *buf, int bytes) * Returns 0 on success, -errno in error cases. */ int bdrv_pwrite_sync(BdrvChild *child, int64_t offset, - const void *buf, int count) + const void *buf, int64_t bytes) { int ret; =20 - ret =3D bdrv_pwrite(child, offset, buf, count); + ret =3D bdrv_pwrite(child, offset, buf, bytes); if (ret < 0) { return ret; } diff --git a/block/trace-events b/block/trace-events index dd367a9b19..13ad9af0d8 100644 --- a/block/trace-events +++ b/block/trace-events @@ -13,7 +13,7 @@ blk_root_detach(void *child, void *blk, void *bs) "child = %p blk %p bs %p" # io.c bdrv_co_preadv_part(void *bs, int64_t offset, int64_t bytes, int flags) "b= s %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" bdrv_co_pwritev_part(void *bs, int64_t offset, int64_t bytes, int flags) "= bs %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" -bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs = %p offset %"PRId64" count %d flags 0x%x" +bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int64_t bytes, int flags) = "bs %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" bdrv_co_do_copy_on_readv(void *bs, int64_t offset, int64_t bytes, int64_t = cluster_offset, int64_t cluster_bytes) "bs %p offset %" PRId64 " bytes %" P= RId64 " cluster_offset %" PRId64 " cluster_bytes %" PRId64 bdrv_co_copy_range_from(void *src, uint64_t src_offset, void *dst, uint64_= t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offs= et %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" bdrv_co_copy_range_to(void *src, uint64_t src_offset, void *dst, uint64_t = dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset= %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245704; cv=pass; d=zohomail.com; s=zohoarc; b=lvArO/VX+Q/G1snPqPzaCK/I94hfz8J/JrT3MyeN+Rl7MMFiwtVklJ6r0wt23FW1r2QzcwMcPmnv0ZCHe08Y9uzMY22FdfDFqR0NYzJocTDl2dzlObXQVN/U6YpkCqbxYgMh7P8EtpeHe0ttvZxvBN5I3o7WaqfEIjcn+n9BPR4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245704; 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=IoKXATxQwNFhW5mgkUoT6ST4SlqHyD6XpHb/VQY54iA=; b=Y2BFT8edJ78b3jxTWJBG1M+rszALQPaqqeMpnMAyAFbpFM17n74iHJhIH9iPHYoVi0V/pkJUY/mHWBYbnit1dHJpYF7y6WLz/k13KPkb2MnODr618vcSWTfAvXKtP525VNOny/A8R8NmsJxieto2xZShUyGbHlW/AAYQKifqOfA= 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 1588245704568693.4852227080805; Thu, 30 Apr 2020 04:21:44 -0700 (PDT) Received: from localhost ([::1]:39478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7GB-0001Id-41 for importer@patchew.org; Thu, 30 Apr 2020 07:21:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57772) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78X-000767-7s for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU771-0005H0-Mx for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:49 -0400 Received: from mail-eopbgr60129.outbound.protection.outlook.com ([40.107.6.129]:22328 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75u-0003Xs-6R; Thu, 30 Apr 2020 07:11:06 -0400 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.2937.22; Thu, 30 Apr 2020 11:11:04 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:04 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GQEK/B6v/AghkRJ11TLmn0gVi1p4reKEOO/DTqufBPMBethx4oxX43AmKYk+UQBAFOPSDqAWJ6xnlHUEHrbgpWWJEoiZ+BY7W2fIMvafjaTH613j3t0L3XeR5dWP/DY0JpDjWPPXkgeEGaicnGAD7CGm5k8aIvQ6lpp4rp9LxRKnearShiaOSETwc9lEerX7vgkdN2Cic9B/5r2DcxqFdyW+7bH16k4Y44iaheM/apQKYy6UPGAL3KtlxEIkTD1qDG99aMh/TjxmUiiTJS3TwUHJoVOGHh9r5wOBAIZg8R45bwB3mhnEGcTs/0odd/G0g6QJ4MKz1mOaZAinofmykA== 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=IoKXATxQwNFhW5mgkUoT6ST4SlqHyD6XpHb/VQY54iA=; b=eKkRMgc/EPJV4KjUN9b7TFdOSfPKGbl7I49MkHCaZjL/wD4DrQeB/GPqFg9vSr44yeuVQIbcCV8nwJFmFKF9E7WT0v3lyuJ6WWfmoz/U9cywWOkRHZC1WSNOvTBInhFQtIqRW7OWfpFpphT8jU4pUpVAbEBza0mAZyZSh+uKDwdGTwp65nEsy0kgBaIJEONqL1FOgKQZ+t14tPxd6XgpESoxu5Sa2DE50pufWMgydwMfeb8CWgvLlZhTTs33oblueWoC8CuvoO6n9AxFxqAyThMveBX4IodG7iuhpZz2qDZ2fSYgR8EZO3UP9rAEtDlBd570rX/1Rjxrqt3dCqH0tw== 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=IoKXATxQwNFhW5mgkUoT6ST4SlqHyD6XpHb/VQY54iA=; b=KGaT3AdAO4z6lAyVkxJsB5/FiFO2Xq8o2oYvjcKNto95Dvz745kVlrJdnsuFXEkmzxAlS7HlqzDy/Rxfd7N341LDkTxpyteO1deiOo2ZuYRvtmoYNeoXgY9lMQyw2cw2igtt6q0AAAZGacp5dzJp1x02Z4zmEHrKEmllGhDAeOA= 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 v3 11/17] block/io: use int64_t bytes in copy_range Date: Thu, 30 Apr 2020 14:10:27 +0300 Message-Id: <20200430111033.29980-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21acda43-be00-4e64-b6ec-08d7ecf72c6e X-MS-TrafficTypeDiagnostic: AM7PR08MB5447: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:635; X-Forefront-PRVS: 0389EDA07F 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)(39840400004)(136003)(346002)(376002)(396003)(366004)(66556008)(6512007)(107886003)(316002)(6506007)(26005)(52116002)(186003)(478600001)(956004)(2616005)(16526019)(66476007)(2906002)(86362001)(5660300002)(66946007)(6486002)(6916009)(7416002)(36756003)(8936002)(1076003)(6666004)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Idy1yo5jNLCX5aNP7TWQBWqm1YWKEx8mKp+oiYmfLgB0/pHlBSc43BV8+WLeXzzSt5EMcf24heElxG60i+przIUnLoD2Jc/nFN1Lf3gKYzoUBvBeECGPyxX2Ab0rdjx0K6o89SZyyxhixrV/zT5FE7ZmSdBAEmWkQAjepsCm+CFgk7gSapg7sPTOmfc/ByQdJakVwvjct33XL+/iWmj+bBHEv/2jf0T7teBQBQb88xjmfuaXEPiYOonuqUTqElPkWaPc40aMi5gJxeoOXu/ghoEDi90vrVrSdzMF1Up6uxxQ1sY17nq7MgWqrJjELezcxRatrE2XSsFONLOJC+FTNGlx/JuNHbV5tNrLA5ySCrLqG+bLq6ASAeARp0L6HkItAOshzNHBlf3e7Rjxi88c93cT39q/7I8m3wJFbEUKXxt0evbN4AhDUjlqC7PDolsP X-MS-Exchange-AntiSpam-MessageData: hB7S6t+nh/LpmvYky1X1MebJMPv9DoasJRzZj1nS7tTkAYvH2PX60KEzIws3zAyl4g03CQTkc2Obcx6dlxoq6ZLFOBSG+SHHL7cb7adgcpxX/77cMvDVrLLyE1ykg3TfLxePKQCJM9FAO3u592lLgqYz6XpXf1GEMAfncZlt+5c8hkEXpMW+b90zfpf+imAtMfYDGjZDwd2xoy9wq/dL0gFRplDe5ePfWJryfF1wymysWRKJfzxcu8sd2W9oo3jeNjqxRYwAIVkTe2w1wbYihr926QUBSIDE7SzpDBWg6JUwm2eas7lQ7AETrdyYlBShAnfAxOfNnV/LrMGhqctkStotfmPXReo5Tfgca8v1eeQmSgtU8p6NVjgQFb0igj+lex7m2uRmULuV+zGOUShOBXjogkLEYTKGS5kYKlS4JelqCbzdgamD983QOcaAmsQITJIFYBmrvarlXE/vcvdfJRiAGbrCSrNYWS/8ahAzAzZ2+kmR35eX4uFHk2VHQfp5u60biVRkJIWGME1vtgjl4IjCvM9VOTISyt/hDpC13TAUx7NDLrCOB7ZHOTDPsPrPYzql3YkozZuVOT1IPccdpYpvMjRhD8hu83V6sGe7/zCfZWKkAMochvRV+Zhpx5tP6FDVJQsibo+CISMq92lMiEGHsjEM5KpGfWlRgBI+5/YPvJJmn1x4xJIDmftTOsP5QQy0jWobUqLeoTRzzc52ntUyOxIwIqGwokdG2EmAVo63m0HzaUvsnSib/ZswlZCnd3nEVDMvOFGwpXO3oobrjYgnKnf+iQ9Vp6gyrPelido= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21acda43-be00-4e64-b6ec-08d7ecf72c6e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:04.4616 (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: LbgnJ+7lb31PhU4ZbwTL4VvsSB+FoReSgmVPPKXizmcTNafQf2TadmPKjFzThx9TzwjBJzBOrl0C5c04bkKMF2YUzRuZjEUrxTua66opX0Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5447 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.6.129; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:02 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.6.129 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert now copy_range parameters which are already 64bit to signed type. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 6 +++--- include/block/block_int.h | 12 ++++++------ block/io.c | 22 +++++++++++----------- block/trace-events | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 1688e7fa55..4bc90c493e 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -732,8 +732,8 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *ho= st); * * Returns: 0 if succeeded; negative error code if failed. **/ -int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, - uint64_t bytes, BdrvRequestFlags read_= flags, +int coroutine_fn bdrv_co_copy_range(BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_f= lags, BdrvRequestFlags write_flags); #endif diff --git a/include/block/block_int.h b/include/block/block_int.h index b4b42d0cd6..28aea2bcfd 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1315,14 +1315,14 @@ void bdrv_dec_in_flight(BlockDriverState *bs); =20 void blockdev_close_all_bdrv_states(void); =20 -int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offs= et, - BdrvChild *dst, uint64_t dst_offs= et, - uint64_t bytes, +int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, int64_t src_offse= t, + BdrvChild *dst, int64_t dst_offse= t, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags); -int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, - uint64_t bytes, +int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags); =20 diff --git a/block/io.c b/block/io.c index 7564153dbe..db8b3b153d 100644 --- a/block/io.c +++ b/block/io.c @@ -3451,8 +3451,8 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *= host) } =20 static int coroutine_fn bdrv_co_copy_range_internal( - BdrvChild *src, uint64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, uint64_t bytes, + BdrvChild *src, int64_t src_offset, BdrvChild *dst, + int64_t dst_offset, int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags, bool recurse_src) { @@ -3530,9 +3530,9 @@ static int coroutine_fn bdrv_co_copy_range_internal( * * See the comment of bdrv_co_copy_range for the parameter and return value * semantics. */ -int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offs= et, - BdrvChild *dst, uint64_t dst_offs= et, - uint64_t bytes, +int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, int64_t src_offse= t, + BdrvChild *dst, int64_t dst_offse= t, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { @@ -3546,9 +3546,9 @@ int coroutine_fn bdrv_co_copy_range_from(BdrvChild *s= rc, uint64_t src_offset, * * See the comment of bdrv_co_copy_range for the parameter and return value * semantics. */ -int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, - uint64_t bytes, +int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { @@ -3558,9 +3558,9 @@ int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src= , uint64_t src_offset, bytes, read_flags, write_flags, fal= se); } =20 -int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, - uint64_t bytes, BdrvRequestFlags read_= flags, +int coroutine_fn bdrv_co_copy_range(BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_f= lags, BdrvRequestFlags write_flags) { return bdrv_co_copy_range_from(src, src_offset, diff --git a/block/trace-events b/block/trace-events index 13ad9af0d8..e4d68438af 100644 --- a/block/trace-events +++ b/block/trace-events @@ -15,8 +15,8 @@ bdrv_co_preadv_part(void *bs, int64_t offset, int64_t byt= es, int flags) "bs %p o bdrv_co_pwritev_part(void *bs, int64_t offset, int64_t bytes, int flags) "= bs %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int64_t bytes, int flags) = "bs %p offset %" PRId64 " bytes %" PRId64 " flags 0x%x" bdrv_co_do_copy_on_readv(void *bs, int64_t offset, int64_t bytes, int64_t = cluster_offset, int64_t cluster_bytes) "bs %p offset %" PRId64 " bytes %" P= RId64 " cluster_offset %" PRId64 " cluster_bytes %" PRId64 -bdrv_co_copy_range_from(void *src, uint64_t src_offset, void *dst, uint64_= t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offs= et %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" -bdrv_co_copy_range_to(void *src, uint64_t src_offset, void *dst, uint64_t = dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset= %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" +bdrv_co_copy_range_from(void *src, int64_t src_offset, void *dst, int64_t = dst_offset, int64_t bytes, int read_flags, int write_flags) "src %p offset = %" PRId64 " dst %p offset %" PRId64 " bytes %" PRId64 " rw flags 0x%x 0x%x" +bdrv_co_copy_range_to(void *src, int64_t src_offset, void *dst, int64_t ds= t_offset, int64_t bytes, int read_flags, int write_flags) "src %p offset %"= PRId64 " dst %p offset %" PRId64 " bytes %" PRId64 " rw flags 0x%x 0x%x" =20 # stream.c stream_one_iteration(void *s, int64_t offset, uint64_t bytes, int is_alloc= ated) "s %p offset %" PRId64 " bytes %" PRIu64 " is_allocated %d" --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245562; cv=pass; d=zohomail.com; s=zohoarc; b=EKnmzumWEgJGmoYw4KOB42WfQPtxZH+meH5v5QD4bOFB9xcrPAnNcfZSDwFZtqDWurtoLcP1/hWR1mH5lJgEScOkPdNyhj77/mDcgQg0pUbxRVd8J+opLbJy3E8OII9VyY3D/q67o8F5eB0XiDyYimpbZvzo7k7h23RDUix4/y8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245562; 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=p96Q8f6SVdBp4AN38/xYSuB/77eP/QtXR1B0Z8I3bD0=; b=SLUZPFjREestEpXh5eDHIzy7Lh36/6+D4Gxh236hb0ZSL55B9nm8VJSh0XcyVL1iuhdC4WbBys1rrEsymgn90SyOU3SMJsGCYD7p3R3Xc+gL7Uz7z9JxIV6bfQvbAJmIuTqwxOMe49DS5yCb+zDHmIvZgeGX+hbbORrGiBCKEx4= 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 158824556232232.18129524149754; Thu, 30 Apr 2020 04:19:22 -0700 (PDT) Received: from localhost ([::1]:58988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Ds-0005JN-Uo for importer@patchew.org; Thu, 30 Apr 2020 07:19:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57780) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78Y-00077X-9J for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU772-0005HB-MF for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:50 -0400 Received: from mail-eopbgr80117.outbound.protection.outlook.com ([40.107.8.117]:39403 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75x-0003Yq-AS; Thu, 30 Apr 2020 07:11:09 -0400 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.2937.22; Thu, 30 Apr 2020 11:11:06 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:06 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T01TacMPMMQWLlZRLfeA21Y0fHa3qJGOemLzOtXOYm65LI3rkiEJKxiS/5nSZN0kZbataJiXw7UBB3oY0xPbo8cuXaPNBjg6BdA5m6OaJ/G5koRBxiwvPb/oO3szMFTGTnPuP+FbP6CcOGoOGTBLdLH4cJgVZeMiKmPmyjyLDWBtJl6qY96fVeYcDOtzxT/8xJLbXuJxYQ2vKhqFEe4r9roW42joVMPLKNgn9gvEwiAAQiAgAGGFaE958ukR2a6sak+QkB33244S/U0IZ0OTlMzIOZUuM0ZvkUFteGM10C5gmAs73vScKxLZ+YpNMNiVrSr1ahUuGUPn3GvSxMuNKw== 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=p96Q8f6SVdBp4AN38/xYSuB/77eP/QtXR1B0Z8I3bD0=; b=PnbaKBnMtsTO8RL23j3506V1eEGhq6Uywl9cFnc1yYhoAJ3h3lPD0yQYtGwCD/5QFi/g1A4lMDE4isfDGmRVsl8gxQZq6uX5h8rhCnnYv0/Z0LPJIFrIQqlH1XkGBwevVSUGaPOnANHFujtkhs2V/eIDnARZwaCJLW+OT7DHTn88JOQXnMm9ttIRV60+WK90o1g7W037SlczDKbBP5SoA/tqRVfa6ohH1hxamS/xtvsMyk50t9Lk8cwR7GXGw7OoQP3rup3hzcOj1F0QZxT1cMWoHXUcnWnmZKA/JMy5xTENCHkU27fCwJTgZPxAJat57t8FE49ByGP48VRGfahjrQ== 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=p96Q8f6SVdBp4AN38/xYSuB/77eP/QtXR1B0Z8I3bD0=; b=ugbMWO6sNOLBEdeGo89ZkwEEO/ldvMYwjPV/sLVheya17cHJlciVhZGnUwOQXyS1XtFWscvT7oOiK8mK0bukkC9L5am+pYnYB20W2Q6yLlUE9yr3Qs/V/2Y5cWYllxzhFf8MGsUWqfFJ0Kmg50Uhmm6N9O+PFiZsRvRTJ10pRQU= 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 v3 12/17] block/block-backend: convert blk io path to use int64_t parameters Date: Thu, 30 Apr 2020 14:10:28 +0300 Message-Id: <20200430111033.29980-13-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c2773d0-d9d3-46ce-37f6-08d7ecf72d4c X-MS-TrafficTypeDiagnostic: AM7PR08MB5447: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:390; X-Forefront-PRVS: 0389EDA07F 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)(39840400004)(136003)(346002)(376002)(396003)(366004)(66556008)(6512007)(107886003)(316002)(6506007)(26005)(52116002)(186003)(478600001)(956004)(2616005)(16526019)(66476007)(2906002)(30864003)(86362001)(5660300002)(66946007)(6486002)(6916009)(7416002)(36756003)(8936002)(1076003)(6666004)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kN+LSLZnZM07AKs4sOCVx+o8JFJQ6+WApPRcAAPHfvnUQeuAxCKi9KoHL71mrJJ3G3VKKH0LMfNoeUOejQ0PkoV4lj+gnigTab3oodaBWqAe4n0CKlenn5SHacpUhclvvJ+TGYdMGIwR6hT1iQ56ZvCJeyF6ztsXVdnt3jZZiGpjsp98bmFI4OjW6LB+P0e5/MEdrpL5qtsEq0b+H6MC3hCjWrfsef/AD6UpunHF8Zvgoev4tX2g5Hi/+VWh0B/t9wpuIrWv4rr/TeJsSI/Tf4YtP3VlA8TspAIIZKCEJaRAYuuKgkA/2Vi4einhK7qWjKbU9cGaYdPtRvLYSByHatLBuPQUL5rQ/Sr34icVJNDIZXJdhA8mhti+r6DcscNjhqheE+UxMNgWDCAU++5dJGkBXpQnM2JhokB/jsoYPhGj6wmQl1IrHd5di6nIjbfa X-MS-Exchange-AntiSpam-MessageData: 9/zR1fMrB9hUDFXJwbmjwSU3KoA83beId+lvhrbfQ31It2eMvGhfiS7l1oERsRe8YVy97Hcyx7CCxVN8hwdJrpxWsktgRCnDrlOWUXiZpoPXf6VdgG2yy65P5S+VIjdb20YBd09QIpuDZHiiQ84uOvm+exQkny8kCbaTJA3Tvd3WOVSuNTkLzLGYp6O+5waTpE6tiAGfJgJS25MrLdOS2YaKbxhnIOBKCzvMMLsbJKUur7eawBAXXuf3d/S/I8FJf79P0paKAy9uSJK4z1rZQ3A8+xUbQnVvjglTba1jFSh1PvnmSygGKFPEt4ySo2XlliajYug/1Ior0aypvIQ6D+/1MQgyFoLNucW7N1TEECaIHrk5ySpozpgudpdNH+39fY7KnJ3LnwWMTWTFf5dTwIJkoa8GxR/IDfr0gnQXyE1ylLJjqFXrGQbk+PzCOH8oe5umxiE1eF3iXIShoI4vo+4U6lcreIZ4Dy57CXYFXvVahOo28ZphBUdF0cAfhJ0ya9We9o7+9OCloJBOk6PzR+y6Ru3/cPN8au1D476aA8gNCS8QjXzfu5q+1odXm3jme6A6ADUzWx85HtXAOqfDo9Zsd7U+E5a2Zvwgbn84KM0jm+qSz+klmhV8NY6NLCKIgqX6yG4f6Q4NrU11gOe3e5OaxORVk4RGqd0fSeXgnEqvmuJseIZvDsqd9FYarE4DgR2cVj2UqaOrL29NvjOv7IZm7AG73JWbRyvleMMLzNfCK0/+3zcOJAVqsNB1yw9OH0R4xQk89ed7Tm7AV+5m/PHjoKfaDcfsoFDhDlbfyGM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c2773d0-d9d3-46ce-37f6-08d7ecf72d4c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:06.2010 (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: wn93SmIyBeMoZxN7ya30FiHzGx/jSM9NJJqnIxQiQgEzycO7JyS9vvNi1g7NJyM+xkYKPs74dlSof4rMLZK1782v8AkqyLs/tbXBmn0zZpI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5447 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.8.117; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:07 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.8.117 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). Now bdrv layer is converted, convert blk layer too. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 26 +++++++-------- block/block-backend.c | 60 ++++++++++++++++++---------------- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 9bbdbd63d7..0c1eee1778 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -119,14 +119,14 @@ BlockBackend *blk_by_dev(void *dev); BlockBackend *blk_by_qdev_id(const char *id, Error **errp); void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaq= ue); int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, - unsigned int bytes, QEMUIOVector *qiov, + int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset, - unsigned int bytes, + int64_t bytes, QEMUIOVector *qiov, size_t qiov_offse= t, BdrvRequestFlags flags); int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, - unsigned int bytes, QEMUIOVector *qiov, + int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); =20 static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t off= set, @@ -148,13 +148,13 @@ static inline int coroutine_fn blk_co_pwrite(BlockBac= kend *blk, int64_t offset, } =20 int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int bytes, BdrvRequestFlags flags); + int64_t bytes, BdrvRequestFlags flags); BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int bytes, BdrvRequestFlags flags, + int64_t bytes, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags); -int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int bytes); -int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int byt= es, +int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int64_t bytes); +int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int64_t= bytes, BdrvRequestFlags flags); int64_t blk_getlength(BlockBackend *blk); void blk_get_geometry(BlockBackend *blk, uint64_t *nb_sectors_ptr); @@ -167,14 +167,14 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_= t offset, BlockCompletionFunc *cb, void *opaque); BlockAIOCB *blk_aio_flush(BlockBackend *blk, BlockCompletionFunc *cb, void *opaque); -BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, int64_t offset, int bytes, +BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, int64_t offset, int64_t by= tes, BlockCompletionFunc *cb, void *opaque); void blk_aio_cancel(BlockAIOCB *acb); void blk_aio_cancel_async(BlockAIOCB *acb); int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf); BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *= buf, BlockCompletionFunc *cb, void *opaque); -int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int bytes); +int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); int blk_co_flush(BlockBackend *blk); int blk_flush(BlockBackend *blk); int blk_commit_all(void); @@ -233,12 +233,12 @@ int blk_get_open_flags_from_root_state(BlockBackend *= blk); void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockBackend *blk, BlockCompletionFunc *cb, void *opaque); int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int bytes, BdrvRequestFlags flags); + int64_t bytes, BdrvRequestFlags flag= s); int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *b= uf, - int bytes); + int64_t bytes); int blk_truncate(BlockBackend *blk, int64_t offset, bool exact, PreallocMode prealloc, Error **errp); -int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes); +int blk_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); int blk_save_vmstate(BlockBackend *blk, const uint8_t *buf, int64_t pos, int size); int blk_load_vmstate(BlockBackend *blk, uint8_t *buf, int64_t pos, int siz= e); @@ -259,7 +259,7 @@ void blk_unregister_buf(BlockBackend *blk, void *host); =20 int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, BlockBackend *blk_out, int64_t off_out, - int bytes, BdrvRequestFlags read_flags, + int64_t bytes, BdrvRequestFlags read_fl= ags, BdrvRequestFlags write_flags); =20 const BdrvChild *blk_root(BlockBackend *blk); diff --git a/block/block-backend.c b/block/block-backend.c index 38ae413826..b3f6edfc70 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1110,11 +1110,11 @@ void blk_set_disable_request_queuing(BlockBackend *= blk, bool disable) } =20 static int blk_check_byte_request(BlockBackend *blk, int64_t offset, - size_t size) + int64_t bytes) { int64_t len; =20 - if (size > INT_MAX) { + if (bytes > INT_MAX) { return -EIO; } =20 @@ -1122,7 +1122,7 @@ static int blk_check_byte_request(BlockBackend *blk, = int64_t offset, return -ENOMEDIUM; } =20 - if (offset < 0) { + if (offset < 0 || bytes < 0) { return -EIO; } =20 @@ -1132,7 +1132,7 @@ static int blk_check_byte_request(BlockBackend *blk, = int64_t offset, return len; } =20 - if (offset > len || len - offset < size) { + if (offset > len || len - offset < bytes) { return -EIO; } } @@ -1154,7 +1154,7 @@ static void coroutine_fn blk_wait_while_drained(Block= Backend *blk) =20 /* To be called between exactly one pair of blk_inc/dec_in_flight() */ static int coroutine_fn -blk_do_preadv(BlockBackend *blk, int64_t offset, unsigned int bytes, +blk_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; @@ -1185,7 +1185,7 @@ blk_do_preadv(BlockBackend *blk, int64_t offset, unsi= gned int bytes, } =20 int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, - unsigned int bytes, QEMUIOVector *qiov, + int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; @@ -1199,7 +1199,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int= 64_t offset, =20 /* To be called between exactly one pair of blk_inc/dec_in_flight() */ static int coroutine_fn -blk_do_pwritev_part(BlockBackend *blk, int64_t offset, unsigned int bytes, +blk_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) { @@ -1235,7 +1235,7 @@ blk_do_pwritev_part(BlockBackend *blk, int64_t offset= , unsigned int bytes, } =20 int coroutine_fn blk_co_pwritev_part(BlockBackend *blk, int64_t offset, - unsigned int bytes, + int64_t bytes, QEMUIOVector *qiov, size_t qiov_offse= t, BdrvRequestFlags flags) { @@ -1249,7 +1249,7 @@ int coroutine_fn blk_co_pwritev_part(BlockBackend *bl= k, int64_t offset, } =20 int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, - unsigned int bytes, QEMUIOVector *qiov, + int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { return blk_co_pwritev_part(blk, offset, bytes, qiov, 0, flags); @@ -1311,7 +1311,7 @@ static int blk_prw(BlockBackend *blk, int64_t offset,= uint8_t *buf, } =20 int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int bytes, BdrvRequestFlags flags) + int64_t bytes, BdrvRequestFlags flags) { return blk_prw(blk, offset, NULL, bytes, blk_write_entry, flags | BDRV_REQ_ZERO_WRITE); @@ -1361,7 +1361,7 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk, typedef struct BlkAioEmAIOCB { BlockAIOCB common; BlkRwCo rwco; - int bytes; + int64_t bytes; bool has_returned; } BlkAioEmAIOCB; =20 @@ -1385,7 +1385,8 @@ static void blk_aio_complete_bh(void *opaque) blk_aio_complete(acb); } =20 -static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, int64_t offset, int byt= es, +static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, + int64_t offset, int64_t bytes, void *iobuf, CoroutineEntry co_entry, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque) @@ -1442,31 +1443,31 @@ static void blk_aio_write_entry(void *opaque) } =20 BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int count, BdrvRequestFlags flags, + int64_t bytes, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque) { - return blk_aio_prwv(blk, offset, count, NULL, blk_aio_write_entry, + return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_write_entry, flags | BDRV_REQ_ZERO_WRITE, cb, opaque); } =20 -int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int count) +int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int64_t bytes) { - int ret =3D blk_prw(blk, offset, buf, count, blk_read_entry, 0); + int ret =3D blk_prw(blk, offset, buf, bytes, blk_read_entry, 0); if (ret < 0) { return ret; } - return count; + return bytes; } =20 -int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int cou= nt, - BdrvRequestFlags flags) +int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, + int64_t bytes, BdrvRequestFlags flags) { - int ret =3D blk_prw(blk, offset, (void *) buf, count, blk_write_entry, + int ret =3D blk_prw(blk, offset, (void *) buf, bytes, blk_write_entry, flags); if (ret < 0) { return ret; } - return count; + return bytes; } =20 int64_t blk_getlength(BlockBackend *blk) @@ -1567,7 +1568,7 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned= long int req, void *buf, =20 /* To be called between exactly one pair of blk_inc/dec_in_flight() */ static int coroutine_fn -blk_do_pdiscard(BlockBackend *blk, int64_t offset, int bytes) +blk_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes) { int ret; =20 @@ -1591,14 +1592,15 @@ static void blk_aio_pdiscard_entry(void *opaque) } =20 BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, - int64_t offset, int bytes, + int64_t offset, int64_t bytes, BlockCompletionFunc *cb, void *opaque) { return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_pdiscard_entry, = 0, cb, opaque); } =20 -int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset, int by= tes) +int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset, + int64_t bytes) { int ret; =20 @@ -1618,7 +1620,7 @@ static void blk_pdiscard_entry(void *opaque) aio_wait_kick(); } =20 -int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes) +int blk_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes) { return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0); } @@ -2123,16 +2125,16 @@ void *blk_aio_get(const AIOCBInfo *aiocb_info, Bloc= kBackend *blk, } =20 int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int bytes, BdrvRequestFlags flags) + int64_t bytes, BdrvRequestFlags flag= s) { return blk_co_pwritev(blk, offset, bytes, NULL, flags | BDRV_REQ_ZERO_WRITE); } =20 int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *b= uf, - int count) + int64_t bytes) { - return blk_prw(blk, offset, (void *) buf, count, blk_write_entry, + return blk_prw(blk, offset, (void *) buf, bytes, blk_write_entry, BDRV_REQ_WRITE_COMPRESSED); } =20 @@ -2358,7 +2360,7 @@ void blk_unregister_buf(BlockBackend *blk, void *host) =20 int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, BlockBackend *blk_out, int64_t off_out, - int bytes, BdrvRequestFlags read_flags, + int64_t bytes, BdrvRequestFlags read_fl= ags, BdrvRequestFlags write_flags) { int r; --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245377; cv=pass; d=zohomail.com; s=zohoarc; b=PL1NgRF99F1gBpZcCLT7TVBziwatTTUaurlbq2J07ygMVlX6sqLBL5W++3TnsrkvuReoYYBPtS1ZuliRSSLqGzwAEjKc8pOg/fJstaLJ+n+22K3b3awvNDic6HnH/wR+GvKs3PJwFZl8oLzCyD7CuDSraISBnhxD5eJ39ysOUvo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245377; 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=IQVZEUmlJUyIxRKWgtZ4QqTL9rUQ5Ko92pUVd+FmBiI=; b=X1ojk/lrqrQH6B0sKTecHxNUgWShdbhzoLmSIVQ7S/F5Rodgtdoy0eVNWnPQZYKfGJr7DgYXD91U5gzxtLJAguOihQgyST6IMVbVqlnmP8ex6tb759mvcCH2vXFBhI4CQzN/UoRbcZ01bFm9o64dT4xNTa/hvw+n3cUdDV5RbIg= 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 1588245377792514.8312956258574; Thu, 30 Apr 2020 04:16:17 -0700 (PDT) Received: from localhost ([::1]:50168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Au-000160-94 for importer@patchew.org; Thu, 30 Apr 2020 07:16:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57794) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78e-0007A1-5h for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU775-0005Hi-G6 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:55 -0400 Received: from mail-eopbgr80117.outbound.protection.outlook.com ([40.107.8.117]:39403 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU75y-0003Yq-B6; Thu, 30 Apr 2020 07:11:10 -0400 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.2937.22; Thu, 30 Apr 2020 11:11:07 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:07 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xquaj7um6ut7fNliv91odYE7P2XF6AvuM7n3VIX5s7jaFYqN6FCIf2YqNuM0SjPfLaXmEwRmp29iwypFR4AL2eu3IiRUMEck2hKtbDiWxmdH+47QqswL9gK297t8iia03VttgpqdqREHPolegtJSbS1EWuq5WLD/rg7Si9eDloT2OZMc/Fser5Uy4TcyBk6kuKT0VneC4D0emEcnkVaCusfPibEhl0rmK4RnYB+cutYT2HqRlDe98+xQEJInKa13283S61/sESU0qtlaI0W5LRBHj82LEmqDdc8U4fF0Ur+KOgmI24x42jWoJBnY3MyrOudlmq8tTrqSPdyFYRycLA== 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=IQVZEUmlJUyIxRKWgtZ4QqTL9rUQ5Ko92pUVd+FmBiI=; b=Z02WL5IvtaEFnYpp0HHFfiHmKS1g2D0RuWnQZmK3DEEXqi+DYZQl9+xRjkDvcjFXHqGVVYOpcPiKpG3Fa4lm34ijw4rwZYPW0hD31bmQHR0UGw7Et2dDuQbH7iu3T9FJ9eg5z9tiQWl4DIp1iXRvmZgNMghJQr6quTBsmGMwD3lg5JWh/oUZrkMD5Dn1UIpF5CWfC6Wf3LfXDt34MGqX3bT3H1yqPxI8x7Rmtk9BpaB6c5eDGZazk8/dcF8rIYfOWrkBZBM692vuy2ffhMtzVnNPwOQTWLioEwv3zwjlzC7cyWxL2LYwyhiPShWw5RXdJXCbDDnq7DJudnIbkdv8Xw== 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=IQVZEUmlJUyIxRKWgtZ4QqTL9rUQ5Ko92pUVd+FmBiI=; b=HF7+P5I808eWowbODT9AVICGxYzmhLivoHcSxsSbqv653prPXXfPdEkI2lg7HneiS9khJ3LAj2r9iWotWWq3HjmbRuK80eRZmaegv0zui4GpbF9t/SPJ7l6Ydxi6hVhGi5W+mboPjmslVmK/cM/nM0suQYoR7LPRMt00SojlEF8= 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 v3 13/17] block: use int64_t instead of uint64_t in driver read handlers Date: Thu, 30 Apr 2020 14:10:29 +0300 Message-Id: <20200430111033.29980-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9798f3e6-f560-4ffa-d192-08d7ecf72e58 X-MS-TrafficTypeDiagnostic: AM7PR08MB5447: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:151; X-Forefront-PRVS: 0389EDA07F 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)(39840400004)(136003)(346002)(376002)(396003)(366004)(66556008)(6512007)(107886003)(316002)(6506007)(26005)(52116002)(186003)(478600001)(956004)(2616005)(16526019)(66476007)(2906002)(30864003)(86362001)(5660300002)(66946007)(6486002)(6916009)(7416002)(36756003)(8936002)(1076003)(6666004)(8676002)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LZCh/6ZQkpTFzFEI2HWG7P7syLisFuUrfwJMSXZrQ+kSVnoOqdHZgkGqbjezVGQARWCj79QNqNcI26fumTP+mgTfoYa4VW4Ws8DqKFyoypNWIqRqMoKeycJA3HEDaqHzQq35FsFmWJu6l7UCEedG1htF8X26lVnE6kfVFVxChiX0Zh5EUws5LR58+ouljacCP5OpuzClgawDlulibTK34hr9Fk642EtjpQ2xHZoBHF3ov6GAAaIeOab7zHeU+eZ8AzMxwzRpmJ84Ig2W6PhzMzSHaOVztsxu1L+kqiODyI6uIXtvRE6oY3RIxKXZfyWknQXN4W79TlmQTnZ4u2A1f8PZMzIg5WkbCrT4eTDRUbXREprLAMedh0zHPVlRRwnL8K8C8nc4IgX2FgYhg0gp8RYdU9hAZZfbk6juK6D89YWmhxHrzwVJnWYQIEyMooUA X-MS-Exchange-AntiSpam-MessageData: 3uXGGUJdtY7NE4xt+2RDrWciJoa2WBWLZgn3idPmT+ToF7BLAkYHNE62gcPiV/4gWXNX/+UN5P33ZA9nCCRzAQcLG8uYSU8z5Q5jNCUe0taSXXDE6SMlhZdeutvV4V2dw4uN6gLQmYIUzF2SVYz53SabalGUkcioteMq46IhFP8aq2Kd8uhcqTXrss9+Jk71zp9bzv1Cyd/4Dhri/ochRrKfJh+L66V2WWz2HbuPWU8oA8zUvH4s85XslRyPzjEkYvLm6ncrpQ0MLXIUD6WIN/ymEFtTjKVWlFbP6alcgCSM1Mnbu/YAod/KQIVtX2xiTcJ2FhcJOsgsGN4pKZZPaqjw7sh8SGs0bA0zcF6FiWSBOvY3Aq7Oaoa1EvkEKmMyGdHB8RQJikth+r4AZSMIN+rEzZ8sk0lS2hIVkaGu1ScqlKDsUjGkbI7eslsYOrKmfZQG3J+3CSpVk+zu/kwp4jPiry2uRp4DiupKTUADM9q8TFAusn57Db3X8shq+w2Z3zuwb6GipWZ/Ff/donnYkp2f/uvy2jrpI8tLJnFcQaKo0JNEGJXfXwLFDaRfC4YjuGqo/8kL8dBJ1blsAze4hikQUkUEVwB8dYCZdcpo0h1Fq27/zFAhwpQsnvvKVX4LgcR2ZLJUyCygft3Q7ua0PNq3r4ZSWHj8aqHFgzlgZCh8UTK/AExYqePGueJ25Y/E+nfvp/vtgcutzfxZd7xhgDd6IM/oPaCQawm6lWT1dLJvgSZLfJcMtz2J6Mgce/ts9Yq4z3CB4d3DGOzcdGwsrfe2vg6UvmUeTCGFqA4ZGAs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9798f3e6-f560-4ffa-d192-08d7ecf72e58 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:07.7791 (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: sX2PC6j/XjeLSGFxX958mLDV39rbP5jlSWSrUdgG2VFrAiVBW2lvhJpiRLXD8rOyrQ+DaMTWsErlfj0aHzNyCy8JPzmH4oiGY1idvgy1zCM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5447 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.8.117; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:07 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.8.117 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert driver read handlers parameters which are already 64bit to signed type. While being here, convert also flags parameter to be BdrvRequestFlags. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 11 ++++++----- block/backup-top.c | 4 ++-- block/blkdebug.c | 4 ++-- block/blklogwrites.c | 4 ++-- block/blkreplay.c | 2 +- block/blkverify.c | 4 ++-- block/bochs.c | 4 ++-- block/cloop.c | 4 ++-- block/commit.c | 2 +- block/copy-on-read.c | 5 +++-- block/crypto.c | 4 ++-- block/curl.c | 3 ++- block/dmg.c | 4 ++-- block/file-posix.c | 6 +++--- block/file-win32.c | 4 ++-- block/filter-compress.c | 4 ++-- block/mirror.c | 2 +- block/nbd.c | 5 +++-- block/nfs.c | 6 +++--- block/null.c | 9 +++++---- block/nvme.c | 5 +++-- block/qcow.c | 6 +++--- block/qcow2.c | 5 +++-- block/quorum.c | 4 ++-- block/raw-format.c | 20 ++++++++++---------- block/rbd.c | 5 +++-- block/throttle.c | 5 +++-- block/vdi.c | 4 ++-- block/vmdk.c | 4 ++-- block/vpc.c | 4 ++-- block/vvfat.c | 4 ++-- block/vxhs.c | 4 ++-- tests/test-bdrv-drain.c | 16 +++++++++------- tests/test-block-iothread.c | 19 ++++++++++++++----- 34 files changed, 108 insertions(+), 88 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 28aea2bcfd..7b5f936269 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -180,8 +180,8 @@ struct BlockDriver { =20 /* aio */ BlockAIOCB *(*bdrv_aio_preadv)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags, - BlockCompletionFunc *cb, void *opaque); + int64_t offset, int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); BlockAIOCB *(*bdrv_aio_pwritev)(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags, BlockCompletionFunc *cb, void *opaque); @@ -210,10 +210,11 @@ struct BlockDriver { * The buffer in @qiov may point directly to guest memory. */ int coroutine_fn (*bdrv_co_preadv)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags); + int64_t offset, int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_preadv_part)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, size_t qiov_offset, int flags); + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_writev)(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int flags); /** diff --git a/block/backup-top.c b/block/backup-top.c index 3b50c06e2c..289fee5a92 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -42,8 +42,8 @@ typedef struct BDRVBackupTopState { } BDRVBackupTopState; =20 static coroutine_fn int backup_top_co_preadv( - BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags); } diff --git a/block/blkdebug.c b/block/blkdebug.c index af44aa973f..7e02156c63 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -619,8 +619,8 @@ static int rule_check(BlockDriverState *bs, uint64_t of= fset, uint64_t bytes, } =20 static int coroutine_fn -blkdebug_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +blkdebug_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int err; =20 diff --git a/block/blklogwrites.c b/block/blklogwrites.c index 04d8b33607..db60b396bc 100644 --- a/block/blklogwrites.c +++ b/block/blklogwrites.c @@ -307,8 +307,8 @@ static void blk_log_writes_refresh_limits(BlockDriverSt= ate *bs, Error **errp) } =20 static int coroutine_fn -blk_log_writes_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t b= ytes, - QEMUIOVector *qiov, int flags) +blk_log_writes_co_preadv(BlockDriverState *bs, int64_t offset, int64_t byt= es, + QEMUIOVector *qiov, BdrvRequestFlags flags) { return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags); } diff --git a/block/blkreplay.c b/block/blkreplay.c index c96ac8f4bc..c8dd17bfff 100644 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -73,7 +73,7 @@ static void block_request_create(uint64_t reqid, BlockDri= verState *bs, } =20 static int coroutine_fn blkreplay_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags fl= ags) { uint64_t reqid =3D blkreplay_next_id(); int ret =3D bdrv_co_preadv(bs->file, offset, bytes, qiov, flags); diff --git a/block/blkverify.c b/block/blkverify.c index 667e60d832..6bc2982a95 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -224,8 +224,8 @@ blkverify_co_prwv(BlockDriverState *bs, BlkverifyReques= t *r, uint64_t offset, } =20 static int coroutine_fn -blkverify_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +blkverify_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BlkverifyRequest r; QEMUIOVector raw_qiov; diff --git a/block/bochs.c b/block/bochs.c index 32bb83b268..7c8c181705 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -238,8 +238,8 @@ static int64_t seek_to_sector(BlockDriverState *bs, int= 64_t sector_num) } =20 static int coroutine_fn -bochs_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +bochs_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVBochsState *s =3D bs->opaque; uint64_t sector_num =3D offset >> BDRV_SECTOR_BITS; diff --git a/block/cloop.c b/block/cloop.c index 4de94876d4..5322f720db 100644 --- a/block/cloop.c +++ b/block/cloop.c @@ -245,8 +245,8 @@ static inline int cloop_read_block(BlockDriverState *bs= , int block_num) } =20 static int coroutine_fn -cloop_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +cloop_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVCloopState *s =3D bs->opaque; uint64_t sector_num =3D offset >> BDRV_SECTOR_BITS; diff --git a/block/commit.c b/block/commit.c index 8e672799af..517f9aa7a0 100644 --- a/block/commit.c +++ b/block/commit.c @@ -211,7 +211,7 @@ static const BlockJobDriver commit_job_driver =3D { }; =20 static int coroutine_fn bdrv_commit_top_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags fl= ags) { return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags); } diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 242d3ff055..c2a0916b66 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -74,8 +74,9 @@ static int64_t cor_getlength(BlockDriverState *bs) =20 =20 static int coroutine_fn cor_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags | BDRV_REQ_COPY_ON_READ); diff --git a/block/crypto.c b/block/crypto.c index d577f89659..4df71b25f1 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -335,8 +335,8 @@ static int block_crypto_reopen_prepare(BDRVReopenState = *state, #define BLOCK_CRYPTO_MAX_IO_SIZE (1024 * 1024) =20 static coroutine_fn int -block_crypto_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t byt= es, - QEMUIOVector *qiov, int flags) +block_crypto_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BlockCrypto *crypto =3D bs->opaque; uint64_t cur_bytes; /* number of bytes in current iteration */ diff --git a/block/curl.c b/block/curl.c index 6e325901dc..39086e83c3 100644 --- a/block/curl.c +++ b/block/curl.c @@ -922,7 +922,8 @@ out: } =20 static int coroutine_fn curl_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { CURLAIOCB acb =3D { .co =3D qemu_coroutine_self(), diff --git a/block/dmg.c b/block/dmg.c index 4a045f2b3e..0e3ac05371 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -689,8 +689,8 @@ static inline int dmg_read_chunk(BlockDriverState *bs, = uint64_t sector_num) } =20 static int coroutine_fn -dmg_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +dmg_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVDMGState *s =3D bs->opaque; uint64_t sector_num =3D offset >> BDRV_SECTOR_BITS; diff --git a/block/file-posix.c b/block/file-posix.c index 7e19bbff5f..1026e6040b 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1941,9 +1941,9 @@ static int coroutine_fn raw_co_prw(BlockDriverState *= bs, uint64_t offset, return raw_thread_pool_submit(bs, handle_aiocb_rw, &acb); } =20 -static int coroutine_fn raw_co_preadv(BlockDriverState *bs, uint64_t offse= t, - uint64_t bytes, QEMUIOVector *qiov, - int flags) +static int coroutine_fn raw_co_preadv(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { return raw_co_prw(bs, offset, bytes, qiov, QEMU_AIO_READ); } diff --git a/block/file-win32.c b/block/file-win32.c index 15859839a1..8a163837ab 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -415,8 +415,8 @@ fail: } =20 static BlockAIOCB *raw_aio_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags fla= gs, BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s =3D bs->opaque; diff --git a/block/filter-compress.c b/block/filter-compress.c index 82c315b298..e61de56b96 100644 --- a/block/filter-compress.c +++ b/block/filter-compress.c @@ -62,10 +62,10 @@ static int64_t compress_getlength(BlockDriverState *bs) =20 =20 static int coroutine_fn compress_co_preadv_part(BlockDriverState *bs, - uint64_t offset, uint64_t = bytes, + int64_t offset, int64_t by= tes, QEMUIOVector *qiov, size_t qiov_offset, - int flags) + BdrvRequestFlags flags) { return bdrv_co_preadv_part(bs->file, offset, bytes, qiov, qiov_offset, flags); diff --git a/block/mirror.c b/block/mirror.c index c26fd9260d..7cd720ac32 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1365,7 +1365,7 @@ static void coroutine_fn active_write_settle(MirrorOp= *op) } =20 static int coroutine_fn bdrv_mirror_top_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags fl= ags) { return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags); } diff --git a/block/nbd.c b/block/nbd.c index 2160859f64..fedad8843f 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -1160,8 +1160,9 @@ static int nbd_co_request(BlockDriverState *bs, NBDRe= quest *request, return ret ? ret : request_ret; } =20 -static int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov, int fl= ags) +static int nbd_client_co_preadv(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { int ret, request_ret; Error *local_err =3D NULL; diff --git a/block/nfs.c b/block/nfs.c index cc2413d5ab..647250e4d8 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -263,9 +263,9 @@ nfs_co_generic_cb(int ret, struct nfs_context *nfs, voi= d *data, nfs_co_generic_bh_cb, task); } =20 -static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, uint64_t offse= t, - uint64_t bytes, QEMUIOVector *iov, - int flags) +static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *iov, + BdrvRequestFlags flags) { NFSClient *client =3D bs->opaque; NFSRPC task; diff --git a/block/null.c b/block/null.c index 15e1d56746..e2a59caf46 100644 --- a/block/null.c +++ b/block/null.c @@ -116,8 +116,9 @@ static coroutine_fn int null_co_common(BlockDriverState= *bs) } =20 static coroutine_fn int null_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVNullState *s =3D bs->opaque; =20 @@ -187,8 +188,8 @@ static inline BlockAIOCB *null_aio_common(BlockDriverSt= ate *bs, } =20 static BlockAIOCB *null_aio_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags fl= ags, BlockCompletionFunc *cb, void *opaque) { diff --git a/block/nvme.c b/block/nvme.c index 7b7c0cc5d6..c79e398bff 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1062,8 +1062,9 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t= offset, uint64_t bytes, } =20 static coroutine_fn int nvme_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { return nvme_co_prw(bs, offset, bytes, qiov, false, flags); } diff --git a/block/qcow.c b/block/qcow.c index 8973e4e565..40fc5b96a4 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -628,9 +628,9 @@ static void qcow_refresh_limits(BlockDriverState *bs, E= rror **errp) bs->bl.request_alignment =3D BDRV_SECTOR_SIZE; } =20 -static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offs= et, - uint64_t bytes, QEMUIOVector *qiov, - int flags) +static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, int64_t offse= t, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVQcowState *s =3D bs->opaque; int offset_in_cluster; diff --git a/block/qcow2.c b/block/qcow2.c index b524b0c53f..817b0bfd2b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2202,9 +2202,10 @@ static coroutine_fn int qcow2_co_preadv_task_entry(A= ioTask *task) } =20 static coroutine_fn int qcow2_co_preadv_part(BlockDriverState *bs, - uint64_t offset, uint64_t byt= es, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, - size_t qiov_offset, int flags) + size_t qiov_offset, + BdrvRequestFlags flags) { BDRVQcow2State *s =3D bs->opaque; int ret =3D 0; diff --git a/block/quorum.c b/block/quorum.c index 6d7a56bd93..3c65c05d17 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -660,8 +660,8 @@ static int read_fifo_child(QuorumAIOCB *acb) return ret; } =20 -static int quorum_co_preadv(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov, int flags) +static int quorum_co_preadv(BlockDriverState *bs, int64_t offset, int64_t = bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVQuorumState *s =3D bs->opaque; QuorumAIOCB *acb =3D quorum_aio_get(bs, qiov, offset, bytes, flags); diff --git a/block/raw-format.c b/block/raw-format.c index 93b25e1b6b..709b8aecdb 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -171,8 +171,8 @@ static void raw_reopen_abort(BDRVReopenState *state) } =20 /* Check and adjust the offset, against 'offset' and 'size' options. */ -static inline int raw_adjust_offset(BlockDriverState *bs, uint64_t *offset, - uint64_t bytes, bool is_write) +static inline int raw_adjust_offset(BlockDriverState *bs, int64_t *offset, + int64_t bytes, bool is_write) { BDRVRawState *s =3D bs->opaque; =20 @@ -191,9 +191,9 @@ static inline int raw_adjust_offset(BlockDriverState *b= s, uint64_t *offset, return 0; } =20 -static int coroutine_fn raw_co_preadv(BlockDriverState *bs, uint64_t offse= t, - uint64_t bytes, QEMUIOVector *qiov, - int flags) +static int coroutine_fn raw_co_preadv(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { int ret; =20 @@ -249,7 +249,7 @@ static int coroutine_fn raw_co_pwritev(BlockDriverState= *bs, uint64_t offset, qiov =3D &local_qiov; } =20 - ret =3D raw_adjust_offset(bs, &offset, bytes, true); + ret =3D raw_adjust_offset(bs, (int64_t *)&offset, bytes, true); if (ret) { goto fail; } @@ -284,7 +284,7 @@ static int coroutine_fn raw_co_pwrite_zeroes(BlockDrive= rState *bs, { int ret; =20 - ret =3D raw_adjust_offset(bs, (uint64_t *)&offset, bytes, true); + ret =3D raw_adjust_offset(bs, (int64_t *)&offset, bytes, true); if (ret) { return ret; } @@ -296,7 +296,7 @@ static int coroutine_fn raw_co_pdiscard(BlockDriverStat= e *bs, { int ret; =20 - ret =3D raw_adjust_offset(bs, (uint64_t *)&offset, bytes, true); + ret =3D raw_adjust_offset(bs, &offset, bytes, true); if (ret) { return ret; } @@ -516,7 +516,7 @@ static int coroutine_fn raw_co_copy_range_from(BlockDri= verState *bs, { int ret; =20 - ret =3D raw_adjust_offset(bs, &src_offset, bytes, false); + ret =3D raw_adjust_offset(bs, (int64_t *)&src_offset, bytes, false); if (ret) { return ret; } @@ -535,7 +535,7 @@ static int coroutine_fn raw_co_copy_range_to(BlockDrive= rState *bs, { int ret; =20 - ret =3D raw_adjust_offset(bs, &dst_offset, bytes, true); + ret =3D raw_adjust_offset(bs, (int64_t *)&dst_offset, bytes, true); if (ret) { return ret; } diff --git a/block/rbd.c b/block/rbd.c index e637639a07..b7edd685f6 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -1034,8 +1034,9 @@ failed: } =20 static BlockAIOCB *qemu_rbd_aio_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque) { diff --git a/block/throttle.c b/block/throttle.c index 71f4bb0ad1..63d1956074 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -114,8 +114,9 @@ static int64_t throttle_getlength(BlockDriverState *bs) } =20 static int coroutine_fn throttle_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { =20 ThrottleGroupMember *tgm =3D bs->opaque; diff --git a/block/vdi.c b/block/vdi.c index e1a11f2aa0..1b5365f34c 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -547,8 +547,8 @@ static int coroutine_fn vdi_co_block_status(BlockDriver= State *bs, } =20 static int coroutine_fn -vdi_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vdi_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVVdiState *s =3D bs->opaque; QEMUIOVector local_qiov; diff --git a/block/vmdk.c b/block/vmdk.c index 218d9c9800..a1a0a77fe9 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1868,8 +1868,8 @@ static int vmdk_read_extent(VmdkExtent *extent, int64= _t cluster_offset, } =20 static int coroutine_fn -vmdk_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vmdk_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVVmdkState *s =3D bs->opaque; int ret; diff --git a/block/vpc.c b/block/vpc.c index d8141b52da..45c254c3f7 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -611,8 +611,8 @@ static int vpc_get_info(BlockDriverState *bs, BlockDriv= erInfo *bdi) } =20 static int coroutine_fn -vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vpc_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVVPCState *s =3D bs->opaque; int ret; diff --git a/block/vvfat.c b/block/vvfat.c index ab800c4887..80d488f556 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1538,8 +1538,8 @@ static int vvfat_read(BlockDriverState *bs, int64_t s= ector_num, } =20 static int coroutine_fn -vvfat_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vvfat_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; BDRVVVFATState *s =3D bs->opaque; diff --git a/block/vxhs.c b/block/vxhs.c index d79fc97df6..a1e437b2cb 100644 --- a/block/vxhs.c +++ b/block/vxhs.c @@ -480,8 +480,8 @@ errout: } =20 static BlockAIOCB *vxhs_aio_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags fl= ags, BlockCompletionFunc *cb, void *opaque) { return vxhs_aio_rw(bs, offset, qiov, bytes, cb, opaque, VDISK_AIO_READ= ); diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c index fa0e6a648b..f384e0eb32 100644 --- a/tests/test-bdrv-drain.c +++ b/tests/test-bdrv-drain.c @@ -65,8 +65,9 @@ static void co_reenter_bh(void *opaque) } =20 static int coroutine_fn bdrv_test_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t byte= s, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVTestState *s =3D bs->opaque; =20 @@ -1120,8 +1121,9 @@ static void bdrv_test_top_close(BlockDriverState *bs) } =20 static int coroutine_fn bdrv_test_top_co_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t = bytes, - QEMUIOVector *qiov, int fl= ags) + int64_t offset, int64_t by= tes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVTestTopState *tts =3D bs->opaque; return bdrv_co_preadv(tts->wait_child, offset, bytes, qiov, flags); @@ -1862,10 +1864,10 @@ static void bdrv_replace_test_close(BlockDriverStat= e *bs) * Set .has_read to true and return success. */ static int coroutine_fn bdrv_replace_test_co_preadv(BlockDriverState *bs, - uint64_t offset, - uint64_t bytes, + int64_t offset, + int64_t bytes, QEMUIOVector *qiov, - int flags) + BdrvRequestFlags flags) { BDRVReplaceTestState *s =3D bs->opaque; =20 diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c index 0c861809f0..9567617c50 100644 --- a/tests/test-block-iothread.c +++ b/tests/test-block-iothread.c @@ -31,9 +31,18 @@ #include "qemu/main-loop.h" #include "iothread.h" =20 -static int coroutine_fn bdrv_test_co_prwv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +static int coroutine_fn bdrv_test_co_preadv(BlockDriverState *bs, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) +{ + return 0; +} + +static int coroutine_fn bdrv_test_co_pwritev(BlockDriverState *bs, + uint64_t offset, uint64_t byt= es, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { return 0; } @@ -65,8 +74,8 @@ static BlockDriver bdrv_test =3D { .format_name =3D "test", .instance_size =3D 1, =20 - .bdrv_co_preadv =3D bdrv_test_co_prwv, - .bdrv_co_pwritev =3D bdrv_test_co_prwv, + .bdrv_co_preadv =3D bdrv_test_co_preadv, + .bdrv_co_pwritev =3D bdrv_test_co_pwritev, .bdrv_co_pdiscard =3D bdrv_test_co_pdiscard, .bdrv_co_truncate =3D bdrv_test_co_truncate, .bdrv_co_block_status =3D bdrv_test_co_block_status, --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245839; cv=pass; d=zohomail.com; s=zohoarc; b=EM3JDCCMmEJe54FhmqW/raafu3dIax/oj/uk+fX04zf5Hde/Eps0Ka3EYBSXL5iT0EMKOHxDkFrhxRdkZcuYpMMblpIFwHdHoSnxl2wsXbJIRKapYZRgzaK20ZfFI4Q4FjE1NtGRFpNu/Q59eWa63h1zhRDt+tNM8LAlwCiUpBY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245839; 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=qksOZE9f1ynvBKGDGT85EsWTMq+OvM4y1QlCZBx3Xo4=; b=Kyy8Vu3qouSIYGSTffG+NXwZsWurijErOfCLy+f50l35/Kmcd959La5fB3aHYIyGEqsF2tq7g95zWSauir7GUcsCtPoDmMzFKReHYO+X29YQOeXgR99lgHaDe19WTxPqRH1iMGYtjZq9Vw9zVfKk0gvO2DzhlIdhG4QE7i+ieqU= 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 1588245839658516.6368331298382; Thu, 30 Apr 2020 04:23:59 -0700 (PDT) Received: from localhost ([::1]:48208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7IM-0004nw-9Z for importer@patchew.org; Thu, 30 Apr 2020 07:23:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57824) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78h-0007D8-4A for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU78J-0005QR-Ue for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:58 -0400 Received: from mail-eopbgr70120.outbound.protection.outlook.com ([40.107.7.120]:6058 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU760-0003ZE-GE; Thu, 30 Apr 2020 07:11:12 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:11:09 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:09 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k3c9/q37nwZnwr7eKvVKJaXPHsIOoeuMm7S9riC+TRepQvW+x0gUwa7WG1wz+IaoT3rx6y0slOg5ox3oZcmC4SJTw/tFyBJYAVOlCA1FVVC9gKpMJ8H/4GWv7UI97IO5chlFulivpg2DGz1QUSMsMQKrvN8S32veDm7T/CzD2S3tyZSXl6G5SdifjHLleDekRiLPEPnF8a5rrfxxEeGjwvW82AN18E7srLaDqkBTtRdAjhai3ODtV5o04l7DiQEtU7ce6g29kJb0eh1zPIOG4DygQseJ4gfHfah9IeOdbPx301k9nbEEq1sGmQwFiU+/+vFJElv0EjMX66DEUGRaGw== 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=qksOZE9f1ynvBKGDGT85EsWTMq+OvM4y1QlCZBx3Xo4=; b=gPNXrmz5bieiF/dUG1AKCLpppokxqA5By4Imuou0qnSezDjoF7zwcjVuOxSCsYVWszsC09fHIjSPM9kbeDxhOvJ3HrHDXTM+zWuNGv4srJmUzwePXilY+is0LPHnPJsR4DHAgpWd1TJVTw93Z8DKSIguYCtz67xQkCfaz72dXq9zdmLa/mnfGaedioZsfCkeawkb5zt65RNF/Iq06HVel82sWJ2AEyW4e9Jba9xQ/7NDD1/ZKIplUqvn+gYp6dhflk+HldnmZpoIF7aBzLgNTh75rT0HmlsJXoiauNoeM+sDrbD0peAiKkuBW5I8MhhqB2Ynyaw1VNk+P3eF3KiBlw== 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=qksOZE9f1ynvBKGDGT85EsWTMq+OvM4y1QlCZBx3Xo4=; b=P+sYf/PN2B2kmJA43iA4iDzt7rL6Ao2VyqBtuOUreiYM6bab9LnvW6fGhqI7W5Ue8MKgBIyvLA4I+C5NwKY0M6KA8SRkHjq7Dxswr9l1i60irVoH4Hg//UH2g1XpB5RlpqTOYE0oDGL8d8xp53JG949p6QjwRpQ4f64w7kYkHWE= 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 v3 14/17] block: use int64_t instead of uint64_t in driver write handlers Date: Thu, 30 Apr 2020 14:10:30 +0300 Message-Id: <20200430111033.29980-15-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a00ad3a2-14f2-4822-08b8-08d7ecf72f47 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:128; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CSscPrl4bbwOWTEtuMAeQnk/k8M3gNlSxdyv7hUAY/vyJLpksWYy9r5mpj5xfxD4N7OMiSqpNuoQdfcUG77nQrT4LV9fOKixVAvQJdz+YEhhVFgSnv57RTelBJk34KWjz3OX9VCNBbS1FOFp1Wbs40d6bRFX1C3+lWvoLlsej5aZnseQ4phVgv+WtthHK0J9wWBLIRS2pqTLd6S4HbbHLa74m7nQ8I/IfFXB1pVTKGV/s7SDLRyWgIvsSGQUh0XYFYKjfAKzjw+WhOZW2W7yOkinE5qGWP0fi7IjjxYjzHW7BN7kj4/WCE/wWJOq3npEBB056gDqJji4TwqgUWJjcQh8QstPxiblINB2gK9QIzyaGO/uH16c/Q3ySnkD4k1CpzrD7bscAYfvW7EC3sDAUmIoNCdoUq1POVBnjEA0sDvzbz0/kyd3oUhIVXEgxrAMjB5W3LiQ0YuV8Nf0kDiGbmJK78riqMVKmzTZ3j91iCz0uSWTzpy/r0GVLW7RyrLd 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)(39850400004)(396003)(366004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(30864003)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: sacdCMSe09G4E4qcxRRwDqDndDL3HaGfyGJ8Us99+tIET48Ze+Ax8ppo5E/F2yDwaH5YVBFFmhKYKSYqpBhIkEVQe7mwps3aTM2GZsqU0oqu0UILn5UUe5n5Ei0f1S9/FPs0KhczsBM5nc//dmvxpPvu2zzMLZjiQm2y9juoTbYXw7wMT3NKy9wmn1n6zvmXAiLPRVjNd6bfSBiQDwFxyc08PqDWv5K4Cm6rf+hYSyWbuiqRiwk60sGspVM1IXzOMtFtBezWKFk9xlgBmopNnIjhuE1moWVVtJHM7+kL1HtrOWKdlG2drY6LbD1Gcd9yqXfBvFQnieePjlUE6td6GV9FcfCRBspdqqaKbHtxOai1RLS2Thtxgi2cYSqN3E9x9wPeggzi9nJcWKEBwqUtkziU6Kr1wvVSvzSEwn0+hG22qA7FuPjXjbjGK3T5M1HoofoXluxsfo4cVPeTK3Y7Ocy8Qw+kcOIgoEv4kPvckqwJ78Jy5gGQ7tnwO5OJ2+715GcBj5zJojxUnlNlk2nmUo0k8vMD/RVXoApzrFoOxpqBefHOvZE9HAcuszmyCpClMazY95uRhEebvVHgW0Xr3kwHZWFz/grSvPeGLDEwiVcRCMzj09aloVERqAUIzuyodtfGqnGlH9Xp1TzmFTBtW+Q1Q2FDIP1Qje3f4yLvhCZ+9tWHMATiS8CoMOEir1ZEXue/xQgaWQ8kKos4M03stbF8ZTYMKzUbXQZdLYiNJ7l2VfWQ0Wc5rgDjBZqlG7CzhHlUz1dOBlqKmUeV0qwnuLnKCJBO5kVTjZe45326DpA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a00ad3a2-14f2-4822-08b8-08d7ecf72f47 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:09.2875 (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: A7d4i50jI5aBNMGSW2hPNjfUCend4LsaquTK/Jsvs9zd0K8vfD1qZG2xYJ8ZioQB04HLX0o8Fwm4Rju14I/1IMB+kBp2Ww2lF9U/4QMLMNM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.120; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:10 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.120 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert driver write handlers parameters which are already 64bit to signed type. While being here, convert also flags parameter to be BdrvRequestFlags. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 16 ++++++++-------- block/backup-top.c | 6 +++--- block/blkdebug.c | 4 ++-- block/blklogwrites.c | 4 ++-- block/blkreplay.c | 2 +- block/blkverify.c | 4 ++-- block/copy-on-read.c | 5 +++-- block/crypto.c | 4 ++-- block/file-posix.c | 6 +++--- block/file-win32.c | 4 ++-- block/filter-compress.c | 7 ++++--- block/io.c | 6 ++++-- block/mirror.c | 2 +- block/nbd.c | 5 +++-- block/nfs.c | 6 +++--- block/null.c | 9 +++++---- block/nvme.c | 4 ++-- block/qcow.c | 10 +++++----- block/qcow2.c | 6 +++--- block/quorum.c | 5 +++-- block/raw-format.c | 10 +++++----- block/rbd.c | 5 +++-- block/throttle.c | 5 +++-- block/vdi.c | 4 ++-- block/vmdk.c | 8 ++++---- block/vpc.c | 4 ++-- block/vvfat.c | 8 ++++---- block/vxhs.c | 4 ++-- tests/test-block-iothread.c | 2 +- block/trace-events | 2 +- 30 files changed, 88 insertions(+), 79 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 7b5f936269..9e8819bc28 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -183,8 +183,8 @@ struct BlockDriver { int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); BlockAIOCB *(*bdrv_aio_pwritev)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags, - BlockCompletionFunc *cb, void *opaque); + int64_t offset, int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); BlockAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque); BlockAIOCB *(*bdrv_aio_pdiscard)(BlockDriverState *bs, @@ -233,10 +233,11 @@ struct BlockDriver { * The buffer in @qiov may point directly to guest memory. */ int coroutine_fn (*bdrv_co_pwritev)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags); + int64_t offset, int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_pwritev_part)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, size_t qiov_offset, int flags); + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_off= set, + BdrvRequestFlags flags); =20 /* * Efficiently zero a region of the disk image. Typically an image fo= rmat @@ -365,10 +366,9 @@ struct BlockDriver { Error **errp); =20 int coroutine_fn (*bdrv_co_pwritev_compressed)(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov); + int64_t offset, int64_t bytes, QEMUIOVector *qiov); int coroutine_fn (*bdrv_co_pwritev_compressed_part)(BlockDriverState *= bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, - size_t qiov_offset); + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_off= set); =20 int (*bdrv_snapshot_create)(BlockDriverState *bs, QEMUSnapshotInfo *sn_info); diff --git a/block/backup-top.c b/block/backup-top.c index 289fee5a92..519c7ea5ad 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -87,9 +87,9 @@ static int coroutine_fn backup_top_co_pwrite_zeroes(Block= DriverState *bs, } =20 static coroutine_fn int backup_top_co_pwritev(BlockDriverState *bs, - uint64_t offset, - uint64_t bytes, - QEMUIOVector *qiov, int flag= s) + int64_t offset, int64_t byte= s, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { int ret =3D backup_top_cbw(bs, offset, bytes, flags); if (ret < 0) { diff --git a/block/blkdebug.c b/block/blkdebug.c index 7e02156c63..e47a686628 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -640,8 +640,8 @@ blkdebug_co_preadv(BlockDriverState *bs, int64_t offset= , int64_t bytes, } =20 static int coroutine_fn -blkdebug_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +blkdebug_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int err; =20 diff --git a/block/blklogwrites.c b/block/blklogwrites.c index db60b396bc..f9697aaa75 100644 --- a/block/blklogwrites.c +++ b/block/blklogwrites.c @@ -466,8 +466,8 @@ blk_log_writes_co_do_file_pdiscard(BlkLogWritesFileReq = *fr) } =20 static int coroutine_fn -blk_log_writes_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t = bytes, - QEMUIOVector *qiov, int flags) +blk_log_writes_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t by= tes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { return blk_log_writes_co_log(bs, offset, bytes, qiov, flags, blk_log_writes_co_do_file_pwritev, 0, fal= se); diff --git a/block/blkreplay.c b/block/blkreplay.c index c8dd17bfff..98b8dff860 100644 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -84,7 +84,7 @@ static int coroutine_fn blkreplay_co_preadv(BlockDriverSt= ate *bs, } =20 static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags fl= ags) { uint64_t reqid =3D blkreplay_next_id(); int ret =3D bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); diff --git a/block/blkverify.c b/block/blkverify.c index 6bc2982a95..796e100eda 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -253,8 +253,8 @@ blkverify_co_preadv(BlockDriverState *bs, int64_t offse= t, int64_t bytes, } =20 static int coroutine_fn -blkverify_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +blkverify_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BlkverifyRequest r; return blkverify_co_prwv(bs, &r, offset, bytes, qiov, qiov, flags, tru= e); diff --git a/block/copy-on-read.c b/block/copy-on-read.c index c2a0916b66..174e711393 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -84,8 +84,9 @@ static int coroutine_fn cor_co_preadv(BlockDriverState *b= s, =20 =20 static int coroutine_fn cor_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { =20 return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); diff --git a/block/crypto.c b/block/crypto.c index 4df71b25f1..c873f42f79 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -398,8 +398,8 @@ block_crypto_co_preadv(BlockDriverState *bs, int64_t of= fset, int64_t bytes, =20 =20 static coroutine_fn int -block_crypto_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t by= tes, - QEMUIOVector *qiov, int flags) +block_crypto_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t byte= s, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BlockCrypto *crypto =3D bs->opaque; uint64_t cur_bytes; /* number of bytes in current iteration */ diff --git a/block/file-posix.c b/block/file-posix.c index 1026e6040b..2c21f785b4 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1948,9 +1948,9 @@ static int coroutine_fn raw_co_preadv(BlockDriverStat= e *bs, int64_t offset, return raw_co_prw(bs, offset, bytes, qiov, QEMU_AIO_READ); } =20 -static int coroutine_fn raw_co_pwritev(BlockDriverState *bs, uint64_t offs= et, - uint64_t bytes, QEMUIOVector *qiov, - int flags) +static int coroutine_fn raw_co_pwritev(BlockDriverState *bs, int64_t offse= t, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { assert(flags =3D=3D 0); return raw_co_prw(bs, offset, bytes, qiov, QEMU_AIO_WRITE); diff --git a/block/file-win32.c b/block/file-win32.c index 8a163837ab..f4d2e7af3a 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -430,8 +430,8 @@ static BlockAIOCB *raw_aio_preadv(BlockDriverState *bs, } =20 static BlockAIOCB *raw_aio_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags fl= ags, BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s =3D bs->opaque; diff --git a/block/filter-compress.c b/block/filter-compress.c index e61de56b96..09c0201c51 100644 --- a/block/filter-compress.c +++ b/block/filter-compress.c @@ -73,10 +73,11 @@ static int coroutine_fn compress_co_preadv_part(BlockDr= iverState *bs, =20 =20 static int coroutine_fn compress_co_pwritev_part(BlockDriverState *bs, - uint64_t offset, - uint64_t bytes, + int64_t offset, + int64_t bytes, QEMUIOVector *qiov, - size_t qiov_offset, int f= lags) + size_t qiov_offset, + BdrvRequestFlags flags) { return bdrv_co_pwritev_part(bs->file, offset, bytes, qiov, qiov_offset, flags | BDRV_REQ_WRITE_COMPRESSED); diff --git a/block/io.c b/block/io.c index db8b3b153d..bec5a3143f 100644 --- a/block/io.c +++ b/block/io.c @@ -977,7 +977,8 @@ out: static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, QEMUIOVector *qiov, - size_t qiov_offset, int flags) + size_t qiov_offset, + BdrvRequestFlags flags) { BlockDriver *drv =3D bs->drv; int64_t sector_num; @@ -1783,7 +1784,8 @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t of= fset, int64_t bytes, */ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, BdrvTrackedRequest *req, int64_t offset, int64_t bytes, - int64_t align, QEMUIOVector *qiov, size_t qiov_offset, int flags) + int64_t align, QEMUIOVector *qiov, size_t qiov_offset, + BdrvRequestFlags flags) { BlockDriverState *bs =3D child->bs; BlockDriver *drv =3D bs->drv; diff --git a/block/mirror.c b/block/mirror.c index 7cd720ac32..ac3d4bc8c5 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1419,7 +1419,7 @@ out: } =20 static int coroutine_fn bdrv_mirror_top_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags fl= ags) { MirrorBDSOpaque *s =3D bs->opaque; QEMUIOVector bounce_qiov; diff --git a/block/nbd.c b/block/nbd.c index fedad8843f..8cd417f018 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -1219,8 +1219,9 @@ static int nbd_client_co_preadv(BlockDriverState *bs,= int64_t offset, return ret ? ret : request_ret; } =20 -static int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov, int f= lags) +static int nbd_client_co_pwritev(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVNBDState *s =3D (BDRVNBDState *)bs->opaque; NBDRequest request =3D { diff --git a/block/nfs.c b/block/nfs.c index 647250e4d8..9f049e8c2e 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -298,9 +298,9 @@ static int coroutine_fn nfs_co_preadv(BlockDriverState = *bs, int64_t offset, return 0; } =20 -static int coroutine_fn nfs_co_pwritev(BlockDriverState *bs, uint64_t offs= et, - uint64_t bytes, QEMUIOVector *iov, - int flags) +static int coroutine_fn nfs_co_pwritev(BlockDriverState *bs, int64_t offse= t, + int64_t bytes, QEMUIOVector *iov, + BdrvRequestFlags flags) { NFSClient *client =3D bs->opaque; NFSRPC task; diff --git a/block/null.c b/block/null.c index e2a59caf46..30d9f5c6b7 100644 --- a/block/null.c +++ b/block/null.c @@ -130,8 +130,9 @@ static coroutine_fn int null_co_preadv(BlockDriverState= *bs, } =20 static coroutine_fn int null_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { return null_co_common(bs); } @@ -203,8 +204,8 @@ static BlockAIOCB *null_aio_preadv(BlockDriverState *bs, } =20 static BlockAIOCB *null_aio_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags f= lags, BlockCompletionFunc *cb, void *opaque) { diff --git a/block/nvme.c b/block/nvme.c index c79e398bff..d91bbe60bf 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1070,8 +1070,8 @@ static coroutine_fn int nvme_co_preadv(BlockDriverSta= te *bs, } =20 static coroutine_fn int nvme_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFla= gs flags) { return nvme_co_prw(bs, offset, bytes, qiov, true, flags); } diff --git a/block/qcow.c b/block/qcow.c index 40fc5b96a4..b7c01415e3 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -725,9 +725,9 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState= *bs, int64_t offset, return ret; } =20 -static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, uint64_t off= set, - uint64_t bytes, QEMUIOVector *qiov, - int flags) +static coroutine_fn int qcow_co_pwritev(BlockDriverState *bs, int64_t offs= et, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVQcowState *s =3D bs->opaque; int offset_in_cluster; @@ -1049,8 +1049,8 @@ static int qcow_make_empty(BlockDriverState *bs) /* XXX: put compressed sectors first, then all the cluster aligned tables to avoid losing bytes in alignment */ static coroutine_fn int -qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov) +qcow_co_pwritev_compressed(BlockDriverState *bs, int64_t offset, int64_t b= ytes, + QEMUIOVector *qiov) { BDRVQcowState *s =3D bs->opaque; z_stream strm; diff --git a/block/qcow2.c b/block/qcow2.c index 817b0bfd2b..ce1c123cb7 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2476,8 +2476,8 @@ static coroutine_fn int qcow2_co_pwritev_task_entry(A= ioTask *task) } =20 static coroutine_fn int qcow2_co_pwritev_part( - BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, size_t qiov_offset, int flags) + BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) { BDRVQcow2State *s =3D bs->opaque; int offset_in_cluster; @@ -4329,7 +4329,7 @@ static coroutine_fn int qcow2_co_pwritev_compressed_t= ask_entry(AioTask *task) */ static coroutine_fn int qcow2_co_pwritev_compressed_part(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset) { BDRVQcow2State *s =3D bs->opaque; diff --git a/block/quorum.c b/block/quorum.c index 3c65c05d17..2c515659c6 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -706,8 +706,9 @@ static void write_quorum_entry(void *opaque) } } =20 -static int quorum_co_pwritev(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov, int flags) +static int quorum_co_pwritev(BlockDriverState *bs, int64_t offset, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { BDRVQuorumState *s =3D bs->opaque; QuorumAIOCB *acb =3D quorum_aio_get(bs, qiov, offset, bytes, flags); diff --git a/block/raw-format.c b/block/raw-format.c index 709b8aecdb..3a393a31c7 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -206,9 +206,9 @@ static int coroutine_fn raw_co_preadv(BlockDriverState = *bs, int64_t offset, return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags); } =20 -static int coroutine_fn raw_co_pwritev(BlockDriverState *bs, uint64_t offs= et, - uint64_t bytes, QEMUIOVector *qiov, - int flags) +static int coroutine_fn raw_co_pwritev(BlockDriverState *bs, int64_t offse= t, + int64_t bytes, QEMUIOVector *qiov, + BdrvRequestFlags flags) { void *buf =3D NULL; BlockDriver *drv; @@ -249,7 +249,7 @@ static int coroutine_fn raw_co_pwritev(BlockDriverState= *bs, uint64_t offset, qiov =3D &local_qiov; } =20 - ret =3D raw_adjust_offset(bs, (int64_t *)&offset, bytes, true); + ret =3D raw_adjust_offset(bs, &offset, bytes, true); if (ret) { goto fail; } @@ -284,7 +284,7 @@ static int coroutine_fn raw_co_pwrite_zeroes(BlockDrive= rState *bs, { int ret; =20 - ret =3D raw_adjust_offset(bs, (int64_t *)&offset, bytes, true); + ret =3D raw_adjust_offset(bs, &offset, bytes, true); if (ret) { return ret; } diff --git a/block/rbd.c b/block/rbd.c index b7edd685f6..705c8d8ff4 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -1045,8 +1045,9 @@ static BlockAIOCB *qemu_rbd_aio_preadv(BlockDriverSta= te *bs, } =20 static BlockAIOCB *qemu_rbd_aio_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque) { diff --git a/block/throttle.c b/block/throttle.c index 63d1956074..af8cc3b2dd 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -126,8 +126,9 @@ static int coroutine_fn throttle_co_preadv(BlockDriverS= tate *bs, } =20 static int coroutine_fn throttle_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t byte= s, - QEMUIOVector *qiov, int flags) + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, + BdrvRequestFlags flags) { ThrottleGroupMember *tgm =3D bs->opaque; throttle_group_co_io_limits_intercept(tgm, bytes, true); diff --git a/block/vdi.c b/block/vdi.c index 1b5365f34c..8b00f29544 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -603,8 +603,8 @@ vdi_co_preadv(BlockDriverState *bs, int64_t offset, int= 64_t bytes, } =20 static int coroutine_fn -vdi_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vdi_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVVdiState *s =3D bs->opaque; QEMUIOVector local_qiov; diff --git a/block/vmdk.c b/block/vmdk.c index a1a0a77fe9..61b409ebc7 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2048,8 +2048,8 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_= t offset, } =20 static int coroutine_fn -vmdk_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vmdk_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; BDRVVmdkState *s =3D bs->opaque; @@ -2060,8 +2060,8 @@ vmdk_co_pwritev(BlockDriverState *bs, uint64_t offset= , uint64_t bytes, } =20 static int coroutine_fn -vmdk_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, - uint64_t bytes, QEMUIOVector *qiov) +vmdk_co_pwritev_compressed(BlockDriverState *bs, int64_t offset, int64_t b= ytes, + QEMUIOVector *qiov) { if (bytes =3D=3D 0) { /* The caller will write bytes 0 to signal EOF. diff --git a/block/vpc.c b/block/vpc.c index 45c254c3f7..1babc21462 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -662,8 +662,8 @@ fail: } =20 static int coroutine_fn -vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vpc_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { BDRVVPCState *s =3D bs->opaque; int64_t image_offset; diff --git a/block/vvfat.c b/block/vvfat.c index 80d488f556..81c86c9243 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3073,8 +3073,8 @@ DLOG(checkpoint()); } =20 static int coroutine_fn -vvfat_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +vvfat_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; BDRVVVFATState *s =3D bs->opaque; @@ -3111,8 +3111,8 @@ static int coroutine_fn vvfat_co_block_status(BlockDr= iverState *bs, } =20 static int coroutine_fn -write_target_commit(BlockDriverState *bs, uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags) +write_target_commit(BlockDriverState *bs, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; =20 diff --git a/block/vxhs.c b/block/vxhs.c index a1e437b2cb..e9abef1819 100644 --- a/block/vxhs.c +++ b/block/vxhs.c @@ -488,8 +488,8 @@ static BlockAIOCB *vxhs_aio_preadv(BlockDriverState *bs, } =20 static BlockAIOCB *vxhs_aio_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, + int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags f= lags, BlockCompletionFunc *cb, void *opaque) { return vxhs_aio_rw(bs, offset, qiov, bytes, cb, opaque, VDISK_AIO_WRIT= E); diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c index 9567617c50..f5eb80d21b 100644 --- a/tests/test-block-iothread.c +++ b/tests/test-block-iothread.c @@ -40,7 +40,7 @@ static int coroutine_fn bdrv_test_co_preadv(BlockDriverSt= ate *bs, } =20 static int coroutine_fn bdrv_test_co_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t byt= es, + int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { diff --git a/block/trace-events b/block/trace-events index e4d68438af..b7fc837015 100644 --- a/block/trace-events +++ b/block/trace-events @@ -78,7 +78,7 @@ luring_resubmit_short_read(void *s, void *luringcb, int n= read) "LuringState %p l =20 # qcow2.c qcow2_add_task(void *co, void *bs, void *pool, const char *action, int clu= ster_type, uint64_t file_cluster_offset, uint64_t offset, uint64_t bytes, v= oid *qiov, size_t qiov_offset) "co %p bs %p pool %p: %s: cluster_type %d fi= le_cluster_offset %" PRIu64 " offset %" PRIu64 " bytes %" PRIu64 " qiov %p = qiov_offset %zu" -qcow2_writev_start_req(void *co, int64_t offset, int bytes) "co %p offset = 0x%" PRIx64 " bytes %d" +qcow2_writev_start_req(void *co, int64_t offset, int64_t bytes) "co %p off= set 0x%" PRIx64 " bytes %" PRId64 qcow2_writev_done_req(void *co, int ret) "co %p ret %d" qcow2_writev_start_part(void *co) "co %p" qcow2_writev_done_part(void *co, int cur_bytes) "co %p cur_bytes %d" --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245865; cv=pass; d=zohomail.com; s=zohoarc; b=g/R4ePr4fJKsTY9SWXsPEOa8KY2burmdowF3EWBnk3qXMi1q5n/rG53+8+N/VjIUYYhZsBz+i3fP3d7mHmfhQBvkOp/9qsVX8TE/k7IoerK3z2+gh50pPSC0TLlgGwRuE8slophar8BD8o346jOdexUrb6VughuVxF+px3bo16A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245865; 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=QQgyQIl/97Xztt4TT3uchoaV2bXyusN1mPYn+I5K4ZY=; b=PsBuwUMHY/nXpIFlYHp9o/hytT87P2RrIwTDwfEZGj4ZCUsZIkZWUBSHmuvzEtlZvzy+kvj+GXH7lIdpaeP0Jz9FmdSoFIHXkPax8MHdW11qG3dPJvLH0uq4CP6w1B5C+uHvsWBiNJvxNKgka7+IfwbCB747v5Avm228nLU0bgo= 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 1588245865462647.311517854291; Thu, 30 Apr 2020 04:24:25 -0700 (PDT) Received: from localhost ([::1]:50420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Im-0006Fd-3H for importer@patchew.org; Thu, 30 Apr 2020 07:24:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57834) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78h-0007Dx-S3 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU78K-0005Qb-GL for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:13:59 -0400 Received: from mail-eopbgr70120.outbound.protection.outlook.com ([40.107.7.120]:6058 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU761-0003ZE-Pz; Thu, 30 Apr 2020 07:11:13 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:11:10 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:10 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=czPzxvBdKVNSF3pRcvihWlkRjml01Ib/bMDpfcSeM8VAGzG2GrKQw/8RdwEhRcFi0uGlWuVX2A1VC+x0liKogieKVITeGfnQcnc+2rhQGFfyM6MfyumKrlkEJ3oj+yf3+uK8RUI1Wje8tZKsghIG2pYGaPaUigo4lAk+oGdVeMMXxDwjIfa+qwKoeJH0L/bAQ1c4ZyCMgzzg7rS5c+0bkdwDXXOkX8fr47I3W3lyUlXRRbjRBapjwAOYwIclZS7pivo7O80THahwgDXdNqdc/XKspHkuxk3gu1bdqNPlvUYvRQm7IfDIHv7gde1zqgEusXO24K7jOzeJWxq1NQ1b+A== 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=QQgyQIl/97Xztt4TT3uchoaV2bXyusN1mPYn+I5K4ZY=; b=FYKoODsi8SHCnXIfzVnfvQJVV3wapC77W8Gv9GIJCLxs0bVy8zZT+r5qDHSGPs5Xm1/V/1hbFkt0qU39pc/Gb6M8n+32/afc6Qt7/sYUbMqMajpbXbb1Czz810o4CA1EJS54hpH4msKsZBirai1Q8pOkPvj73wVMRrZO0Q+KJbiDFPjCFmkkXaZ7ruquxKyq6gBHxP1crpR7zv5eGQuZGEvjEXYRes5KPqGaf9tzzu85bvcJQir5dkrl29Qtm13styeM8LR+LS8n29YgDkGkkogY/KosJ7AWAhnWCcg75Y+NpvTn+VNDyFwRRPpqnFinXBHLbEcUHh8QVoKo7pfTjA== 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=QQgyQIl/97Xztt4TT3uchoaV2bXyusN1mPYn+I5K4ZY=; b=PX1Hz063DVrmCv1WBfhiQ2WQ5t/leWVlkbu/9u33kNSC1ofy3pJ0G58NgBZfOyjPBbQbUltodWfbVuMgHJfR2sNguFzP3k86YZs7Bo1H4VYmET8tmfG/igc82lrRFU2hke/kkvTtZMHeZDlxPS9DLDiUHp/yJHrOn+AhN8w9wV4= 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 v3 15/17] block: use int64_t instead of uint64_t in copy_range driver handlers Date: Thu, 30 Apr 2020 14:10:31 +0300 Message-Id: <20200430111033.29980-16-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6118a362-77ad-4b04-9d64-08d7ecf7302a X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:389; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3BdQeDlTlzNHfb9Jfg01hcMU7qLveEO83NJTOlwUqU4NcW8sEQqq85XO0twAT+iE8tzfRbMClC69YSlubPoMtOnuDADYpYTYKZW54LldIdi+fLX9flmlLSKOUgcLCBRjGfBTWpg8i/9CjM/6yrCHvP5dPVzruY95qFbxYid7RaVdLtlVAmiP0XLbu2X52dlkaFECz1ylUVGrKcUVTstFJFKMgZ+7kCIU6x9o8XQBMzBMvUsAKgFwpsmS7nkC/B0sMB/28Qjg0m1WISxWQ2Zd6tV3ePHIqkkt2gnxNrw1TANQcTsW44OAqP0u1Y+0hQx9z4hvaEGuSHwSetYJTDBSitvv0CodueA8jT4pU3LAnsvCgQhI5czgbuFtWgc8CR5637iUa8SsSO3gFZ6OC7pOVQ3uIS+BU+xL7dFe5YsmqoTGuQumN4ySEA4VavOGc1/h 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)(39850400004)(396003)(366004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: dp+oxKhEuSOk+6C6/029g3l25ppK5x0YUxfbBygkbOB0EumECIuBbDgQq+bvI0KwTKf0R6nZiyUV4K022BrGGpcgQruid4CCFuJBpuxG4rlv/LFixFRsJu/8OmHVUEmIPdajpvR6QAKyBG3hRA5TrRWLHHDDjXimRS6PQdjpm+nOdn53BeNtwYsE26H6SXthT6pLAhaeBTRmdpxxb3MBtlvjQEOwGjtnZOAQDqe06TvCP2SCgsEC+Tu04gPi2XOUy0kQxjGhcs2AeWT804mW5Eu/DOCdnTxjBV6Rm5v/rHEgsXm1ieDJIDyLO0VR2H2TOTuT7rM/BcA7KNgBl/Le+eLVoSxBvX+iAVQrM9GFUsKIL4Xeua6FWcSFXhcfeeBF6CpcNzR/4JkOHp5tO3ckKhFVgaPDEjHwVcdX0dwVk7ZbSTo79FoCl8DSk5xXjV74+0sx4CrUFrQpNvY92OBwzJ8JNe9yhaZuj1XQLAY3HCJZjy+Ah7vlz+yHFEnwAZvFwfz9iao88TPou8K2gCL69/EpEfLu+YUYtO6xsR+kwVKu7QwxQ367rXHJtIk/+sP5AGADlqZ059nczNzOk4tS4krG5kTvLiVAlR+zZ/T19eYo9SRubPgGk5JqmSkVrzQ4KqibCAvGoj5MtRIWmbw23eYUdxUoFB1Uv0wmdYS4P+mmpeLxweDyzAdW2jTVprPdl4vjES+C5pzaa9XuvP3u3AUTUuawNP9RpTR8VL57Lq3ONIlerkMceWUCAWnCK8bAUIUjTMgnoMt0QyXx465Ykz4k0sVBtN/8TLismHC7z7g= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6118a362-77ad-4b04-9d64-08d7ecf7302a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:10.7700 (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: wM/Ag49DemOmZuXlHOvktJODfSAykmmJwSi51l6b77VJwc9R40Lk4VSak5vc01mmByyX3YkV0ejsSUDsaA2lf3SaiqGpPA4Qsrshc13xJps= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.120; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:10 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.120 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert driver copy_range handlers parameters which are already 64bit to signed type. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 12 ++++++------ block/file-posix.c | 10 +++++----- block/iscsi.c | 12 ++++++------ block/qcow2.c | 12 ++++++------ block/raw-format.c | 16 ++++++++-------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 9e8819bc28..3f08baeff0 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -259,10 +259,10 @@ struct BlockDriver { */ int coroutine_fn (*bdrv_co_copy_range_from)(BlockDriverState *bs, BdrvChild *src, - uint64_t offset, + int64_t offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flag= s, BdrvRequestFlags write_fla= gs); =20 @@ -276,10 +276,10 @@ struct BlockDriver { */ int coroutine_fn (*bdrv_co_copy_range_to)(BlockDriverState *bs, BdrvChild *src, - uint64_t src_offset, + int64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags= ); =20 diff --git a/block/file-posix.c b/block/file-posix.c index 2c21f785b4..38c1398494 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3034,8 +3034,8 @@ static void raw_abort_perm_update(BlockDriverState *b= s) } =20 static int coroutine_fn raw_co_copy_range_from( - BlockDriverState *bs, BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, uint64_t bytes, + BlockDriverState *bs, BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, @@ -3044,10 +3044,10 @@ static int coroutine_fn raw_co_copy_range_from( =20 static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs, BdrvChild *src, - uint64_t src_offset, + int64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { diff --git a/block/iscsi.c b/block/iscsi.c index 0b4b7210df..861a70c823 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -2180,10 +2180,10 @@ static void coroutine_fn iscsi_co_invalidate_cache(= BlockDriverState *bs, =20 static int coroutine_fn iscsi_co_copy_range_from(BlockDriverState *bs, BdrvChild *src, - uint64_t src_offset, + int64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_fla= gs, BdrvRequestFlags write_fl= ags) { @@ -2321,10 +2321,10 @@ static void iscsi_xcopy_data(struct iscsi_data *dat= a, =20 static int coroutine_fn iscsi_co_copy_range_to(BlockDriverState *bs, BdrvChild *src, - uint64_t src_offset, + int64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flag= s) { diff --git a/block/qcow2.c b/block/qcow2.c index ce1c123cb7..15a6d3c6ef 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3810,9 +3810,9 @@ static coroutine_fn int qcow2_co_pdiscard(BlockDriver= State *bs, =20 static int coroutine_fn qcow2_co_copy_range_from(BlockDriverState *bs, - BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, - uint64_t bytes, BdrvRequestFlags read_flags, + BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { BDRVQcow2State *s =3D bs->opaque; @@ -3891,9 +3891,9 @@ out: =20 static int coroutine_fn qcow2_co_copy_range_to(BlockDriverState *bs, - BdrvChild *src, uint64_t src_offset, - BdrvChild *dst, uint64_t dst_offset, - uint64_t bytes, BdrvRequestFlags read_flags, + BdrvChild *src, int64_t src_offset, + BdrvChild *dst, int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { BDRVQcow2State *s =3D bs->opaque; diff --git a/block/raw-format.c b/block/raw-format.c index 3a393a31c7..fdf024705b 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -507,16 +507,16 @@ static int raw_probe_geometry(BlockDriverState *bs, H= DGeometry *geo) =20 static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs, BdrvChild *src, - uint64_t src_offset, + int64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flag= s) { int ret; =20 - ret =3D raw_adjust_offset(bs, (int64_t *)&src_offset, bytes, false); + ret =3D raw_adjust_offset(bs, &src_offset, bytes, false); if (ret) { return ret; } @@ -526,16 +526,16 @@ static int coroutine_fn raw_co_copy_range_from(BlockD= riverState *bs, =20 static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs, BdrvChild *src, - uint64_t src_offset, + int64_t src_offset, BdrvChild *dst, - uint64_t dst_offset, - uint64_t bytes, + int64_t dst_offset, + int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags) { int ret; =20 - ret =3D raw_adjust_offset(bs, (int64_t *)&dst_offset, bytes, true); + ret =3D raw_adjust_offset(bs, &dst_offset, bytes, true); if (ret) { return ret; } --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245957; cv=pass; d=zohomail.com; s=zohoarc; b=EmEt8QPXODBHas2/uLyVUsjAFPoptQ5X0DlBvJ1DLXv6B22/zMd4vJ4ooZMxL7jXgGP7+eaAbYDsTu80+IU19eICvtbhw+BkU1vN8rn7Gdc+EoSPdCffMhliP4JL/i4yrgrWXova4U9goPvr7zb7HnkXKvlGDZRKo4UgHh70k5k= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245957; 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=/58aRH73IHGHhfUO6Z1+nmWkxa+Uq7D/NJoMhB5eTVw=; b=lHAiaMKa/dBQxyTq20XPmtWO3D0F1M1Qd/qwn9DKJ4RCl1YbhCXBDXHYRCDHN9/meP2Q2A3DjZT6M8rw7spXJwajSfyP1BY9kxcdW8PeLz9wuvM/ex8ac1ZgI2gHvxtfY6P7ev31sC3zWGednSCnRi4ZXBYp+qSnexriqh29F/c= 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 1588245957662726.6134743084107; Thu, 30 Apr 2020 04:25:57 -0700 (PDT) Received: from localhost ([::1]:55584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7KG-0000EI-AZ for importer@patchew.org; Thu, 30 Apr 2020 07:25:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57844) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78j-0007FP-Bl for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU78M-0005Vy-0d for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:01 -0400 Received: from mail-eopbgr70120.outbound.protection.outlook.com ([40.107.7.120]:6058 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU762-0003ZE-UI; Thu, 30 Apr 2020 07:11:15 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:11:12 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:12 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P53jVKWzBw0UfO1DlkoqPcjCmliQ8tUBKsHuAOCeEt30Q3LIiN1k9tzUXInk+y+upfCHK2r2XvorxAED50AVhNXfiX2CiwabsU5VqICVZjnoiZFJngpPggxW1Cvnrg5G4WL+ud569A2kY1f9bI3/8+x8QxYBLZND01dsbP8C9q8hkW6WPDlWZL84UXJRJCNlWu4HTHPPVqUa4f5DHmnEgupNEYlxhz06L0hRiKvOiH2tDWNY3oG8/i1daIG3rlGhJBg/eEtk5HnDWAWD2OiUsyP8A/pxnMW6ogI24OJ8PiqKT86OM411OXlKP/OnKPCIUXHalJk7tfX8VWetx0yhVw== 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=/58aRH73IHGHhfUO6Z1+nmWkxa+Uq7D/NJoMhB5eTVw=; b=cusP4Tvqop9tkVSo5EAWWEKu6w4V5lEvgzHlzTMfmCzMthTiStNwYtHCs9f7eq5NaRQUcvISRbDsqhrvP9Nr2gDj//M5Kkzmj9ggtteFDi++3AfeIXccAPvaDiHQgWwApm2rEiLkzLR4vFJ8NOi83EmX0jGu5OmtNgAZ5RIsw/RfO/0d8pyKGSRrsTh/0nrE1wSY6FgffnsmLDn/ah5t6RpI4tM09dwl8a0TMO5kMNQ7n3ZIWSH2kb0E0nYNwQkj4AMoyY7tSEKHVbQiwWYwSOnsTg7wyeVWfBVNAtIwDikmpWK6IQCgXxRrGMUnJvV3HUWyC46IgvZnICxg7+TT7w== 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=/58aRH73IHGHhfUO6Z1+nmWkxa+Uq7D/NJoMhB5eTVw=; b=hMrs/UrE079vMtc7nxaWCmAMfib4Daj19lSBEyKNGh4wZTkv9K6ssXWcwoyG7DDVzc2CUTi6RfvX0fWD6yVRIY/zHHdOERj3rNNLX8EuhYyiL4wsVSB6TgPJ8c+aULZqXI+06cCTwwDBwecLinGFzpcpaOeRbzHE4g7ixCFKZUg= 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 v3 16/17] block: use int64_t instead of int in driver write_zeroes handlers Date: Thu, 30 Apr 2020 14:10:32 +0300 Message-Id: <20200430111033.29980-17-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c31fb43-9fe2-4f49-c0da-08d7ecf73112 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:626; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VZazNdtzCLZp1p9I1ZJNULw2tbbEQutiAeN8hBTZ1s7KTHtzwP6a/DB5UTgY+iu0LFkYkPuoqMWr7T3gJswwFH/AYTeywm6AuiM3DA0UyztXfn0gY37mvQjTsIMQartBcDkYNrMtd8QIpPkYezgo10arO7rKVqSFm3jo1ojg1HrJE5QL//WCuaSlTpX3O4aUr7Q5nzP57nzH0eABBXmTsIW/y9g+QQscW4k2ag6t7SD5kWN0hqKeiiiVHLpc5d72YshbKoxIk5M8eb+z13mQ2zL+lxlkaruBK1/bU+XaxKfXHx9EQczgtl2JwbJXCjlusoaZQHCXl2wBhUIS/AcoZcyEb93EXXxvzF1PsiMUNERgVtgrO9Hd/OM5Qa4OS2u4Jrf/c5PhFxsBGhnWHHHxUpPPAq2cDYlWDAx4iLix3TCKR4bVncZDxwn6u8aA+Luz 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)(39850400004)(396003)(366004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(30864003)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ks52jpCHXZYKhDK2poPwn9BC3hLKA5bhyQ+FLa7o2+yCx3B83ixATEPst8pVXfVdFKdaofewhTQtaUy+slRIlDj9oMAEfsNpisH+20LXop9FuMD6klJLgygD9VQrK256wxYymAa6GF0GRyBVhF3Fd1YM9ZS8e1HMMVOLMel447JV2cB0Cwm6BZqPJ/4Pfm9XatxW+gN0XdHb1t3lQL0ky3J6BuGmllULNA80DRjLc5ckI7y9CNB44I+HZyS7hCnqeZqloLAqH40dEDtqtBY46l5Frz64pYKzxeUIec7V5/wB/PWFFxI/OIBqrryDb4wlRfzmzbpe8/gzfkVqj+a0LFbgsvaFQhn62F+raACWDNSoyMWvJsnxgp1QVZ64lFfl8iSrKvd6KYTCQ3uhkwivu6MDgvfVB9PEmSvebmBiI2ozbs63MYMS8SggMCiGtpCW1TDQMz2SmYEppGHqlxh6oNcjwZmnIrXOantUgo2h+LBzX9z04b9SymIAR8uwr54ROSDOHKysHC9hxAAu7JnuJ2LNSBYFxTphAtuXwOvlGlQYeGfFsPYW5b2jwbNh2IpO4DWog0wN2WEm1ZdVWN2zJe6Tj2rMeb6GP0T6nVM2smlt4XGBYRe4Cl3amhuq4UmJiEEdA4q3NBNqhJseAxBZ5yY44JWRzsVahLK0IiAigs3UxItJ9r/i0tOkuR/gGwHcbn44wVzq/r5xSvCJUkpUn+uB0DiOtLIinIpnyacdnLzsCVEwg06kZ8reNzGxRtOlrldiwh93deP7KGFcthtYXbls50fiX32K5aaZktd2DhY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c31fb43-9fe2-4f49-c0da-08d7ecf73112 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:12.2914 (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: p/hYSPLvsS0cagsx1HUnPCAvndrSpNKXn8IyoGgatbm4KcIo6RvytlelsTVnzYY1mQlt+2KzrVQdkDziuJzAkFIJurJP8kgMa8lBQL+/bxI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.120; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:10 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.120 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert driver write_zeroes handlers bytes parameter to int64_t. This patch just converts handlers where it is obvious that bytes parameter is passed further to 64bit interfaces, and add simple wrappers where it is not obvious. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 2 +- block/backup-top.c | 2 +- block/blkdebug.c | 2 +- block/blklogwrites.c | 4 ++-- block/blkreplay.c | 2 +- block/copy-on-read.c | 2 +- block/file-posix.c | 6 +++--- block/filter-compress.c | 2 +- block/gluster.c | 8 +++++--- block/iscsi.c | 12 ++++++++++-- block/mirror.c | 2 +- block/nbd.c | 4 +++- block/nvme.c | 16 ++++++++++++---- block/qcow2.c | 9 ++++++++- block/qed.c | 17 +++++++++++++---- block/raw-format.c | 2 +- block/throttle.c | 2 +- block/vmdk.c | 2 +- 18 files changed, 66 insertions(+), 30 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 3f08baeff0..c98d591a56 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -246,7 +246,7 @@ struct BlockDriver { * will be called instead. */ int coroutine_fn (*bdrv_co_pwrite_zeroes)(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags); + int64_t offset, int64_t bytes, BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_pdiscard)(BlockDriverState *bs, int64_t offset, int bytes); =20 diff --git a/block/backup-top.c b/block/backup-top.c index 519c7ea5ad..2484293fb0 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -76,7 +76,7 @@ static int coroutine_fn backup_top_co_pdiscard(BlockDrive= rState *bs, } =20 static int coroutine_fn backup_top_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { int ret =3D backup_top_cbw(bs, offset, bytes, flags); if (ret < 0) { diff --git a/block/blkdebug.c b/block/blkdebug.c index e47a686628..d593d6c85d 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -672,7 +672,7 @@ static int blkdebug_co_flush(BlockDriverState *bs) } =20 static int coroutine_fn blkdebug_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int byte= s, + int64_t offset, int64_t = bytes, BdrvRequestFlags flags) { uint32_t align =3D MAX(bs->bl.request_alignment, diff --git a/block/blklogwrites.c b/block/blklogwrites.c index f9697aaa75..8ca41d09cd 100644 --- a/block/blklogwrites.c +++ b/block/blklogwrites.c @@ -474,8 +474,8 @@ blk_log_writes_co_pwritev(BlockDriverState *bs, int64_t= offset, int64_t bytes, } =20 static int coroutine_fn -blk_log_writes_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int = bytes, - BdrvRequestFlags flags) +blk_log_writes_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, + int64_t bytes, BdrvRequestFlags flags) { return blk_log_writes_co_log(bs, offset, bytes, NULL, flags, blk_log_writes_co_do_file_pwrite_zeroes, = 0, diff --git a/block/blkreplay.c b/block/blkreplay.c index 98b8dff860..186d28cc6a 100644 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -95,7 +95,7 @@ static int coroutine_fn blkreplay_co_pwritev(BlockDriverS= tate *bs, } =20 static int coroutine_fn blkreplay_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { uint64_t reqid =3D blkreplay_next_id(); int ret =3D bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 174e711393..d99e07e99f 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -94,7 +94,7 @@ static int coroutine_fn cor_co_pwritev(BlockDriverState *= bs, =20 =20 static int coroutine_fn cor_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); diff --git a/block/file-posix.c b/block/file-posix.c index 38c1398494..fa9ac5b13e 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2797,7 +2797,7 @@ raw_co_pdiscard(BlockDriverState *bs, int64_t offset,= int bytes) } =20 static int coroutine_fn -raw_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int bytes, +raw_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes, BdrvRequestFlags flags, bool blkdev) { BDRVRawState *s =3D bs->opaque; @@ -2866,7 +2866,7 @@ raw_do_pwrite_zeroes(BlockDriverState *bs, int64_t of= fset, int bytes, =20 static int coroutine_fn raw_co_pwrite_zeroes( BlockDriverState *bs, int64_t offset, - int bytes, BdrvRequestFlags flags) + int64_t bytes, BdrvRequestFlags flags) { return raw_do_pwrite_zeroes(bs, offset, bytes, flags, false); } @@ -3489,7 +3489,7 @@ hdev_co_pdiscard(BlockDriverState *bs, int64_t offset= , int bytes) } =20 static coroutine_fn int hdev_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { int rc; =20 diff --git a/block/filter-compress.c b/block/filter-compress.c index 09c0201c51..7cf47608b5 100644 --- a/block/filter-compress.c +++ b/block/filter-compress.c @@ -85,7 +85,7 @@ static int coroutine_fn compress_co_pwritev_part(BlockDri= verState *bs, =20 =20 static int coroutine_fn compress_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int byte= s, + int64_t offset, int64_t = bytes, BdrvRequestFlags flags) { return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); diff --git a/block/gluster.c b/block/gluster.c index 0aa1f2cda4..88130c3d2d 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -1017,19 +1017,21 @@ static void qemu_gluster_reopen_abort(BDRVReopenSta= te *state) #ifdef CONFIG_GLUSTERFS_ZEROFILL static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, - int size, + int64_t bytes, BdrvRequestFlags fla= gs) { int ret; GlusterAIOCB acb; BDRVGlusterState *s =3D bs->opaque; =20 - acb.size =3D size; + assert(bytes < INT_MAX); + + acb.size =3D bytes; acb.ret =3D 0; acb.coroutine =3D qemu_coroutine_self(); acb.aio_context =3D bdrv_get_aio_context(bs); =20 - ret =3D glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb,= &acb); + ret =3D glfs_zerofill_async(s->fd, offset, bytes, gluster_finish_aiocb= , &acb); if (ret < 0) { return -errno; } diff --git a/block/iscsi.c b/block/iscsi.c index 861a70c823..c4183ef12f 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1204,8 +1204,8 @@ out_unlock: } =20 static int -coroutine_fn iscsi_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, - int bytes, BdrvRequestFlags flags) +coroutine_fn iscsi_co_pwrite_zeroes_old(BlockDriverState *bs, int64_t offs= et, + int bytes, BdrvRequestFlags flags) { IscsiLun *iscsilun =3D bs->opaque; struct IscsiTask iTask; @@ -1308,6 +1308,14 @@ out_unlock: return r; } =20 +static int +coroutine_fn iscsi_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, + int64_t bytes, BdrvRequestFlags flags) +{ + assert(bytes < INT_MAX); + return iscsi_co_pwrite_zeroes_old(bs, offset, bytes, flags); +} + static void apply_chap(struct iscsi_context *iscsi, QemuOpts *opts, Error **errp) { diff --git a/block/mirror.c b/block/mirror.c index ac3d4bc8c5..7f4fdfb470 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1464,7 +1464,7 @@ static int coroutine_fn bdrv_mirror_top_flush(BlockDr= iverState *bs) } =20 static int coroutine_fn bdrv_mirror_top_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { return bdrv_mirror_top_do_write(bs, MIRROR_METHOD_ZERO, offset, bytes,= NULL, flags); diff --git a/block/nbd.c b/block/nbd.c index 8cd417f018..0e52b76d72 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -1245,7 +1245,7 @@ static int nbd_client_co_pwritev(BlockDriverState *bs= , int64_t offset, } =20 static int nbd_client_co_pwrite_zeroes(BlockDriverState *bs, int64_t offse= t, - int bytes, BdrvRequestFlags flags) + int64_t bytes, BdrvRequestFlags fla= gs) { BDRVNBDState *s =3D (BDRVNBDState *)bs->opaque; NBDRequest request =3D { @@ -1254,6 +1254,8 @@ static int nbd_client_co_pwrite_zeroes(BlockDriverSta= te *bs, int64_t offset, .len =3D bytes, }; =20 + assert(bytes < INT_MAX); + assert(!(s->info.flags & NBD_FLAG_READ_ONLY)); if (!(s->info.flags & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; diff --git a/block/nvme.c b/block/nvme.c index d91bbe60bf..724f894b00 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1104,10 +1104,10 @@ static coroutine_fn int nvme_co_flush(BlockDriverSt= ate *bs) } =20 =20 -static coroutine_fn int nvme_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, - int bytes, - BdrvRequestFlags flags) +static coroutine_fn int nvme_co_pwrite_zeroes_old(BlockDriverState *bs, + int64_t offset, + int bytes, + BdrvRequestFlags flags) { BDRVNVMeState *s =3D bs->opaque; NVMeQueuePair *ioq =3D s->queues[1]; @@ -1157,6 +1157,14 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockD= riverState *bs, return data.ret; } =20 +static coroutine_fn int nvme_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, + int64_t bytes, + BdrvRequestFlags flags) +{ + assert(bytes <=3D INT_MAX); + return nvme_co_pwrite_zeroes_old(bs, offset, bytes, flags); +} =20 static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs, int64_t offset, diff --git a/block/qcow2.c b/block/qcow2.c index 15a6d3c6ef..0800d0378a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3727,7 +3727,7 @@ static bool is_zero(BlockDriverState *bs, int64_t off= set, int64_t bytes) return res >=3D 0 && (res & BDRV_BLOCK_ZERO) && nr =3D=3D bytes; } =20 -static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, +static coroutine_fn int qcow2_co_pwrite_zeroes_old(BlockDriverState *bs, int64_t offset, int bytes, BdrvRequestFlags flags) { int ret; @@ -3779,6 +3779,13 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(Block= DriverState *bs, return ret; } =20 +static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, int64_t bytes, BdrvRequestFlags flags) +{ + assert(bytes < INT_MAX); + return qcow2_co_pwrite_zeroes_old(bs, offset, bytes, flags); +} + static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { diff --git a/block/qed.c b/block/qed.c index 1af9b3cb1d..fe00dbbff5 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1439,10 +1439,10 @@ static int coroutine_fn bdrv_qed_co_writev(BlockDri= verState *bs, return qed_co_request(bs, sector_num, qiov, nb_sectors, QED_AIOCB_WRIT= E); } =20 -static int coroutine_fn bdrv_qed_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, - int bytes, - BdrvRequestFlags flags) +static int coroutine_fn bdrv_qed_co_pwrite_zeroes_old(BlockDriverState *bs, + int64_t offset, + int bytes, + BdrvRequestFlags fla= gs) { BDRVQEDState *s =3D bs->opaque; =20 @@ -1463,6 +1463,15 @@ static int coroutine_fn bdrv_qed_co_pwrite_zeroes(Bl= ockDriverState *bs, QED_AIOCB_WRITE | QED_AIOCB_ZERO); } =20 +static int coroutine_fn bdrv_qed_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, + int64_t bytes, + BdrvRequestFlags flags) +{ + assert(bytes <=3D INT_MAX); + return bdrv_qed_co_pwrite_zeroes_old(bs, offset, bytes, flags); +} + static int coroutine_fn bdrv_qed_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, diff --git a/block/raw-format.c b/block/raw-format.c index fdf024705b..0996741056 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -279,7 +279,7 @@ static int coroutine_fn raw_co_block_status(BlockDriver= State *bs, } =20 static int coroutine_fn raw_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { int ret; diff --git a/block/throttle.c b/block/throttle.c index af8cc3b2dd..c97da1d6a7 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -137,7 +137,7 @@ static int coroutine_fn throttle_co_pwritev(BlockDriver= State *bs, } =20 static int coroutine_fn throttle_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int byte= s, + int64_t offset, int64_t = bytes, BdrvRequestFlags flags) { ThrottleGroupMember *tgm =3D bs->opaque; diff --git a/block/vmdk.c b/block/vmdk.c index 61b409ebc7..9611bb191e 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2089,7 +2089,7 @@ vmdk_co_pwritev_compressed(BlockDriverState *bs, int6= 4_t offset, int64_t bytes, =20 static int coroutine_fn vmdk_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, - int bytes, + int64_t bytes, BdrvRequestFlags flags) { int ret; --=20 2.21.0 From nobody Mon May 6 00:47:24 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=1588245808; cv=pass; d=zohomail.com; s=zohoarc; b=aCDtzFI68xRcvdXf8HPWsFDHdmvYcB9ai53qt6Ts0xZqLoLDVh488s8U0N9TvjuoB5nOw5hnM7jxXi45AlHVtTdW5ZbAsZ9PVKR+94xAjziKcBA6+1jHCKdO2bm0pudDjQImHVkgEqET7+oQ2M2Y7YJxkl2W7xfo5afR2eodRTI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588245808; 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=uy8c4Wa2wkGpeKoSpZa0yVNK25XvV07VM5xdsjX0SLg=; b=ko8dxc2KHhJ3f2aVVT+CGoe+XM1B8+KAJlMhzDKgFYxKUNLqLwVFDqcI7K2puMZwPZVZzWa8R4nov3OV63vrBh6TPPbR6Q2ZkIaUSMEbjHfG1K9Iq73t2Wk+fq04k7/NgjBqosT0f/0XUVH4bz7WAyCHyhHfWI3dOuvFHZrZgBY= 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 1588245808786750.9532389002675; Thu, 30 Apr 2020 04:23:28 -0700 (PDT) Received: from localhost ([::1]:46994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU7Hq-0004Ic-Di for importer@patchew.org; Thu, 30 Apr 2020 07:23:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57854) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jU78k-0007GM-FD for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jU78N-0005aL-1h for qemu-devel@nongnu.org; Thu, 30 Apr 2020 07:14:02 -0400 Received: from mail-eopbgr70120.outbound.protection.outlook.com ([40.107.7.120]:6058 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jU764-0003ZE-88; Thu, 30 Apr 2020 07:11:16 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5399.eurprd08.prod.outlook.com (2603:10a6:20b:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 11:11:13 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::acfa:5:88c8:b7b9%3]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 11:11:13 +0000 Received: from kvm.sw.ru (185.215.60.138) by AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 11:11:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f7Q5A5JkCRkDww6YW0JJblLADkeDk43Y/vKuK2kZSDc8qdUgwWPYxXBmTAhMgyQSVj9cNq/XDm8JFTeIdzrCYNri+X3d+povovcuhF7D9kSCx2OWmdCYizDV0RqlQH+0T3MRQETcyuFDjxf9sobuGf9Y+yCOlDIf8HZsWp9PahCkk2JhrULY9HxDhrQTpDh7fpB101K0zXSFLzn2HIE4IM7RQAGRLR5WF3K+4b35aZsTWYHPMuzQkCm3NwI4SSoZF7GlZa56Sfea5bgVVDGFgjMG7wi8dCUtGNKz9wLCLlriHHXZ5nY2pmV/8xnOFX/kNzdT7eDAM9mZsioeA3hvuQ== 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=uy8c4Wa2wkGpeKoSpZa0yVNK25XvV07VM5xdsjX0SLg=; b=DJF/dXFPb0XFkFvsJRQDEzAI3iKp5Rh1D2fGE70YeYbkOY0FekKmXjjWl4S130NsGeTpTZIsJTMym+VgAixtH3Q3lBwBq0223ZfhneT+fbpNdHWQLkRjRWx7UZVm0De+koc1TygiNF2RxTucglOSWxdfEZLJPxkIUFKGuhCpcTyStAbFwYnXsNeJppEvdzxMBIz8px86KQSSu+srtLGtLaW1OXFpobIR4veJSqDKr8BKMDtqWRwgpCuC9369UgJARajhXiBPvpkheRZXYGhq8ZAeGtB0JM7l5YD93/iQ0LkuJKfpNAqGJUPUH3JZ3PFPC8sxO9Hdjwrz/96hjJLI1A== 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=uy8c4Wa2wkGpeKoSpZa0yVNK25XvV07VM5xdsjX0SLg=; b=gCvbNEDdrdT3GyYY/Kj52W6gr8MNafrr/fKjV35defIzSvhJAycu9muBaj/h19ndycMkmW50nDv/cbb2eNKaar5HzCKodUrLFuMEmAcc/nn1g8Ky85x4sv+nbdUEUuiCLCga0qPt+dqfPr2McAt+g71unQtHjUO6fUcNEWYDdOY= 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 v3 17/17] block: use int64_t instead of int in driver discard handlers Date: Thu, 30 Apr 2020 14:10:33 +0300 Message-Id: <20200430111033.29980-18-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200430111033.29980-1-vsementsov@virtuozzo.com> References: <20200430111033.29980-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0021.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::31) 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.0 X-Originating-IP: [185.215.60.138] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df2a0719-9a12-4a84-38ee-08d7ecf73205 X-MS-TrafficTypeDiagnostic: AM7PR08MB5399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:302; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8SFnwmKBLt9YzSxNdx3d2u4JA868cOmfH5rAvhdxCqp7BC2iroA99iR8DiCdPRw4QWY+IKbeCic7fjOV/+En/liUL7HWgkJ1z73jSCxLvnSr0mLHbG6xaX9Wjf27ww+sAyi9fioKfn1YAU0StLNV4Ru1CdzdPbFZi96q5e70Fbd/61w7UEyZfE/l5din8GNzllfIs/tSMJ9nKFCXxLMUUTAw0YWQD9/fcZxMhEMuuZ8Ucy/p3TG3ZERt6ofIAcawNNjXl+ADrrxiilm6XFfOCcrCzU6ImMPoDknBrRhzlPdFd5SG17q+MdpfpEbaOo0txrV5ry/J1wbMfBThnmCLg5sDNLW/JO5+Q2CiXFK5cuZxO9hCdvfIx1ss7e1wlARr97vtW7gxZt9rgTwIPYEVYJP7HwtQuMNJbtyoSzxKeHps4iBq82hof98zsuC5B6x3 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)(39850400004)(396003)(366004)(346002)(136003)(376002)(1076003)(36756003)(478600001)(8936002)(26005)(6512007)(30864003)(7416002)(5660300002)(107886003)(6486002)(66476007)(66556008)(86362001)(6916009)(6506007)(6666004)(8676002)(316002)(2906002)(186003)(66946007)(16526019)(2616005)(956004)(4326008)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 9VevqVdFbu91v5Ab/onrf3UPpTtuxP8i0wNUuwVgaVCjtlZAH0WCnubsEqtg85PUyF+N06X0f0bUIPk4p7iNLsC/i702bNnsu6TEfO87H6q3LQq1l1JMeczwLQeztQ4v1lEtR16iVlTmE+gILaLSYrjQgbIxagle9d9gRHWCPEFCXHNua384t5TDmWySLTao9Z28IRVbacrO9YLnKVV1M5MDCRcOVBZM6T/MAords2A107KLdx3psCEwupv47B7dHF5YaT1UnB/RJacz8mosRUGPBqmV5Mc4KPyMYUnB36TPQGBRrILdo3gl8ud7gcVBJzyKuC3DbpEVP6xxQ3QHd2Xjo7bLoe93ZQu3E2T6t32rhwl0/iBwTFBNrWX0Kt8cCiIthotr+GTHqP1+oGd2Pd8IxsFa3F5D6ONSM0pDPFuyxmTGWAwm9+nMLGziwbnm2NtQnjGPSAH61lgHnoBsIVToSo3QjsU4enDzZuErXSvqwstzHuBS0ZkBnUwefCQpTjliunXBP+QrwrwC/fL2wmF3D0opfZ3gx0I7/M41M0TmLFW5f85KnZdVclQXhzJktZ/9OH1EbYYbXIaKR0PF+DZqdh2SxZD5I4hEjYWHaM4pPUiBkBT75BZulGEzw40SoYJDcvo6+64AvI2mnqy/wTXhhRvzBJKtI59oXyENQryspZxz0NC7mXloUtlAdwxN6MihbZuq43rlBZ84uLIfJqfnwIqElPFlkOqhm4UgLdlNghmHi/T2rfdX7TUXiVqT/JGikZWJdjzFYTbxjEQ+xtgcUJVSwqyhdz3QLyAy18w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: df2a0719-9a12-4a84-38ee-08d7ecf73205 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 11:11:13.8366 (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: 94REndJPVjeFE76xBbr/ozfwT5f26SwCvt57nxpSfSbBomOW4j0wd1NkDLcP6pserOewCsc/gv4ypsOHPcaXnLU4fg8PhDOCRy1ORiKJxn0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5399 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.7.120; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/30 07:11:10 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 40.107.7.120 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, integration@gluster.org, berto@igalia.com, pavel.dovgaluk@ispras.ru, dillaman@redhat.com, qemu-devel@nongnu.org, sw@weilnetz.de, pl@kamp.de, ronniesahlberg@gmail.com, mreitz@redhat.com, den@openvz.org, sheepdog@lists.wpkg.org, vsementsov@virtuozzo.com, stefanha@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com, jsnow@redhat.com, ari@tuxera.com 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 are generally moving to int64_t for both offset and bytes parameters on all io paths. Main motivation is realization of 64-bit write_zeroes operation for fast zeroing large disk chunks, up to the whole disk. We chose signed type, to be consistent with off_t (which is signed) and with possibility for signed return type (where negative value means error). So, convert driver discard handlers bytes parameter to int64_t. This patch just converts handlers where it is obvious that bytes parameter is passed further to 64bit interfaces, and add simple wrappers where it is not obvious. Series: 64bit-block-status Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 2 +- block/backup-top.c | 2 +- block/blkdebug.c | 2 +- block/blklogwrites.c | 4 ++-- block/blkreplay.c | 2 +- block/copy-on-read.c | 2 +- block/file-posix.c | 18 ++++++++++++++++-- block/filter-compress.c | 2 +- block/gluster.c | 6 ++++-- block/iscsi.c | 10 +++++++++- block/mirror.c | 2 +- block/nbd.c | 4 +++- block/nvme.c | 13 ++++++++++--- block/qcow2.c | 2 +- block/raw-format.c | 2 +- block/sheepdog.c | 11 +++++++++-- block/throttle.c | 2 +- 17 files changed, 63 insertions(+), 23 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index c98d591a56..ff8860fee8 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -248,7 +248,7 @@ struct BlockDriver { int coroutine_fn (*bdrv_co_pwrite_zeroes)(BlockDriverState *bs, int64_t offset, int64_t bytes, BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_pdiscard)(BlockDriverState *bs, - int64_t offset, int bytes); + int64_t offset, int64_t bytes); =20 /* Map [offset, offset + nbytes) range onto a child of @bs to copy fro= m, * and invoke bdrv_co_copy_range_from(child, ...), or invoke diff --git a/block/backup-top.c b/block/backup-top.c index 2484293fb0..8c02fa3a58 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -65,7 +65,7 @@ static coroutine_fn int backup_top_cbw(BlockDriverState *= bs, uint64_t offset, } =20 static int coroutine_fn backup_top_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t byt= es) { int ret =3D backup_top_cbw(bs, offset, bytes, 0); if (ret < 0) { diff --git a/block/blkdebug.c b/block/blkdebug.c index d593d6c85d..e1d91cf707 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -705,7 +705,7 @@ static int coroutine_fn blkdebug_co_pwrite_zeroes(Block= DriverState *bs, } =20 static int coroutine_fn blkdebug_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { uint32_t align =3D bs->bl.pdiscard_alignment; int err; diff --git a/block/blklogwrites.c b/block/blklogwrites.c index 8ca41d09cd..f488864106 100644 --- a/block/blklogwrites.c +++ b/block/blklogwrites.c @@ -490,9 +490,9 @@ static int coroutine_fn blk_log_writes_co_flush_to_disk= (BlockDriverState *bs) } =20 static int coroutine_fn -blk_log_writes_co_pdiscard(BlockDriverState *bs, int64_t offset, int count) +blk_log_writes_co_pdiscard(BlockDriverState *bs, int64_t offset, int64_t b= ytes) { - return blk_log_writes_co_log(bs, offset, count, NULL, 0, + return blk_log_writes_co_log(bs, offset, bytes, NULL, 0, blk_log_writes_co_do_file_pdiscard, LOG_DISCARD_FLAG, false); } diff --git a/block/blkreplay.c b/block/blkreplay.c index 186d28cc6a..34a12ad5ac 100644 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -106,7 +106,7 @@ static int coroutine_fn blkreplay_co_pwrite_zeroes(Bloc= kDriverState *bs, } =20 static int coroutine_fn blkreplay_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t byte= s) { uint64_t reqid =3D blkreplay_next_id(); int ret =3D bdrv_co_pdiscard(bs->file, offset, bytes); diff --git a/block/copy-on-read.c b/block/copy-on-read.c index d99e07e99f..5bf1fabee6 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -102,7 +102,7 @@ static int coroutine_fn cor_co_pwrite_zeroes(BlockDrive= rState *bs, =20 =20 static int coroutine_fn cor_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { return bdrv_co_pdiscard(bs->file, offset, bytes); } diff --git a/block/file-posix.c b/block/file-posix.c index fa9ac5b13e..132001dba8 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2791,11 +2791,18 @@ raw_do_pdiscard(BlockDriverState *bs, int64_t offse= t, int bytes, bool blkdev) } =20 static coroutine_fn int -raw_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) +raw_co_pdiscard_old(BlockDriverState *bs, int64_t offset, int bytes) { return raw_do_pdiscard(bs, offset, bytes, false); } =20 +static coroutine_fn int +raw_co_pdiscard(BlockDriverState *bs, int64_t offset, int64_t bytes) +{ + assert(bytes <=3D INT_MAX); + return raw_co_pdiscard_old(bs, offset, bytes); +} + static int coroutine_fn raw_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes, BdrvRequestFlags flags, bool blkdev) @@ -3475,7 +3482,7 @@ static int fd_open(BlockDriverState *bs) } =20 static coroutine_fn int -hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) +hdev_co_pdiscard_old(BlockDriverState *bs, int64_t offset, int bytes) { BDRVRawState *s =3D bs->opaque; int ret; @@ -3488,6 +3495,13 @@ hdev_co_pdiscard(BlockDriverState *bs, int64_t offse= t, int bytes) return raw_do_pdiscard(bs, offset, bytes, true); } =20 +static coroutine_fn int +hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int64_t bytes) +{ + assert(bytes <=3D INT_MAX); + return hdev_co_pdiscard_old(bs, offset, bytes); +} + static coroutine_fn int hdev_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes, BdrvRequestFlags flags) { diff --git a/block/filter-compress.c b/block/filter-compress.c index 7cf47608b5..477dfaf959 100644 --- a/block/filter-compress.c +++ b/block/filter-compress.c @@ -93,7 +93,7 @@ static int coroutine_fn compress_co_pwrite_zeroes(BlockDr= iverState *bs, =20 =20 static int coroutine_fn compress_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { return bdrv_co_pdiscard(bs->file, offset, bytes); } diff --git a/block/gluster.c b/block/gluster.c index 88130c3d2d..87cf69199d 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -1312,18 +1312,20 @@ error: =20 #ifdef CONFIG_GLUSTERFS_DISCARD static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs, - int64_t offset, int size) + int64_t offset, int64_t b= ytes) { int ret; GlusterAIOCB acb; BDRVGlusterState *s =3D bs->opaque; =20 + assert(bytes <=3D INT_MAX); + acb.size =3D 0; acb.ret =3D 0; acb.coroutine =3D qemu_coroutine_self(); acb.aio_context =3D bdrv_get_aio_context(bs); =20 - ret =3D glfs_discard_async(s->fd, offset, size, gluster_finish_aiocb, = &acb); + ret =3D glfs_discard_async(s->fd, offset, bytes, gluster_finish_aiocb,= &acb); if (ret < 0) { return -errno; } diff --git a/block/iscsi.c b/block/iscsi.c index c4183ef12f..c06521b74f 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1141,7 +1141,8 @@ iscsi_getlength(BlockDriverState *bs) } =20 static int -coroutine_fn iscsi_co_pdiscard(BlockDriverState *bs, int64_t offset, int b= ytes) +coroutine_fn iscsi_co_pdiscard_old(BlockDriverState *bs, int64_t offset, + int bytes) { IscsiLun *iscsilun =3D bs->opaque; struct IscsiTask iTask; @@ -1203,6 +1204,13 @@ out_unlock: return r; } =20 +static int +coroutine_fn iscsi_co_pdiscard(BlockDriverState *bs, int64_t offset, int64= _t bytes) +{ + assert(bytes <=3D INT_MAX); + return iscsi_co_pdiscard_old(bs, offset, bytes); +} + static int coroutine_fn iscsi_co_pwrite_zeroes_old(BlockDriverState *bs, int64_t offs= et, int bytes, BdrvRequestFlags flags) diff --git a/block/mirror.c b/block/mirror.c index 7f4fdfb470..bd01c032fa 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1471,7 +1471,7 @@ static int coroutine_fn bdrv_mirror_top_pwrite_zeroes= (BlockDriverState *bs, } =20 static int coroutine_fn bdrv_mirror_top_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { return bdrv_mirror_top_do_write(bs, MIRROR_METHOD_DISCARD, offset, byt= es, NULL, 0); diff --git a/block/nbd.c b/block/nbd.c index 0e52b76d72..93d0ced28c 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -1295,7 +1295,7 @@ static int nbd_client_co_flush(BlockDriverState *bs) } =20 static int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, - int bytes) + int64_t bytes) { BDRVNBDState *s =3D (BDRVNBDState *)bs->opaque; NBDRequest request =3D { @@ -1304,6 +1304,8 @@ static int nbd_client_co_pdiscard(BlockDriverState *b= s, int64_t offset, .len =3D bytes, }; =20 + assert(bytes < INT_MAX); + assert(!(s->info.flags & NBD_FLAG_READ_ONLY)); if (!(s->info.flags & NBD_FLAG_SEND_TRIM) || !bytes) { return 0; diff --git a/block/nvme.c b/block/nvme.c index 724f894b00..adc19ee9e6 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1166,9 +1166,9 @@ static coroutine_fn int nvme_co_pwrite_zeroes(BlockDr= iverState *bs, return nvme_co_pwrite_zeroes_old(bs, offset, bytes, flags); } =20 -static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs, - int64_t offset, - int bytes) +static int coroutine_fn nvme_co_pdiscard_old(BlockDriverState *bs, + int64_t offset, + int bytes) { BDRVNVMeState *s =3D bs->opaque; NVMeQueuePair *ioq =3D s->queues[1]; @@ -1245,6 +1245,13 @@ out: =20 } =20 +static int coroutine_fn nvme_co_pdiscard(BlockDriverState *bs, + int64_t offset, + int64_t bytes) +{ + assert(bytes <=3D INT_MAX); + return nvme_co_pdiscard_old(bs, offset, bytes); +} =20 static int nvme_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, Error **errp) diff --git a/block/qcow2.c b/block/qcow2.c index 0800d0378a..c85f5a8331 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3787,7 +3787,7 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(BlockD= riverState *bs, } =20 static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { int ret; BDRVQcow2State *s =3D bs->opaque; diff --git a/block/raw-format.c b/block/raw-format.c index 0996741056..f31bc4338f 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -292,7 +292,7 @@ static int coroutine_fn raw_co_pwrite_zeroes(BlockDrive= rState *bs, } =20 static int coroutine_fn raw_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { int ret; =20 diff --git a/block/sheepdog.c b/block/sheepdog.c index 59f7ebb171..750bfae016 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -3091,8 +3091,8 @@ static int sd_load_vmstate(BlockDriverState *bs, QEMU= IOVector *qiov, } =20 =20 -static coroutine_fn int sd_co_pdiscard(BlockDriverState *bs, int64_t offse= t, - int bytes) +static coroutine_fn int sd_co_pdiscard_old(BlockDriverState *bs, int64_t o= ffset, + int bytes) { SheepdogAIOCB acb; BDRVSheepdogState *s =3D bs->opaque; @@ -3121,6 +3121,13 @@ static coroutine_fn int sd_co_pdiscard(BlockDriverSt= ate *bs, int64_t offset, return acb.ret; } =20 +static coroutine_fn int sd_co_pdiscard(BlockDriverState *bs, int64_t offse= t, + int64_t bytes) +{ + assert(bytes <=3D INT_MAX); + return sd_co_pdiscard_old(bs, offset, bytes); +} + static coroutine_fn int sd_co_block_status(BlockDriverState *bs, bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum, int64_t *map, diff --git a/block/throttle.c b/block/throttle.c index c97da1d6a7..61f6c291e7 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -147,7 +147,7 @@ static int coroutine_fn throttle_co_pwrite_zeroes(Block= DriverState *bs, } =20 static int coroutine_fn throttle_co_pdiscard(BlockDriverState *bs, - int64_t offset, int bytes) + int64_t offset, int64_t bytes) { ThrottleGroupMember *tgm =3D bs->opaque; throttle_group_co_io_limits_intercept(tgm, bytes, true); --=20 2.21.0