From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16343329278589.338926567637827; Fri, 15 Oct 2021 14:22:07 -0700 (PDT) Received: from localhost ([::1]:54004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUeU-0002hm-O2 for importer@patchew.org; Fri, 15 Oct 2021 17:22:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTJ-0007VW-1S for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTA-0000c9-Nu for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:32 -0400 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-325-W6LMli8qMieyTfyxi9L2_A-1; Fri, 15 Oct 2021 17:10:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F03F802C9B; Fri, 15 Oct 2021 21:10:15 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5D8E19739; Fri, 15 Oct 2021 21:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332219; 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=rSZK1KkmIpw4/8UmyKjTqfzt0KxZMc5maGw55PT49HE=; b=C5nw72JQHV3+1huM6H+i6mUD97f2CYCE+XEGByMH+lnHnC7nP12H9jWn6Slk5r/XHtzMA1 3cYt0HwpoACxdxmzexGSxdkScVeU/tpoP0g++saV46irmFUV8oGK6wrB3g7TMGZZ6LhIX4 ZMS7eUwyAuF2DxDtAYH2Ji0WbBurL0c= X-MC-Unique: W6LMli8qMieyTfyxi9L2_A-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 01/15] qcow2: Silence clang -m32 compiler warning Date: Fri, 15 Oct 2021 16:09:56 -0500 Message-Id: <20211015211011.1272011-2-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , "open list:qcow2" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332929682100001 Content-Type: text/plain; charset="utf-8" From: Hanna Reitz With -m32, size_t is generally only a uint32_t. That makes clang complain that in the assertion assert(qiov->size <=3D INT64_MAX); the range of the type of qiov->size (size_t) is too small for any of its values to ever exceed INT64_MAX. Cast qiov->size to uint64_t to silence clang. Fixes: f7ef38dd1310d7d9db76d0aa16899cbc5744f36d ("block: use int64_t instead of uint64_t in driver read handlers") Signed-off-by: Hanna Reitz Message-Id: <20211011155031.149158-1-hreitz@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/qcow2-cluster.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 5727f92dcb39..21884a1ab9ab 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -513,7 +513,8 @@ static int coroutine_fn do_perform_cow_read(BlockDriver= State *bs, */ assert(src_cluster_offset <=3D INT64_MAX); assert(src_cluster_offset + offset_in_cluster <=3D INT64_MAX); - assert(qiov->size <=3D INT64_MAX); + /* Cast qiov->size to uint64_t to silence a compiler warning on -m32 */ + assert((uint64_t)qiov->size <=3D INT64_MAX); bdrv_check_qiov_request(src_cluster_offset + offset_in_cluster, qiov->= size, qiov, 0, &error_abort); /* --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332357495627.6309852161166; Fri, 15 Oct 2021 14:12:37 -0700 (PDT) Received: from localhost ([::1]:56764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUVI-00028f-Eu for importer@patchew.org; Fri, 15 Oct 2021 17:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTC-0007Sw-2u for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUT6-0000al-9n for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:24 -0400 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-562-AwapESOwNfuFAIEpNc8Dcg-1; Fri, 15 Oct 2021 17:10:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 022F0802575; Fri, 15 Oct 2021 21:10:16 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CD7E19739; Fri, 15 Oct 2021 21:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332218; 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=6ZRle+JZn4ejZdQH4RYOeKHUzM/Dg2KEG8y7izHl4Do=; b=d0AdCzflC4yv7WdUr74sxiM3SybEwMbTaqShSO4U6y+DZPHviDceOSr/PdPU91OUTtItdj HQdJZkW6BqAxBJZP1ltk6J5iyz6WhAQO15IDw/gdbGxOg9NVQZ/+9cjJ6X2pIFgkmQzbOT ydWEg1At/sAjjs4VpuaO3ADCVdRFUfw= X-MC-Unique: AwapESOwNfuFAIEpNc8Dcg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 02/15] block-backend: blk_check_byte_request(): int64_t bytes Date: Fri, 15 Oct 2021 16:09:57 -0500 Message-Id: <20211015211011.1272011-3-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332359573100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Rename size and make it int64_t to correspond to modern block layer, which always uses int64_t for offset and bytes (not in blk layer yet, which is a task for following commits). All callers pass int or unsigned int. So, for bytes in [0, INT_MAX] nothing is changed, for negative bytes we now fail on "bytes < 0" check instead of "bytes > INT_MAX" check. Note, that blk_check_byte_request() still doesn't allow requests exceeding INT_MAX. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-2-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/block-backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index ba2b5ebb1008..2c62210687e7 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1161,11 +1161,11 @@ void blk_set_disable_request_queuing(BlockBackend *= blk, bool disable) } static int blk_check_byte_request(BlockBackend *blk, int64_t offset, - size_t size) + int64_t bytes) { int64_t len; - if (size > INT_MAX) { + if (bytes < 0 || bytes > INT_MAX) { return -EIO; } @@ -1183,7 +1183,7 @@ static int blk_check_byte_request(BlockBackend *blk, = int64_t offset, return len; } - if (offset > len || len - offset < size) { + if (offset > len || len - offset < bytes) { return -EIO; } } --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332479798596.2878523932259; Fri, 15 Oct 2021 14:14:39 -0700 (PDT) Received: from localhost ([::1]:34224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUXG-0005uf-Lk for importer@patchew.org; Fri, 15 Oct 2021 17:14:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTF-0007Tw-4k for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTA-0000db-IC for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:27 -0400 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-39-EMD7_wB8O2auB7NfOQikpw-1; Fri, 15 Oct 2021 17:10:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CCD5C18125C0; Fri, 15 Oct 2021 21:10:16 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33EAE19739; Fri, 15 Oct 2021 21:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332221; 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=RGyJjf3QSlstXDSO8qTy6RYvZagf/GNS8fSlHf9mEXk=; b=NNvPi7z52K4kN0ThfXoVsKAGahWPha9srxXoDldJP75BX8bBeXJpYWm37dnh2/OrFS8ey0 7mlpCWaAeFcweuUaTyCd+tRViogpoNO1135ooJim2V2AjqC/3bddQcYUf0jb+XXxxGvu48 SOi2ajTbX05iri6ewQb4VuC771f4JSE= X-MC-Unique: EMD7_wB8O2auB7NfOQikpw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 03/15] block-backend: make blk_co_preadv() 64bit Date: Fri, 15 Oct 2021 16:09:58 -0500 Message-Id: <20211015211011.1272011-4-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.129.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIMWL_WL_HIGH=-0.049, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332481390100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy For both updated functions, the type of bytes becomes wider, so all callers should be OK with it. blk_co_preadv() only passes its arguments to blk_do_preadv(). blk_do_preadv() passes bytes to: - trace_blk_co_preadv, which is updated too - blk_check_byte_request, throttle_group_co_io_limits_intercept, bdrv_co_preadv, which are already int64_t. Note that requests exceeding INT_MAX are still restricted by blk_check_byte_request(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-3-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: grammar tweaks] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 2 +- block/block-backend.c | 4 ++-- block/trace-events | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 82bae551617b..442fd705bb78 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -126,7 +126,7 @@ 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, diff --git a/block/block-backend.c b/block/block-backend.c index 2c62210687e7..3199f84e96d9 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1205,7 +1205,7 @@ static void coroutine_fn blk_wait_while_drained(Block= Backend *blk) /* 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; @@ -1236,7 +1236,7 @@ blk_do_preadv(BlockBackend *blk, int64_t offset, unsi= gned int bytes, } 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; diff --git a/block/trace-events b/block/trace-events index f2d0a9b62a7e..ff397ffff485 100644 --- a/block/trace-events +++ b/block/trace-events @@ -5,7 +5,7 @@ bdrv_open_common(void *bs, const char *filename, int flags,= const char *format_n bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d" # block-backend.c -blk_co_preadv(void *blk, void *bs, int64_t offset, unsigned int bytes, int= flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x" +blk_co_preadv(void *blk, void *bs, int64_t offset, int64_t bytes, int flag= s) "blk %p bs %p offset %"PRId64" bytes %" PRId64 " flags 0x%x" blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, in= t flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x" 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 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163433272186595.80704160370226; Fri, 15 Oct 2021 14:18:41 -0700 (PDT) Received: from localhost ([::1]:43074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUbA-0003ka-Pg for importer@patchew.org; Fri, 15 Oct 2021 17:18:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTK-0007Vf-Ns for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUT8-0000cQ-Hb for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:32 -0400 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-596-KIL7VKp7MneA-PBXBryokw-1; Fri, 15 Oct 2021 17:10:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 792DD10A8E00; Fri, 15 Oct 2021 21:10:17 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DF4D1973B; Fri, 15 Oct 2021 21:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332220; 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=FXNTvRJafgB5YljR3MZgj7Gw8cq0aduwnj5wNIeMato=; b=KyU+xkJWZHNpSmlq463UA48Xl4kWwD7Hh6rbztY0pWdVq7TyzSCs6JB+yrbLbWfwjJQV6Z KFxDq8jpQvjXPutE6UNWj4aAUnMePyhBz/0rE0L4Uxo3yIdanmWtTcnW4x89724SwQSiZ1 vgN7prfX6FJKwf5hpIgGhVDnknycUcY= X-MC-Unique: KIL7VKp7MneA-PBXBryokw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 04/15] block-backend: convert blk_co_pwritev_part to int64_t bytes Date: Fri, 15 Oct 2021 16:09:59 -0500 Message-Id: <20211015211011.1272011-5-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332722962100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We convert blk_do_pwritev_part() and some wrappers: blk_co_pwritev_part(), blk_co_pwritev(), blk_co_pwrite_zeroes(). All functions are converted so that the parameter type becomes wider, so all callers should be OK with it. Look at blk_do_pwritev_part() body: bytes is passed to: - trace_blk_co_pwritev (we update it here) - blk_check_byte_request, throttle_group_co_io_limits_intercept, bdrv_co_pwritev_part - all already have int64_t argument. Note that requests exceeding INT_MAX are still restricted by blk_check_byte_request(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-4-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: grammar tweaks] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 6 +++--- block/block-backend.c | 8 ++++---- block/trace-events | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 442fd705bb78..91457a081ec1 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -129,11 +129,11 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int= 64_t offset, 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); static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t off= set, @@ -243,7 +243,7 @@ int blk_get_open_flags_from_root_state(BlockBackend *bl= k); 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); int blk_truncate(BlockBackend *blk, int64_t offset, bool exact, diff --git a/block/block-backend.c b/block/block-backend.c index 3199f84e96d9..105f0afff970 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1250,7 +1250,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int= 64_t offset, /* 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) { @@ -1286,7 +1286,7 @@ blk_do_pwritev_part(BlockBackend *blk, int64_t offset= , unsigned int bytes, } 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) { @@ -1300,7 +1300,7 @@ int coroutine_fn blk_co_pwritev_part(BlockBackend *bl= k, int64_t offset, } 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); @@ -2214,7 +2214,7 @@ void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockB= ackend *blk, } 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); diff --git a/block/trace-events b/block/trace-events index ff397ffff485..ab56edacb4fc 100644 --- a/block/trace-events +++ b/block/trace-events @@ -6,7 +6,7 @@ bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d" # block-backend.c blk_co_preadv(void *blk, void *bs, int64_t offset, int64_t bytes, int flag= s) "blk %p bs %p offset %"PRId64" bytes %" PRId64 " flags 0x%x" -blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, in= t flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x" +blk_co_pwritev(void *blk, void *bs, int64_t offset, int64_t bytes, int fla= gs) "blk %p bs %p offset %"PRId64" bytes %" PRId64 " flags 0x%x" 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 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332568303506.0128876419328; Fri, 15 Oct 2021 14:16:08 -0700 (PDT) Received: from localhost ([::1]:37092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUYh-0007qI-0l for importer@patchew.org; Fri, 15 Oct 2021 17:16:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTF-0007Ty-4z for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTA-0000f3-HH for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:28 -0400 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-161-FuzB-_qbMOKiIvB4Lpt7tw-1; Fri, 15 Oct 2021 17:10:19 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2142010A8E01; Fri, 15 Oct 2021 21:10:18 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8FE119739; Fri, 15 Oct 2021 21:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332222; 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=Qr041pWEVPDiPpPV3kx3/rrq+fwR3VtlU7StQJLlph0=; b=ef2N7ZKYiQ9RwxvzBKlFzGpQ8oNdKVobTpUf6FTlbwMXUN89vIJGuhL0Rj3iHjmvsk10mb rcWC39Val0qRSbkGEzPMzj0iFqNoj5vrKt++ErVdMjAmcNCMIHRfq0CxjIZWwh8L0278zx k3uZjSm1zsBlgaLvmzfyzc7NCGdu+9I= X-MC-Unique: FuzB-_qbMOKiIvB4Lpt7tw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 05/15] block-backend: convert blk_co_pdiscard to int64_t bytes Date: Fri, 15 Oct 2021 16:10:00 -0500 Message-Id: <20211015211011.1272011-6-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332570334100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We updated blk_do_pdiscard() and its wrapper blk_co_pdiscard(). Both functions are updated so that the parameter type becomes wider, so all callers should be OK with it. Look at blk_do_pdiscard(): bytes is passed only to blk_check_byte_request() and bdrv_co_pdiscard(), which already have int64_t bytes parameter, so we are OK. Note that requests exceeding INT_MAX are still restricted by blk_check_byte_request(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-5-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: grammar tweaks] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 3 ++- block/block-backend.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 91457a081ec1..3efa0256395f 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -181,7 +181,8 @@ 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 coroutine_fn 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); diff --git a/block/block-backend.c b/block/block-backend.c index 105f0afff970..1e21498b2c4a 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1626,7 +1626,7 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned= long int req, void *buf, /* 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; @@ -1657,7 +1657,8 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, cb, opaque); } -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 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332779591681.341258304734; Fri, 15 Oct 2021 14:19:39 -0700 (PDT) Received: from localhost ([::1]:45436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUc6-0005JQ-Hn for importer@patchew.org; Fri, 15 Oct 2021 17:19:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTF-0007Tz-7L for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTA-0000dZ-HP for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:26 -0400 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-185-ApE9EVfHPH6QvTGbVJaflw-1; Fri, 15 Oct 2021 17:10:19 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C049E10A8E02; Fri, 15 Oct 2021 21:10:18 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5017619739; Fri, 15 Oct 2021 21:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332221; 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=ttl6zmk7BedN8TtODJVW+CBtgvw3GFAXOGNMHkGFQ2A=; b=QCouXzog63avV6P/0tRkVmcMJ97ncr47BSf0dH376XOpRH6qotfWtN2tk/mzf6ow7/5aUo UPA4+5KRdk5Gds1mVkJ2jl8owdrGr0SZKUWQgPoEI2QX4SdRTyZM4SWOMDH+rGGRh2ZeJV WS6bbXTKNskUZTLtFoYuamP5CbYqcMk= X-MC-Unique: ApE9EVfHPH6QvTGbVJaflw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 06/15] block-backend: rename _do_ helper functions to _co_do_ Date: Fri, 15 Oct 2021 16:10:01 -0500 Message-Id: <20211015211011.1272011-7-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332780510100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy This is a preparation to the following commit, to use automatic coroutine wrapper generation. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-6-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/block-backend.c | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 1e21498b2c4a..cecac6748593 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1205,8 +1205,8 @@ static void coroutine_fn blk_wait_while_drained(Block= Backend *blk) /* 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, int64_t bytes, - QEMUIOVector *qiov, BdrvRequestFlags flags) +blk_co_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; BlockDriverState *bs; @@ -1242,7 +1242,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int= 64_t offset, int ret; blk_inc_in_flight(blk); - ret =3D blk_do_preadv(blk, offset, bytes, qiov, flags); + ret =3D blk_co_do_preadv(blk, offset, bytes, qiov, flags); blk_dec_in_flight(blk); return ret; @@ -1250,9 +1250,9 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int= 64_t offset, /* 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, int64_t bytes, - QEMUIOVector *qiov, size_t qiov_offset, - BdrvRequestFlags flags) +blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, + BdrvRequestFlags flags) { int ret; BlockDriverState *bs; @@ -1293,7 +1293,7 @@ int coroutine_fn blk_co_pwritev_part(BlockBackend *bl= k, int64_t offset, int ret; blk_inc_in_flight(blk); - ret =3D blk_do_pwritev_part(blk, offset, bytes, qiov, qiov_offset, fla= gs); + ret =3D blk_co_do_pwritev_part(blk, offset, bytes, qiov, qiov_offset, = flags); blk_dec_in_flight(blk); return ret; @@ -1319,8 +1319,8 @@ static void blk_read_entry(void *opaque) BlkRwCo *rwco =3D opaque; QEMUIOVector *qiov =3D rwco->iobuf; - rwco->ret =3D blk_do_preadv(rwco->blk, rwco->offset, qiov->size, - qiov, rwco->flags); + rwco->ret =3D blk_co_do_preadv(rwco->blk, rwco->offset, qiov->size, + qiov, rwco->flags); aio_wait_kick(); } @@ -1329,8 +1329,8 @@ static void blk_write_entry(void *opaque) BlkRwCo *rwco =3D opaque; QEMUIOVector *qiov =3D rwco->iobuf; - rwco->ret =3D blk_do_pwritev_part(rwco->blk, rwco->offset, qiov->size, - qiov, 0, rwco->flags); + rwco->ret =3D blk_co_do_pwritev_part(rwco->blk, rwco->offset, qiov->si= ze, + qiov, 0, rwco->flags); aio_wait_kick(); } @@ -1483,8 +1483,8 @@ static void blk_aio_read_entry(void *opaque) QEMUIOVector *qiov =3D rwco->iobuf; assert(qiov->size =3D=3D acb->bytes); - rwco->ret =3D blk_do_preadv(rwco->blk, rwco->offset, acb->bytes, - qiov, rwco->flags); + rwco->ret =3D blk_co_do_preadv(rwco->blk, rwco->offset, acb->bytes, + qiov, rwco->flags); blk_aio_complete(acb); } @@ -1495,8 +1495,8 @@ static void blk_aio_write_entry(void *opaque) QEMUIOVector *qiov =3D rwco->iobuf; assert(!qiov || qiov->size =3D=3D acb->bytes); - rwco->ret =3D blk_do_pwritev_part(rwco->blk, rwco->offset, acb->bytes, - qiov, 0, rwco->flags); + rwco->ret =3D blk_co_do_pwritev_part(rwco->blk, rwco->offset, acb->byt= es, + qiov, 0, rwco->flags); blk_aio_complete(acb); } @@ -1583,7 +1583,7 @@ void blk_aio_cancel_async(BlockAIOCB *acb) /* To be called between exactly one pair of blk_inc/dec_in_flight() */ static int coroutine_fn -blk_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf) +blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf) { blk_wait_while_drained(blk); @@ -1599,7 +1599,7 @@ static void blk_ioctl_entry(void *opaque) BlkRwCo *rwco =3D opaque; QEMUIOVector *qiov =3D rwco->iobuf; - rwco->ret =3D blk_do_ioctl(rwco->blk, rwco->offset, qiov->iov[0].iov_b= ase); + rwco->ret =3D blk_co_do_ioctl(rwco->blk, rwco->offset, qiov->iov[0].io= v_base); aio_wait_kick(); } @@ -1613,7 +1613,7 @@ static void blk_aio_ioctl_entry(void *opaque) BlkAioEmAIOCB *acb =3D opaque; BlkRwCo *rwco =3D &acb->rwco; - rwco->ret =3D blk_do_ioctl(rwco->blk, rwco->offset, rwco->iobuf); + rwco->ret =3D blk_co_do_ioctl(rwco->blk, rwco->offset, rwco->iobuf); blk_aio_complete(acb); } @@ -1626,7 +1626,7 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned= long int req, void *buf, /* 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, int64_t bytes) +blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes) { int ret; @@ -1645,7 +1645,7 @@ static void blk_aio_pdiscard_entry(void *opaque) BlkAioEmAIOCB *acb =3D opaque; BlkRwCo *rwco =3D &acb->rwco; - rwco->ret =3D blk_do_pdiscard(rwco->blk, rwco->offset, acb->bytes); + rwco->ret =3D blk_co_do_pdiscard(rwco->blk, rwco->offset, acb->bytes); blk_aio_complete(acb); } @@ -1663,7 +1663,7 @@ int coroutine_fn blk_co_pdiscard(BlockBackend *blk, i= nt64_t offset, int ret; blk_inc_in_flight(blk); - ret =3D blk_do_pdiscard(blk, offset, bytes); + ret =3D blk_co_do_pdiscard(blk, offset, bytes); blk_dec_in_flight(blk); return ret; @@ -1674,7 +1674,7 @@ static void blk_pdiscard_entry(void *opaque) BlkRwCo *rwco =3D opaque; QEMUIOVector *qiov =3D rwco->iobuf; - rwco->ret =3D blk_do_pdiscard(rwco->blk, rwco->offset, qiov->size); + rwco->ret =3D blk_co_do_pdiscard(rwco->blk, rwco->offset, qiov->size); aio_wait_kick(); } @@ -1684,7 +1684,7 @@ int blk_pdiscard(BlockBackend *blk, int64_t offset, i= nt bytes) } /* To be called between exactly one pair of blk_inc/dec_in_flight() */ -static int coroutine_fn blk_do_flush(BlockBackend *blk) +static int coroutine_fn blk_co_do_flush(BlockBackend *blk) { blk_wait_while_drained(blk); @@ -1700,7 +1700,7 @@ static void blk_aio_flush_entry(void *opaque) BlkAioEmAIOCB *acb =3D opaque; BlkRwCo *rwco =3D &acb->rwco; - rwco->ret =3D blk_do_flush(rwco->blk); + rwco->ret =3D blk_co_do_flush(rwco->blk); blk_aio_complete(acb); } @@ -1715,7 +1715,7 @@ int coroutine_fn blk_co_flush(BlockBackend *blk) int ret; blk_inc_in_flight(blk); - ret =3D blk_do_flush(blk); + ret =3D blk_co_do_flush(blk); blk_dec_in_flight(blk); return ret; @@ -1724,7 +1724,7 @@ int coroutine_fn blk_co_flush(BlockBackend *blk) static void blk_flush_entry(void *opaque) { BlkRwCo *rwco =3D opaque; - rwco->ret =3D blk_do_flush(rwco->blk); + rwco->ret =3D blk_co_do_flush(rwco->blk); aio_wait_kick(); } --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332871320368.40171224776486; Fri, 15 Oct 2021 14:21:11 -0700 (PDT) Received: from localhost ([::1]:49982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUda-0008Je-5g for importer@patchew.org; Fri, 15 Oct 2021 17:21:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTP-0007dd-DA for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTE-0000gX-NX for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:39 -0400 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-176-2_TMAUdMPOGPSVVpITzN4A-1; Fri, 15 Oct 2021 17:10:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 838C918125C0; Fri, 15 Oct 2021 21:10:19 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBE0419739; Fri, 15 Oct 2021 21:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332224; 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=aVL0+2JXPisVP7jDiei2L/EYA1tutFeMhwM2X6UhX6s=; b=PGlLvi3mVPBxR8tfaI6ga2GXDUngLKZkjr+MA5iJLP+06pVatCndrCI2itQB6KZ9fxK+Ct 2p/n2PuZtLAbPzprNEKhLJU0rnHrb8ighWoOkeMomSqNpki/tMXcLMQy1OIMfwE3ItMCY+ 4RKtI2ZftocR3bGtg55y2iwYiKFzPzg= X-MC-Unique: 2_TMAUdMPOGPSVVpITzN4A-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 07/15] block-coroutine-wrapper.py: support BlockBackend first argument Date: Fri, 15 Oct 2021 16:10:02 -0500 Message-Id: <20211015211011.1272011-8-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-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: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Eduardo Habkost , "open list:Block layer core" , Hanna Reitz , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332871831100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-7-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- scripts/block-coroutine-wrapper.py | 12 ++++++++++-- block/coroutines.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-w= rapper.py index 85dbeb9ecf9c..08be813407b6 100644 --- a/scripts/block-coroutine-wrapper.py +++ b/scripts/block-coroutine-wrapper.py @@ -100,12 +100,20 @@ def snake_to_camel(func_name: str) -> str: def gen_wrapper(func: FuncDecl) -> str: assert not '_co_' in func.name assert func.return_type =3D=3D 'int' - assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *'] + assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *', + 'BlockBackend *'] subsystem, subname =3D func.name.split('_', 1) name =3D f'{subsystem}_co_{subname}' - bs =3D 'bs' if func.args[0].type =3D=3D 'BlockDriverState *' else 'chi= ld->bs' + + t =3D func.args[0].type + if t =3D=3D 'BlockDriverState *': + bs =3D 'bs' + elif t =3D=3D 'BdrvChild *': + bs =3D 'child->bs' + else: + bs =3D 'blk_bs(blk)' struct_name =3D snake_to_camel(name) return f"""\ diff --git a/block/coroutines.h b/block/coroutines.h index 514d169d23d6..35a6c4985782 100644 --- a/block/coroutines.h +++ b/block/coroutines.h @@ -27,6 +27,9 @@ #include "block/block_int.h" +/* For blk_bs() in generated block/block-gen.c */ +#include "sysemu/block-backend.h" + int coroutine_fn bdrv_co_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix); int coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, Error **er= rp); --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634333044696594.1659001009298; Fri, 15 Oct 2021 14:24:04 -0700 (PDT) Received: from localhost ([::1]:60810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUgN-0007Cu-KK for importer@patchew.org; Fri, 15 Oct 2021 17:24:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTL-0007Vr-E2 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTC-0000gn-R2 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:34 -0400 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-170-650NWoK_MdiBQj5Q5cofzQ-1; Fri, 15 Oct 2021 17:10:21 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 37498DF8A4; Fri, 15 Oct 2021 21:10:20 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE4EA196E2; Fri, 15 Oct 2021 21:10:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332224; 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=VLxHDhUAe3UjcGz/3UrRSJMxMh1ynALQIwoudXx/avU=; b=ZuEPihPXo03srG1l1Nfj4/xvE0rscO03EIvC85pgsV30jytmrXOgYSeKZzmI1OoMUvHgZo 5J2WxcB9LAXKPnq3sekUBngiglN91D1Fi7khr4q96S4BbdhNOsiCPTgJXr9ejRcl8Vt95D HhXgWUpSwCAhY+HTNzxo2ZBya9Nzxf0= X-MC-Unique: 650NWoK_MdiBQj5Q5cofzQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 08/15] block-backend: drop blk_prw, use block-coroutine-wrapper Date: Fri, 15 Oct 2021 16:10:03 -0500 Message-Id: <20211015211011.1272011-9-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634333045444100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Let's drop hand-made coroutine wrappers and use coroutine wrapper generation like in block/io.c. Now, blk_foo() functions are written in same way as blk_co_foo() ones, but wrap blk_do_foo() instead of blk_co_do_foo(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-8-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: spelling fix] Signed-off-by: Eric Blake --- block/coroutines.h | 30 ++++++++ block/block-backend.c | 155 ++++++++++++++++-------------------------- 2 files changed, 90 insertions(+), 95 deletions(-) diff --git a/block/coroutines.h b/block/coroutines.h index 35a6c4985782..c8c14a29c834 100644 --- a/block/coroutines.h +++ b/block/coroutines.h @@ -75,4 +75,34 @@ int coroutine_fn nbd_co_do_establish_connection(BlockDriverState *bs, Error **errp); +int generated_co_wrapper +blk_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags); +int coroutine_fn +blk_co_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, BdrvRequestFlags flags); + + +int generated_co_wrapper +blk_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, + BdrvRequestFlags flags); +int coroutine_fn +blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, + QEMUIOVector *qiov, size_t qiov_offset, + BdrvRequestFlags flags); + +int generated_co_wrapper +blk_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf); +int coroutine_fn +blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf); + +int generated_co_wrapper +blk_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); +int coroutine_fn +blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); + +int generated_co_wrapper blk_do_flush(BlockBackend *blk); +int coroutine_fn blk_co_do_flush(BlockBackend *blk); + #endif /* BLOCK_COROUTINES_INT_H */ diff --git a/block/block-backend.c b/block/block-backend.c index cecac6748593..2e6ccce7ef2d 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -14,6 +14,7 @@ #include "sysemu/block-backend.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "block/coroutines.h" #include "block/throttle-groups.h" #include "hw/qdev-core.h" #include "sysemu/blockdev.h" @@ -1204,7 +1205,7 @@ static void coroutine_fn blk_wait_while_drained(Block= Backend *blk) } /* To be called between exactly one pair of blk_inc/dec_in_flight() */ -static int coroutine_fn +int coroutine_fn blk_co_do_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { @@ -1249,7 +1250,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int= 64_t offset, } /* To be called between exactly one pair of blk_inc/dec_in_flight() */ -static int coroutine_fn +int coroutine_fn blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags) @@ -1306,6 +1307,20 @@ int coroutine_fn blk_co_pwritev(BlockBackend *blk, i= nt64_t offset, return blk_co_pwritev_part(blk, offset, bytes, qiov, 0, flags); } +static int coroutine_fn blk_pwritev_part(BlockBackend *blk, int64_t offset, + int64_t bytes, + QEMUIOVector *qiov, size_t qiov_o= ffset, + BdrvRequestFlags flags) +{ + int ret; + + blk_inc_in_flight(blk); + ret =3D blk_do_pwritev_part(blk, offset, bytes, qiov, qiov_offset, fla= gs); + blk_dec_in_flight(blk); + + return ret; +} + typedef struct BlkRwCo { BlockBackend *blk; int64_t offset; @@ -1314,58 +1329,11 @@ typedef struct BlkRwCo { BdrvRequestFlags flags; } BlkRwCo; -static void blk_read_entry(void *opaque) -{ - BlkRwCo *rwco =3D opaque; - QEMUIOVector *qiov =3D rwco->iobuf; - - rwco->ret =3D blk_co_do_preadv(rwco->blk, rwco->offset, qiov->size, - qiov, rwco->flags); - aio_wait_kick(); -} - -static void blk_write_entry(void *opaque) -{ - BlkRwCo *rwco =3D opaque; - QEMUIOVector *qiov =3D rwco->iobuf; - - rwco->ret =3D blk_co_do_pwritev_part(rwco->blk, rwco->offset, qiov->si= ze, - qiov, 0, rwco->flags); - aio_wait_kick(); -} - -static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf, - int64_t bytes, CoroutineEntry co_entry, - BdrvRequestFlags flags) -{ - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); - BlkRwCo rwco =3D { - .blk =3D blk, - .offset =3D offset, - .iobuf =3D &qiov, - .flags =3D flags, - .ret =3D NOT_DONE, - }; - - blk_inc_in_flight(blk); - if (qemu_in_coroutine()) { - /* Fast-path if already in coroutine context */ - co_entry(&rwco); - } else { - Coroutine *co =3D qemu_coroutine_create(co_entry, &rwco); - bdrv_coroutine_enter(blk_bs(blk), co); - BDRV_POLL_WHILE(blk_bs(blk), rwco.ret =3D=3D NOT_DONE); - } - blk_dec_in_flight(blk); - - return rwco.ret; -} - int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, int bytes, BdrvRequestFlags flags) { - return blk_prw(blk, offset, NULL, bytes, blk_write_entry, - flags | BDRV_REQ_ZERO_WRITE); + return blk_pwritev_part(blk, offset, bytes, NULL, 0, + flags | BDRV_REQ_ZERO_WRITE); } int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags) @@ -1510,22 +1478,25 @@ BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk= , int64_t offset, int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int count) { - int ret =3D blk_prw(blk, offset, buf, count, blk_read_entry, 0); - if (ret < 0) { - return ret; - } - return count; + int ret; + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, count); + + blk_inc_in_flight(blk); + ret =3D blk_do_preadv(blk, offset, count, &qiov, 0); + blk_dec_in_flight(blk); + + return ret < 0 ? ret : count; } int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int cou= nt, BdrvRequestFlags flags) { - int ret =3D blk_prw(blk, offset, (void *) buf, count, blk_write_entry, - flags); - if (ret < 0) { - return ret; - } - return count; + int ret; + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, count); + + ret =3D blk_pwritev_part(blk, offset, count, &qiov, 0, flags); + + return ret < 0 ? ret : count; } int64_t blk_getlength(BlockBackend *blk) @@ -1582,7 +1553,7 @@ void blk_aio_cancel_async(BlockAIOCB *acb) } /* To be called between exactly one pair of blk_inc/dec_in_flight() */ -static int coroutine_fn +int coroutine_fn blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf) { blk_wait_while_drained(blk); @@ -1594,18 +1565,15 @@ blk_co_do_ioctl(BlockBackend *blk, unsigned long in= t req, void *buf) return bdrv_co_ioctl(blk_bs(blk), req, buf); } -static void blk_ioctl_entry(void *opaque) -{ - BlkRwCo *rwco =3D opaque; - QEMUIOVector *qiov =3D rwco->iobuf; - - rwco->ret =3D blk_co_do_ioctl(rwco->blk, rwco->offset, qiov->iov[0].io= v_base); - aio_wait_kick(); -} - int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf) { - return blk_prw(blk, req, buf, 0, blk_ioctl_entry, 0); + int ret; + + blk_inc_in_flight(blk); + ret =3D blk_do_ioctl(blk, req, buf); + blk_dec_in_flight(blk); + + return ret; } static void blk_aio_ioctl_entry(void *opaque) @@ -1625,7 +1593,7 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned= long int req, void *buf, } /* To be called between exactly one pair of blk_inc/dec_in_flight() */ -static int coroutine_fn +int coroutine_fn blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes) { int ret; @@ -1669,22 +1637,19 @@ int coroutine_fn blk_co_pdiscard(BlockBackend *blk,= int64_t offset, return ret; } -static void blk_pdiscard_entry(void *opaque) -{ - BlkRwCo *rwco =3D opaque; - QEMUIOVector *qiov =3D rwco->iobuf; - - rwco->ret =3D blk_co_do_pdiscard(rwco->blk, rwco->offset, qiov->size); - aio_wait_kick(); -} - int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes) { - return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0); + int ret; + + blk_inc_in_flight(blk); + ret =3D blk_do_pdiscard(blk, offset, bytes); + blk_dec_in_flight(blk); + + return ret; } /* To be called between exactly one pair of blk_inc/dec_in_flight() */ -static int coroutine_fn blk_co_do_flush(BlockBackend *blk) +int coroutine_fn blk_co_do_flush(BlockBackend *blk) { blk_wait_while_drained(blk); @@ -1721,16 +1686,15 @@ int coroutine_fn blk_co_flush(BlockBackend *blk) return ret; } -static void blk_flush_entry(void *opaque) -{ - BlkRwCo *rwco =3D opaque; - rwco->ret =3D blk_co_do_flush(rwco->blk); - aio_wait_kick(); -} - int blk_flush(BlockBackend *blk) { - return blk_prw(blk, 0, NULL, 0, blk_flush_entry, 0); + int ret; + + blk_inc_in_flight(blk); + ret =3D blk_do_flush(blk); + blk_dec_in_flight(blk); + + return ret; } void blk_drain(BlockBackend *blk) @@ -2224,8 +2188,9 @@ int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *b= lk, int64_t offset, int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *b= uf, int count) { - return blk_prw(blk, offset, (void *) buf, count, blk_write_entry, - BDRV_REQ_WRITE_COMPRESSED); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, count); + return blk_pwritev_part(blk, offset, count, &qiov, 0, + BDRV_REQ_WRITE_COMPRESSED); } int blk_truncate(BlockBackend *blk, int64_t offset, bool exact, --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332894997388.7913245061577; Fri, 15 Oct 2021 14:21:34 -0700 (PDT) Received: from localhost ([::1]:51830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUdx-0001Gw-Sq for importer@patchew.org; Fri, 15 Oct 2021 17:21:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTO-0007aN-AI for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40609) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTE-0000hR-NR for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:38 -0400 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-15-cHl2a-6EMf-pQTKWrihC9A-1; Fri, 15 Oct 2021 17:10:21 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D694310A8E04; Fri, 15 Oct 2021 21:10:20 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C62E19739; Fri, 15 Oct 2021 21:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332225; 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=Mbrlpaxa+fsepZP8Sd2ad1SK8hBiQxNFeMbrGNsih8o=; b=hD8FwiQA8E06ZPM4PmpwHXadf03o9kaeNH20oc0pgV2avLwFI3oRpf5di4gLB2fv971aZV CZOfm6GJ96gtgwLW/sPvxnL3/4spJlzc846Xh41nH7ic1k8pBE4BnJOTnJAs7JgDnYmObE FovzDUGwR9pgvYD/PYwLRfjWn7YGqDA= X-MC-Unique: cHl2a-6EMf-pQTKWrihC9A-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 09/15] block-backend: convert blk_foo wrappers to use int64_t bytes parameter Date: Fri, 15 Oct 2021 16:10:04 -0500 Message-Id: <20211015211011.1272011-10-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.129.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332897122100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Convert blk_pdiscard, blk_pwrite_compressed, blk_pwrite_zeroes. These are just wrappers for functions with int64_t argument, so allow passing int64_t as well. Parameter type becomes wider so all callers should be OK with it. Note that requests exceeding INT_MAX are still restricted by blk_check_byte_request(). Note also that we don't (and are not going to) convert blk_pwrite and blk_pread: these functions return number of bytes on success, so to update them, we should change return type to int64_t as well, which will lead to investigating and updating all callers which is too much. So, blk_pread and blk_pwrite remain unchanged. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-9-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: grammar tweaks] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 6 +++--- block/block-backend.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 3efa0256395f..3294d1b07a33 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -155,7 +155,7 @@ static inline int coroutine_fn blk_co_pwrite(BlockBacke= nd *blk, int64_t offset, } 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, BlockCompletionFunc *cb, void *opaque); @@ -246,10 +246,10 @@ void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockB= ackend *blk, int coroutine_fn blk_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, 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, BdrvRequestFlags flags, Error **er= rp); -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); diff --git a/block/block-backend.c b/block/block-backend.c index 2e6ccce7ef2d..ee20ae5f0f28 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1330,7 +1330,7 @@ typedef struct BlkRwCo { } BlkRwCo; int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, - int bytes, BdrvRequestFlags flags) + int64_t bytes, BdrvRequestFlags flags) { return blk_pwritev_part(blk, offset, bytes, NULL, 0, flags | BDRV_REQ_ZERO_WRITE); @@ -1637,7 +1637,7 @@ int coroutine_fn blk_co_pdiscard(BlockBackend *blk, i= nt64_t offset, return ret; } -int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes) +int blk_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes) { int ret; @@ -2186,10 +2186,10 @@ int coroutine_fn blk_co_pwrite_zeroes(BlockBackend = *blk, int64_t offset, } int blk_pwrite_compressed(BlockBackend *blk, int64_t offset, const void *b= uf, - int count) + int64_t bytes) { - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, count); - return blk_pwritev_part(blk, offset, count, &qiov, 0, + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + return blk_pwritev_part(blk, offset, bytes, &qiov, 0, BDRV_REQ_WRITE_COMPRESSED); } --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332697212517.8124885998786; Fri, 15 Oct 2021 14:18:17 -0700 (PDT) Received: from localhost ([::1]:41490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUam-0002iJ-6A for importer@patchew.org; Fri, 15 Oct 2021 17:18:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTO-0007an-J8 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTE-0000iF-OU for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:38 -0400 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-378-kHX-SUs-NNqBt1XwBkCRhA-1; Fri, 15 Oct 2021 17:10:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82D6B802B9E; Fri, 15 Oct 2021 21:10:21 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13C9E1973B; Fri, 15 Oct 2021 21:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332225; 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=a/SudiPbjl5CLOjLztH3XldEGZYVx+819JcUXVO1nvw=; b=OPNZmLff1StSXiF+/q4KVUK6gVYFV+EPbIN5WxUk21Y4KmH6awmlzYGAA1JZGAJ+6OtRcz NoRikfmQL4rFJfPM0yIdlyG+04ICSbG1wi8mINjEH2h90Xu9YdV3NOFWwT8RMnsz0klyCn 3UZY2soHCbQ3gqZD4aStLmEdXmPJGfs= X-MC-Unique: kHX-SUs-NNqBt1XwBkCRhA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 10/15] block-backend: convert blk_co_copy_range to int64_t bytes Date: Fri, 15 Oct 2021 16:10:05 -0500 Message-Id: <20211015211011.1272011-11-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-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: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332699080100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Function is updated so that parameter type becomes wider, so all callers should be OK with it. Look at blk_co_copy_range() itself: bytes is passed only to blk_check_byte_request() and bdrv_co_copy_range(), which already have int64_t bytes parameter, so we are OK. Note that requests exceeding INT_MAX are still restricted by blk_check_byte_request(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-10-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: grammar tweaks] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 2 +- block/block-backend.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 3294d1b07a33..9ccf9f1a8025 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -270,7 +270,7 @@ void blk_unregister_buf(BlockBackend *blk, void *host); 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); const BdrvChild *blk_root(BlockBackend *blk); diff --git a/block/block-backend.c b/block/block-backend.c index ee20ae5f0f28..0746be89842b 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2418,7 +2418,7 @@ void blk_unregister_buf(BlockBackend *blk, void *host) 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.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634333285208622.7127837051696; Fri, 15 Oct 2021 14:28:05 -0700 (PDT) Received: from localhost ([::1]:39424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUkG-0003Ra-9W for importer@patchew.org; Fri, 15 Oct 2021 17:28:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTQ-0007gK-4e for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTE-0000if-Nw for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:39 -0400 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-401-Fr5c025qN8K7yEG7KwnqEg-1; Fri, 15 Oct 2021 17:10:23 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2AFF8801AFC; Fri, 15 Oct 2021 21:10:22 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1F0F1973B; Fri, 15 Oct 2021 21:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332226; 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=lBT9uB3qbPJkUocElNEeP64tz+p/4K62VVgzBaQzizk=; b=VseAcIEq1bzxqeFjYAOaqN0Wp0T1iGCayuUHvGGA8MKZRtZ0sPV2DfJWu3zXv2xpl0RI/E 9r77XylPRFTuWN/zQXZQUBo+gfxt8PTq6Sm2R4/Y5hffazY9sZeJB1eUAGFAwNJfCQ7Ana cpR/mvBxLoX7lwH3L2QAbpUqetm85Ow= X-MC-Unique: Fr5c025qN8K7yEG7KwnqEg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 11/15] block-backend: convert blk_aio_ functions to int64_t bytes paramter Date: Fri, 15 Oct 2021 16:10:06 -0500 Message-Id: <20211015211011.1272011-12-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634333287419100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 1. Convert bytes in BlkAioEmAIOCB: aio->bytes is only passed to already int64_t interfaces, and set in blk_aio_prwv, which is updated here. 2. For all updated functions the parameter type becomes wider so callers are safe. 3. In blk_aio_prwv we only store bytes to BlkAioEmAIOCB, which is updated here. 4. Other updated functions are wrappers on blk_aio_prwv. Note that blk_aio_preadv and blk_aio_pwritev become safer: before this commit, it's theoretically possible to pass qiov with size exceeding INT_MAX, which than converted to int argument of blk_aio_prwv. Now it's converted to int64_t which is a lot better. Still add assertions. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-11-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: tweak assertion and grammar] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 4 ++-- block/block-backend.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 9ccf9f1a8025..b5409a6b4553 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -157,7 +157,7 @@ static inline int coroutine_fn blk_co_pwrite(BlockBacke= nd *blk, int64_t offset, int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, 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); @@ -174,7 +174,7 @@ 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); diff --git a/block/block-backend.c b/block/block-backend.c index 0746be89842b..c889d0f97c45 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1380,7 +1380,7 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk, typedef struct BlkAioEmAIOCB { BlockAIOCB common; BlkRwCo rwco; - int bytes; + int64_t bytes; bool has_returned; } BlkAioEmAIOCB; @@ -1412,7 +1412,8 @@ static void blk_aio_complete_bh(void *opaque) blk_aio_complete(acb); } -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) @@ -1469,10 +1470,10 @@ static void blk_aio_write_entry(void *opaque) } 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); } @@ -1530,6 +1531,7 @@ BlockAIOCB *blk_aio_preadv(BlockBackend *blk, int64_t= offset, QEMUIOVector *qiov, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque) { + assert((uint64_t)qiov->size <=3D INT64_MAX); return blk_aio_prwv(blk, offset, qiov->size, qiov, blk_aio_read_entry, flags, cb, opaque); } @@ -1538,6 +1540,7 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_= t offset, QEMUIOVector *qiov, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque) { + assert(qiov->size <=3D INT64_MAX); return blk_aio_prwv(blk, offset, qiov->size, qiov, blk_aio_write_entry, flags, cb, opaque); } @@ -1618,7 +1621,7 @@ static void blk_aio_pdiscard_entry(void *opaque) } 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, --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332678893761.5210137714467; Fri, 15 Oct 2021 14:17:58 -0700 (PDT) Received: from localhost ([::1]:40216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUaT-0001pD-S9 for importer@patchew.org; Fri, 15 Oct 2021 17:17:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTR-0007ld-D8 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23193) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTK-0000h2-Gi for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:41 -0400 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-487-UlPihwrUMxWLeNqRjht2ig-1; Fri, 15 Oct 2021 17:10:23 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C41091006AA3; Fri, 15 Oct 2021 21:10:22 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5882D196E2; Fri, 15 Oct 2021 21:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332225; 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=EulQQBtafpCiBB2Q4OhWiPgWSM0Wmz7L3ybuTxHwaFA=; b=R4WxNF4j2A5AnTG/TsLhJoZkZfPpnbmaCZNd/r/QJVMBoFdwRAlhY34bC35PC5Mh4DhzO1 5zBn97Id3tabv7FqsOve8yrQ3JYZ0VmLvnXkYCZZKl2F+l2/b/o+DqvtDCTkr5b4eKaCSa 2MsoHq+ASIIB89D375EFtAZeXx9jve0= X-MC-Unique: UlPihwrUMxWLeNqRjht2ig-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 12/15] block-backend: blk_pread, blk_pwrite: rename count parameter to bytes Date: Fri, 15 Oct 2021 16:10:07 -0500 Message-Id: <20211015211011.1272011-13-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634332679905100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy To be consistent with declarations in include/sysemu/block-backend.h. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-12-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/block-backend.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index c889d0f97c45..59746eda45b0 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1477,27 +1477,27 @@ BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk= , int64_t offset, flags | BDRV_REQ_ZERO_WRITE, cb, opaque); } -int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int count) +int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int bytes) { int ret; - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, count); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); blk_inc_in_flight(blk); - ret =3D blk_do_preadv(blk, offset, count, &qiov, 0); + ret =3D blk_do_preadv(blk, offset, bytes, &qiov, 0); blk_dec_in_flight(blk); - return ret < 0 ? ret : count; + return ret < 0 ? ret : bytes; } -int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int cou= nt, +int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int byt= es, BdrvRequestFlags flags) { int ret; - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, count); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); - ret =3D blk_pwritev_part(blk, offset, count, &qiov, 0, flags); + ret =3D blk_pwritev_part(blk, offset, bytes, &qiov, 0, flags); - return ret < 0 ? ret : count; + return ret < 0 ? ret : bytes; } int64_t blk_getlength(BlockBackend *blk) --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163433338293697.57918276079408; Fri, 15 Oct 2021 14:29:42 -0700 (PDT) Received: from localhost ([::1]:41562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUlp-0004sD-Sh for importer@patchew.org; Fri, 15 Oct 2021 17:29:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTQ-0007iw-Nj for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTI-0000iM-J5 for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:40 -0400 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-67-GyobtMimNleq003y_ZHEcw-1; Fri, 15 Oct 2021 17:10:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6691110A8E03; Fri, 15 Oct 2021 21:10:23 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDFE419736; Fri, 15 Oct 2021 21:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332226; 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=b68i66YjLjEobO2PSrO3HzSobYvxYMWE2E2E5omagVo=; b=gLrjYsHgtsmf/e3zRNRlJF5RgixXmHO26qqh4AVExu9dJEyXFuuAKNfjGjKTWu3s8BovbA FflvO1MuVrA3usii4WAmmWsnb493cjDyNKw327FMNVF9iZlArvE46yrAfn1ka/jzH6ba4t GuulW+x7IeJUDh4hCNvvsJZzM5EVbZw= X-MC-Unique: GyobtMimNleq003y_ZHEcw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 13/15] block-backend: drop INT_MAX restriction from blk_check_byte_request() Date: Fri, 15 Oct 2021 16:10:08 -0500 Message-Id: <20211015211011.1272011-14-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.129.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Hanna Reitz , Vladimir Sementsov-Ogievskiy , "open list:Block layer core" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634333383412100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy blk_check_bytes_request is called from blk_co_do_preadv, blk_co_do_pwritev_part, blk_co_do_pdiscard and blk_co_copy_range before (maybe) calling throttle_group_co_io_limits_intercept() (which has int64_t argument) and then calling corresponding bdrv_co_ function. bdrv_co_ functions are OK with int64_t bytes as well. So dropping the check for INT_MAX we just get same restrictions as in bdrv_ layer: discard and write-zeroes goes through bdrv_check_qiov_request() and are allowed to be 64bit. Other requests go through bdrv_check_request32() and still restricted by INT_MAX boundary. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211006131718.214235-13-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/block-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/block-backend.c b/block/block-backend.c index 59746eda45b0..39cd99df2b3c 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1166,7 +1166,7 @@ static int blk_check_byte_request(BlockBackend *blk, = int64_t offset, { int64_t len; - if (bytes < 0 || bytes > INT_MAX) { + if (bytes < 0) { return -EIO; } --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634332982; cv=none; d=zohomail.com; s=zohoarc; b=X++XShnHDUQISeL3VOWaENz4wTZ7C/6tWRpDeSA4gh8GyUnc1AqEZOi6Y1mL4HwSlfPkYsa4aq1mTYlCEEnWujN2D4jLyIee3+eugy/k4to3sT4Ut4pUq7WkDHRo1nHi6fSxMawfz7EW82qCdvn0ip6TertYCEpnxKK5KgIUb8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634332982; 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=ncKsNL8mK2GDbUirp6337+X4sP8SaHrTEu2ViBJ9CyQ=; b=N5XvEYHDurCobFwgWwhjV4BMPA8CjwL/5CbeC8FwG8ovgfwSJ9wJLg/fLkcqy6oArxS+wAyb1yho1mM3bGrSPRB1SByql9RvOt2jBDBeq7evaRMfwHKUoTT8xlXL7Nox8cbVOy323NFFp51vIzErCi8AnNwTbK5Oqf4zV4M1DC0= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634332982624697.018919956745; Fri, 15 Oct 2021 14:23:02 -0700 (PDT) Received: from localhost ([::1]:57950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUfN-0005IL-Fm for importer@patchew.org; Fri, 15 Oct 2021 17:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTP-0007et-Mx for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55476) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTF-0000iQ-DM for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:39 -0400 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-232-eELX3yByMbK_9o6zE7BYfA-1; Fri, 15 Oct 2021 17:10:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D10A41006AA5; Fri, 15 Oct 2021 21:10:23 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91AB319736; Fri, 15 Oct 2021 21:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332226; 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=ncKsNL8mK2GDbUirp6337+X4sP8SaHrTEu2ViBJ9CyQ=; b=jScIh6/wSaVQ/3Rfdqnq4GLQ/zftKaPGLfSd7gWNoTHbHYUvZZmIUh6rXBD5I0KqouZiCi HZe3n8uiCE03uPTbHErN2Prb8cBfrEH8/pDcDfZ66zrgcWfX4GqE1TTf+Cf9J7F1VvnvKd Z36lVNISIbkK+bPjDpMmDoCM/Qn35h4= X-MC-Unique: eELX3yByMbK_9o6zE7BYfA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 14/15] block-backend: fix blk_co_flush prototype to mention coroutine_fn Date: Fri, 15 Oct 2021 16:10:09 -0500 Message-Id: <20211015211011.1272011-15-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Sementsov-Ogievskiy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634332984523100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We already have this marker for the blk_co_flush function declaration in block/block-backend.c. Add it in the header too. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211007175243.642516-1-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: wording tweak] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index b5409a6b4553..3fbc74e17cb4 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -183,7 +183,7 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned l= ong int req, void *buf, BlockCompletionFunc *cb, void *opaque); int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes); -int blk_co_flush(BlockBackend *blk); +int coroutine_fn blk_co_flush(BlockBackend *blk); int blk_flush(BlockBackend *blk); int blk_commit_all(void); void blk_inc_in_flight(BlockBackend *blk); --=20 2.31.1 From nobody Sun May 19 08:30:53 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634333214; cv=none; d=zohomail.com; s=zohoarc; b=lRh+32i3FhYma+jFrdLkMD052wW+M03H9wzLf3eRvOq5Hiz/QWN9J9Eq6qoITlfP82OTOCVdhYTzh7oWOdUkH90TPZd06OYtqa580Coxi925NxzD7jkfOObTUrIpywBo+y2I13IVcXSJLdfvEsf6kl9HL+AKabr8dhou4LXBneI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634333214; 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=phCrbGuwXMiTVkL+w3AnM6RYndZqedcNqgxPPLwg4QQ=; b=Ocd5dO0nssbYlaHy6TTLT1e5Sj89WY5o8G4AvlRczUUSnzGmpE8zze9hNq1KeKpoBdQP+unRm42JjyKdLYfxsCmTQqvrC0JmDXQLFbeabzkdfMbqWByzsOGL0BTXQFWvJ4E5ZIcLVSlWbG9xq+0nzw0YUf5TKtzuT1JZpNS/mt0= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634333214285358.7284036940557; Fri, 15 Oct 2021 14:26:54 -0700 (PDT) Received: from localhost ([::1]:37276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbUj7-00020R-7S for importer@patchew.org; Fri, 15 Oct 2021 17:26:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTQ-0007gH-2A for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbUTI-0000k4-IT for qemu-devel@nongnu.org; Fri, 15 Oct 2021 17:10:39 -0400 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-366-ezWXMOOLPgSQX7nAwbLhTQ-1; Fri, 15 Oct 2021 17:10:25 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C2808042CC; Fri, 15 Oct 2021 21:10:24 +0000 (UTC) Received: from blue.redhat.com (ovpn-114-130.phx2.redhat.com [10.3.114.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C01319736; Fri, 15 Oct 2021 21:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634332228; 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=phCrbGuwXMiTVkL+w3AnM6RYndZqedcNqgxPPLwg4QQ=; b=d0A6p7SeMuR9kzXpkmeWHHP675LErkFEEZSzr+XXz4DwleSi1WIMLebM1UUleIjFhSZljT MTySgBBYvliQcF+rX4+N/e3OLcH3YtmaGC25BCEIq1LTeWFCcE2jFpieaWQouWDdtO5lOv RpGKwow5G01IkA2z/ISVF9OkqjdXeqI= X-MC-Unique: ezWXMOOLPgSQX7nAwbLhTQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 15/15] block-backend: update blk_co_pwrite() and blk_co_pread() wrappers Date: Fri, 15 Oct 2021 16:10:10 -0500 Message-Id: <20211015211011.1272011-16-eblake@redhat.com> In-Reply-To: <20211015211011.1272011-1-eblake@redhat.com> References: <20211015211011.1272011-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Sementsov-Ogievskiy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634333214807100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Make bytes argument int64_t to be consistent with modern block-layer. Callers should be OK with it as type becomes wider. What is inside functions? - Conversion from int64_t to size_t. Still, we can't have a buffer larger than SIZE_MAX, therefore bytes should not be larger than SIZE_MAX as well. Add an assertion. - Passing to blk_co_pwritev() / blk_co_preadv() which already has int64_t bytes argument. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211007175243.642516-2-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake [eblake: spelling fix] Signed-off-by: Eric Blake --- include/sysemu/block-backend.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 3fbc74e17cb4..e5e1524f065b 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -137,20 +137,24 @@ int coroutine_fn blk_co_pwritev(BlockBackend *blk, in= t64_t offset, BdrvRequestFlags flags); static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t off= set, - unsigned int bytes, void *buf, + int64_t bytes, void *buf, BdrvRequestFlags flags) { QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + assert(bytes <=3D SIZE_MAX); + return blk_co_preadv(blk, offset, bytes, &qiov, flags); } static inline int coroutine_fn blk_co_pwrite(BlockBackend *blk, int64_t of= fset, - unsigned int bytes, void *buf, + int64_t bytes, void *buf, BdrvRequestFlags flags) { QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + assert(bytes <=3D SIZE_MAX); + return blk_co_pwritev(blk, offset, bytes, &qiov, flags); } --=20 2.31.1