From nobody Mon Feb 9 20:35:03 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612306283; cv=none; d=zohomail.com; s=zohoarc; b=Np8mKiR5Khxx6fGIk3z0KnnghKJmHoYt3+F3P5S1MqiRuhmz+MsKjYD/T+0dkuKHxFkBCONWmM62WA/JYH49mN6hmU0SswlqSZURAStiHSIqyiYoimzPafeiDHShNVNWA6nvboN8QOAaJWblCRxY4Yc9LntNi78EZYPYPMHytKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612306283; 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=Pj9Dorn2S9imnPXtq+qvM4EkUTvngDuoNVbkBZ7l0bQ=; b=i4Ex19BK6xwzUf4fNipUU2ZVxww3MSwtGrl+RSEnJjjnLPz1nx3iSlhLK1USnND+v2W4YF5ZAA8PdM5hH4qkzcgn0veAUQYeDoGiTNXQwVkHC/sjf+V+ohDET7CC2b4v86XVrDBdbuplswkRZh6L5GUgHebgPNSZ7NWUHX2csCM= ARC-Authentication-Results: i=1; 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; dmarc=fail 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 1612306283719561.4474679509101; Tue, 2 Feb 2021 14:51:23 -0800 (PST) Received: from localhost ([::1]:57936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l74W2-0005mR-I9 for importer@patchew.org; Tue, 02 Feb 2021 17:51:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l74R5-0007n0-5o for qemu-devel@nongnu.org; Tue, 02 Feb 2021 17:46:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l74Qn-000640-Vo for qemu-devel@nongnu.org; Tue, 02 Feb 2021 17:46:14 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-cNhrS74jMtaRgSptLaa1Fg-1; Tue, 02 Feb 2021 17:45:46 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5555C804023; Tue, 2 Feb 2021 22:45:45 +0000 (UTC) Received: from blue.redhat.com (ovpn-112-103.phx2.redhat.com [10.3.112.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8B2710016F5; Tue, 2 Feb 2021 22:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612305957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pj9Dorn2S9imnPXtq+qvM4EkUTvngDuoNVbkBZ7l0bQ=; b=Twj86cvbXWgby7+GU0uFoiSHA3zFY6RoIBPAjVQT9+Cj8kXnhgnDq/WycUYsGuMBobxt82 rU9cwn2tdRQu16A+xyjhHh2pOZAUg7dmVaMgabu4/3Lr8yFcsIeDVnrZ5Rfnq617MExLM8 EboU7pAw32plnT/cCFb5ebU533P2Pt0= X-MC-Unique: cNhrS74jMtaRgSptLaa1Fg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 13/20] block/io: support int64_t bytes in bdrv_co_do_copy_on_readv() Date: Tue, 2 Feb 2021 16:45:22 -0600 Message-Id: <20210202224529.642055-14-eblake@redhat.com> In-Reply-To: <20210202224529.642055-1-eblake@redhat.com> References: <20210202224529.642055-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block I/O path" , Max Reitz , Stefan Hajnoczi 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" From: Vladimir Sementsov-Ogievskiy 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. 'bytes' type widening, so callers are safe. Look at the function itself: bytes, skip_bytes and progress become int64_t. bdrv_round_to_clusters() is OK, cluster_bytes now may be large. trace_bdrv_co_do_copy_on_readv() is OK looping through cluster_bytes is still OK. pnum is still capped to max_transfer, and to MAX_BOUNCE_BUFFER when we are going to do COR operation. Therefor calculations in qemu_iovec_from_buf() and bdrv_driver_preadv() should not change. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20201211183934.169161-13-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/io.c | 8 +++++--- block/trace-events | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/block/io.c b/block/io.c index 59ae0a110da1..63b0fa0e9ed7 100644 --- a/block/io.c +++ b/block/io.c @@ -1311,7 +1311,7 @@ bdrv_driver_pwritev_compressed(BlockDriverState *bs, = int64_t offset, } 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; @@ -1326,13 +1326,15 @@ 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; + bdrv_check_qiov_request(offset, bytes, qiov, qiov_offset, &error_abort= ); + if (!drv) { return -ENOMEDIUM; } diff --git a/block/trace-events b/block/trace-events index ecbc32a80a91..82b5dd7cb619 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 2.30.0