From nobody Tue Feb 10 02:48:54 2026 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=1659101308; cv=none; d=zohomail.com; s=zohoarc; b=jtRvLSWDmLd5Df3rRal/JucRjZszJICYImQL1pYbtd7xs8GsHxXU4J2ws1Iy1Yc3TXDpY7KX5x17HgJmr/xxd7esERKwazQKTF4JIKQhxGBUa8X7gJTkIis12X/yl09WGPw2enS4PtmfE3bjhjvtWAwtr3JZIXl3KfY9RUbwSME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659101308; h=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=0xP+lFnNULgHBGbENutgPROn5Equ5OosJJYBLOV7HEY=; b=lpJYTHA+uYkTTRlVQ8RbUwZpfndTS9rqhdGVqfXFDCd+/4YNT4WCDcfrxQ6El13LrmfmSmTAQorPA2Dx0aCB4DMbNFDXvMfvHjujtMpp9SAAh5M58OB4CbQO+AwLPk0voX6BiAkmzkYt1RIX4Dbvt2gdrFpJq82cjwG7l88gKDQ= 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 1659101308270700.016405422049; Fri, 29 Jul 2022 06:28:28 -0700 (PDT) Received: from localhost ([::1]:59650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHQ2U-00073m-Qr for importer@patchew.org; Fri, 29 Jul 2022 09:28:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHPdk-0000Pv-K8 for qemu-devel@nongnu.org; Fri, 29 Jul 2022 09:02:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHPdh-0000Kp-3w for qemu-devel@nongnu.org; Fri, 29 Jul 2022 09:02:51 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-601-o3zjz8VVMzyvPZSuEIPnfw-1; Fri, 29 Jul 2022 09:02:45 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4663885A585; Fri, 29 Jul 2022 13:02:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92F492026D64; Fri, 29 Jul 2022 13:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659099768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0xP+lFnNULgHBGbENutgPROn5Equ5OosJJYBLOV7HEY=; b=jMMzM7ttRKW86AEMk3vNHb1eVd769NJHgww8wWhxwdQKmDAKqibSMDHACysdF4KN6GBXa4 UpjHf5h/Q06cBL+4QAgM3UTKq2ZQtqhYCXrGqzla+edoFTAYG73k3cgcBa6vi0v9YuIFaE C+qpRw8hIT5vdgRzk2vOdIDukxvAxfM= X-MC-Unique: o3zjz8VVMzyvPZSuEIPnfw-1 From: Alberto Faria To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefano Garzarella , Hannes Reinecke , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , "Maciej S. Szmigiero" , Peter Lieven , kvm@vger.kernel.org, Xie Yongji , Eric Auger , Hanna Reitz , Jeff Cody , Eric Blake , "Denis V. Lunev" , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Christian Schoenebeck , Stefan Weil , Klaus Jensen , Laurent Vivier , Alberto Garcia , Michael Roth , Juan Quintela , David Hildenbrand , qemu-block@nongnu.org, Konstantin Kostiuk , Kevin Wolf , Gerd Hoffmann , Stefan Hajnoczi , Marcelo Tosatti , Greg Kurz , "Michael S. Tsirkin" , Amit Shah , Paolo Bonzini , Alex Williamson , Peter Xu , Raphael Norwitz , Ronnie Sahlberg , Jason Wang , Emanuele Giuseppe Esposito , Richard Henderson , Marcel Apfelbaum , Dmitry Fleytman , Eduardo Habkost , Fam Zheng , Thomas Huth , Keith Busch , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Richard W.M. Jones" , John Snow , Markus Armbruster , Alberto Faria Subject: [RFC v2 10/10] Fix some calls from coroutine_fn to no_coroutine_fn Date: Fri, 29 Jul 2022 14:00:39 +0100 Message-Id: <20220729130040.1428779-11-afaria@redhat.com> In-Reply-To: <20220729130040.1428779-1-afaria@redhat.com> References: <20220729130040.1428779-1-afaria@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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=afaria@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.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659101309362100001 Content-Type: text/plain; charset="utf-8" These calls were found by static-analyzer.py. Not all occurrences of this problem were fixed. Signed-off-by: Alberto Faria --- block/commit.c | 2 +- block/io.c | 4 ++-- block/mirror.c | 4 ++-- block/parallels.c | 28 ++++++++++++++-------------- block/qcow.c | 10 +++++----- block/qcow2-snapshot.c | 6 +++--- block/qcow2.c | 24 ++++++++++++------------ block/qed-table.c | 2 +- block/qed.c | 12 ++++++------ block/vdi.c | 17 +++++++++-------- block/vhdx.c | 8 ++++---- block/vmdk.c | 11 ++++++----- blockdev.c | 2 +- 13 files changed, 66 insertions(+), 64 deletions(-) diff --git a/block/commit.c b/block/commit.c index 38571510cb..945945de05 100644 --- a/block/commit.c +++ b/block/commit.c @@ -135,7 +135,7 @@ static int coroutine_fn commit_run(Job *job, Error **er= rp) } =20 if (base_len < len) { - ret =3D blk_truncate(s->base, len, false, PREALLOC_MODE_OFF, 0, NU= LL); + ret =3D blk_co_truncate(s->base, len, false, PREALLOC_MODE_OFF, 0,= NULL); if (ret) { return ret; } diff --git a/block/io.c b/block/io.c index c2ed14cedb..a7d16eae02 100644 --- a/block/io.c +++ b/block/io.c @@ -2736,8 +2736,8 @@ int coroutine_fn bdrv_co_is_zero_fast(BlockDriverStat= e *bs, int64_t offset, return 1; } =20 - ret =3D bdrv_common_block_status_above(bs, NULL, false, false, offset, - bytes, &pnum, NULL, NULL, NULL); + ret =3D bdrv_co_common_block_status_above(bs, NULL, false, false, offs= et, + bytes, &pnum, NULL, NULL, NULL= ); =20 if (ret < 0) { return ret; diff --git a/block/mirror.c b/block/mirror.c index 3c4ab1159d..3cbb610118 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -921,8 +921,8 @@ static int coroutine_fn mirror_run(Job *job, Error **er= rp) * active layer. */ if (s->base =3D=3D blk_bs(s->target)) { if (s->bdev_length > target_length) { - ret =3D blk_truncate(s->target, s->bdev_length, false, - PREALLOC_MODE_OFF, 0, NULL); + ret =3D blk_co_truncate(s->target, s->bdev_length, false, + PREALLOC_MODE_OFF, 0, NULL); if (ret < 0) { goto immediate_exit; } diff --git a/block/parallels.c b/block/parallels.c index a229c06f25..46baea6387 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -204,18 +204,18 @@ static int64_t allocate_clusters(BlockDriverState *bs= , int64_t sector_num, * force the safer-but-slower fallocate. */ if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_TRUNCATE) { - ret =3D bdrv_truncate(bs->file, - (s->data_end + space) << BDRV_SECTOR_BITS, - false, PREALLOC_MODE_OFF, BDRV_REQ_ZERO_WR= ITE, - NULL); + ret =3D bdrv_co_truncate(bs->file, + (s->data_end + space) << BDRV_SECTOR_BI= TS, + false, PREALLOC_MODE_OFF, + BDRV_REQ_ZERO_WRITE, NULL); if (ret =3D=3D -ENOTSUP) { s->prealloc_mode =3D PRL_PREALLOC_MODE_FALLOCATE; } } if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_FALLOCATE) { - ret =3D bdrv_pwrite_zeroes(bs->file, - s->data_end << BDRV_SECTOR_BITS, - space << BDRV_SECTOR_BITS, 0); + ret =3D bdrv_co_pwrite_zeroes(bs->file, + s->data_end << BDRV_SECTOR_BITS, + space << BDRV_SECTOR_BITS, 0); } if (ret < 0) { return ret; @@ -277,8 +277,8 @@ static coroutine_fn int parallels_co_flush_to_os(BlockD= riverState *bs) if (off + to_write > s->header_size) { to_write =3D s->header_size - off; } - ret =3D bdrv_pwrite(bs->file, off, to_write, (uint8_t *)s->header = + off, - 0); + ret =3D bdrv_co_pwrite(bs->file, off, to_write, + (uint8_t *)s->header + off, 0); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; @@ -503,8 +503,8 @@ static int coroutine_fn parallels_co_check(BlockDriverS= tate *bs, * In order to really repair the image, we must shrink it. * That means we have to pass exact=3Dtrue. */ - ret =3D bdrv_truncate(bs->file, res->image_end_offset, true, - PREALLOC_MODE_OFF, 0, &local_err); + ret =3D bdrv_co_truncate(bs->file, res->image_end_offset, true, + PREALLOC_MODE_OFF, 0, &local_err); if (ret < 0) { error_report_err(local_err); res->check_errors++; @@ -599,12 +599,12 @@ static int coroutine_fn parallels_co_create(BlockdevC= reateOptions* opts, memset(tmp, 0, sizeof(tmp)); memcpy(tmp, &header, sizeof(header)); =20 - ret =3D blk_pwrite(blk, 0, BDRV_SECTOR_SIZE, tmp, 0); + ret =3D blk_co_pwrite(blk, 0, BDRV_SECTOR_SIZE, tmp, 0); if (ret < 0) { goto exit; } - ret =3D blk_pwrite_zeroes(blk, BDRV_SECTOR_SIZE, - (bat_sectors - 1) << BDRV_SECTOR_BITS, 0); + ret =3D blk_co_pwrite_zeroes(blk, BDRV_SECTOR_SIZE, + (bat_sectors - 1) << BDRV_SECTOR_BITS, 0); if (ret < 0) { goto exit; } diff --git a/block/qcow.c b/block/qcow.c index 311aaa8705..7dc29358ba 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -890,14 +890,14 @@ static int coroutine_fn qcow_co_create(BlockdevCreate= Options *opts, } =20 /* write all the data */ - ret =3D blk_pwrite(qcow_blk, 0, sizeof(header), &header, 0); + ret =3D blk_co_pwrite(qcow_blk, 0, sizeof(header), &header, 0); if (ret < 0) { goto exit; } =20 if (qcow_opts->has_backing_file) { - ret =3D blk_pwrite(qcow_blk, sizeof(header), backing_filename_len, - qcow_opts->backing_file, 0); + ret =3D blk_co_pwrite(qcow_blk, sizeof(header), backing_filename_l= en, + qcow_opts->backing_file, 0); if (ret < 0) { goto exit; } @@ -906,8 +906,8 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOp= tions *opts, tmp =3D g_malloc0(BDRV_SECTOR_SIZE); for (i =3D 0; i < DIV_ROUND_UP(sizeof(uint64_t) * l1_size, BDRV_SECTOR= _SIZE); i++) { - ret =3D blk_pwrite(qcow_blk, header_size + BDRV_SECTOR_SIZE * i, - BDRV_SECTOR_SIZE, tmp, 0); + ret =3D blk_co_pwrite(qcow_blk, header_size + BDRV_SECTOR_SIZE * i, + BDRV_SECTOR_SIZE, tmp, 0); if (ret < 0) { g_free(tmp); goto exit; diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index d1d46facbf..62e8a0335d 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -441,9 +441,9 @@ int coroutine_fn qcow2_check_read_snapshot_table(BlockD= riverState *bs, } QEMU_PACKED snapshot_table_pointer; =20 /* qcow2_do_open() discards this information in check mode */ - ret =3D bdrv_pread(bs->file, offsetof(QCowHeader, nb_snapshots), - sizeof(snapshot_table_pointer), &snapshot_table_point= er, - 0); + ret =3D bdrv_co_pread(bs->file, offsetof(QCowHeader, nb_snapshots), + sizeof(snapshot_table_pointer), &snapshot_table_po= inter, + 0); if (ret < 0) { result->check_errors++; fprintf(stderr, "ERROR failed to read the snapshot table pointer f= rom " diff --git a/block/qcow2.c b/block/qcow2.c index d3dad0142e..524207fcfe 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1305,7 +1305,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverStat= e *bs, QDict *options, uint64_t l1_vm_state_index; bool update_header =3D false; =20 - ret =3D bdrv_pread(bs->file, 0, sizeof(header), &header, 0); + ret =3D bdrv_co_pread(bs->file, 0, sizeof(header), &header, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read qcow2 header"); goto fail; @@ -1381,9 +1381,9 @@ static int coroutine_fn qcow2_do_open(BlockDriverStat= e *bs, QDict *options, if (header.header_length > sizeof(header)) { s->unknown_header_fields_size =3D header.header_length - sizeof(he= ader); s->unknown_header_fields =3D g_malloc(s->unknown_header_fields_siz= e); - ret =3D bdrv_pread(bs->file, sizeof(header), - s->unknown_header_fields_size, - s->unknown_header_fields, 0); + ret =3D bdrv_co_pread(bs->file, sizeof(header), + s->unknown_header_fields_size, + s->unknown_header_fields, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read unknown qcow2 hea= der " "fields"); @@ -1578,8 +1578,8 @@ static int coroutine_fn qcow2_do_open(BlockDriverStat= e *bs, QDict *options, ret =3D -ENOMEM; goto fail; } - ret =3D bdrv_pread(bs->file, s->l1_table_offset, s->l1_size * L1E_= SIZE, - s->l1_table, 0); + ret =3D bdrv_co_pread(bs->file, s->l1_table_offset, s->l1_size * L= 1E_SIZE, + s->l1_table, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read L1 table"); goto fail; @@ -1696,8 +1696,8 @@ static int coroutine_fn qcow2_do_open(BlockDriverStat= e *bs, QDict *options, ret =3D -EINVAL; goto fail; } - ret =3D bdrv_pread(bs->file, header.backing_file_offset, len, - bs->auto_backing_file, 0); + ret =3D bdrv_co_pread(bs->file, header.backing_file_offset, len, + bs->auto_backing_file, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read backing file name= "); goto fail; @@ -3666,7 +3666,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) cpu_to_be64(QCOW2_INCOMPAT_EXTL2); } =20 - ret =3D blk_pwrite(blk, 0, cluster_size, header, 0); + ret =3D blk_co_pwrite(blk, 0, cluster_size, header, 0); g_free(header); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write qcow2 header"); @@ -3676,7 +3676,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) /* Write a refcount table with one refcount block */ refcount_table =3D g_malloc0(2 * cluster_size); refcount_table[0] =3D cpu_to_be64(2 * cluster_size); - ret =3D blk_pwrite(blk, cluster_size, 2 * cluster_size, refcount_table= , 0); + ret =3D blk_co_pwrite(blk, cluster_size, 2 * cluster_size, refcount_ta= ble, 0); g_free(refcount_table); =20 if (ret < 0) { @@ -3731,8 +3731,8 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) } =20 /* Okay, now that we have a valid image, let's give it the right size = */ - ret =3D blk_truncate(blk, qcow2_opts->size, false, qcow2_opts->preallo= cation, - 0, errp); + ret =3D blk_co_truncate(blk, qcow2_opts->size, false, + qcow2_opts->preallocation, 0, errp); if (ret < 0) { error_prepend(errp, "Could not resize image: "); goto out; diff --git a/block/qed-table.c b/block/qed-table.c index 1cc844b1a5..aa203f2627 100644 --- a/block/qed-table.c +++ b/block/qed-table.c @@ -100,7 +100,7 @@ static int coroutine_fn qed_write_table(BDRVQEDState *s= , uint64_t offset, } =20 if (flush) { - ret =3D bdrv_flush(s->bs); + ret =3D bdrv_co_flush(s->bs); if (ret < 0) { goto out; } diff --git a/block/qed.c b/block/qed.c index 9114cde42f..72e95852de 100644 --- a/block/qed.c +++ b/block/qed.c @@ -387,7 +387,7 @@ static int coroutine_fn bdrv_qed_do_open(BlockDriverSta= te *bs, QDict *options, int64_t file_size; int ret; =20 - ret =3D bdrv_pread(bs->file, 0, sizeof(le_header), &le_header, 0); + ret =3D bdrv_co_pread(bs->file, 0, sizeof(le_header), &le_header, 0); if (ret < 0) { error_setg(errp, "Failed to read QED header"); return ret; @@ -485,7 +485,7 @@ static int coroutine_fn bdrv_qed_do_open(BlockDriverSta= te *bs, QDict *options, } =20 /* From here on only known autoclear feature bits are valid */ - bdrv_flush(bs->file->bs); + bdrv_co_flush(bs->file->bs); } =20 s->l1_table =3D qed_alloc_table(s); @@ -686,7 +686,7 @@ static int coroutine_fn bdrv_qed_co_create(BlockdevCrea= teOptions *opts, * The QED format associates file length with allocation status, * so a new file (which is empty) must have a length of 0. */ - ret =3D blk_truncate(blk, 0, true, PREALLOC_MODE_OFF, 0, errp); + ret =3D blk_co_truncate(blk, 0, true, PREALLOC_MODE_OFF, 0, errp); if (ret < 0) { goto out; } @@ -705,18 +705,18 @@ static int coroutine_fn bdrv_qed_co_create(BlockdevCr= eateOptions *opts, } =20 qed_header_cpu_to_le(&header, &le_header); - ret =3D blk_pwrite(blk, 0, sizeof(le_header), &le_header, 0); + ret =3D blk_co_pwrite(blk, 0, sizeof(le_header), &le_header, 0); if (ret < 0) { goto out; } - ret =3D blk_pwrite(blk, sizeof(le_header), header.backing_filename_siz= e, + ret =3D blk_co_pwrite(blk, sizeof(le_header), header.backing_filename_= size, qed_opts->backing_file, 0); if (ret < 0) { goto out; } =20 l1_table =3D g_malloc0(l1_size); - ret =3D blk_pwrite(blk, header.l1_table_offset, l1_size, l1_table, 0); + ret =3D blk_co_pwrite(blk, header.l1_table_offset, l1_size, l1_table, = 0); if (ret < 0) { goto out; } diff --git a/block/vdi.c b/block/vdi.c index e942325455..2ecf47216a 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -664,7 +664,8 @@ vdi_co_pwritev(BlockDriverState *bs, int64_t offset, in= t64_t bytes, * so this full-cluster write does not overlap a partial write * of the same cluster, issued from the "else" branch. */ - ret =3D bdrv_pwrite(bs->file, data_offset, s->block_size, bloc= k, 0); + ret =3D bdrv_co_pwrite(bs->file, data_offset, s->block_size, b= lock, + 0); qemu_co_rwlock_unlock(&s->bmap_lock); } else { nonallocating_write: @@ -709,7 +710,7 @@ nonallocating_write: assert(VDI_IS_ALLOCATED(bmap_first)); *header =3D s->header; vdi_header_to_le(header); - ret =3D bdrv_pwrite(bs->file, 0, sizeof(*header), header, 0); + ret =3D bdrv_co_pwrite(bs->file, 0, sizeof(*header), header, 0); g_free(header); =20 if (ret < 0) { @@ -726,8 +727,8 @@ nonallocating_write: base =3D ((uint8_t *)&s->bmap[0]) + bmap_first * SECTOR_SIZE; logout("will write %u block map sectors starting from entry %u\n", n_sectors, bmap_first); - ret =3D bdrv_pwrite(bs->file, offset * SECTOR_SIZE, - n_sectors * SECTOR_SIZE, base, 0); + ret =3D bdrv_co_pwrite(bs->file, offset * SECTOR_SIZE, + n_sectors * SECTOR_SIZE, base, 0); } =20 return ret; @@ -845,7 +846,7 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, vdi_header_print(&header); } vdi_header_to_le(&header); - ret =3D blk_pwrite(blk, offset, sizeof(header), &header, 0); + ret =3D blk_co_pwrite(blk, offset, sizeof(header), &header, 0); if (ret < 0) { error_setg(errp, "Error writing header"); goto exit; @@ -866,7 +867,7 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, bmap[i] =3D VDI_UNALLOCATED; } } - ret =3D blk_pwrite(blk, offset, bmap_size, bmap, 0); + ret =3D blk_co_pwrite(blk, offset, bmap_size, bmap, 0); if (ret < 0) { error_setg(errp, "Error writing bmap"); goto exit; @@ -875,8 +876,8 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, } =20 if (image_type =3D=3D VDI_TYPE_STATIC) { - ret =3D blk_truncate(blk, offset + blocks * block_size, false, - PREALLOC_MODE_OFF, 0, errp); + ret =3D blk_co_truncate(blk, offset + blocks * block_size, false, + PREALLOC_MODE_OFF, 0, errp); if (ret < 0) { error_prepend(errp, "Failed to statically allocate file"); goto exit; diff --git a/block/vhdx.c b/block/vhdx.c index e10e78ebfd..f7dd4eb092 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -2012,15 +2012,15 @@ static int coroutine_fn vhdx_co_create(BlockdevCrea= teOptions *opts, creator =3D g_utf8_to_utf16("QEMU v" QEMU_VERSION, -1, NULL, &creator_items, NULL); signature =3D cpu_to_le64(VHDX_FILE_SIGNATURE); - ret =3D blk_pwrite(blk, VHDX_FILE_ID_OFFSET, sizeof(signature), &signa= ture, - 0); + ret =3D blk_co_pwrite(blk, VHDX_FILE_ID_OFFSET, sizeof(signature), &si= gnature, + 0); if (ret < 0) { error_setg_errno(errp, -ret, "Failed to write file signature"); goto delete_and_exit; } if (creator) { - ret =3D blk_pwrite(blk, VHDX_FILE_ID_OFFSET + sizeof(signature), - creator_items * sizeof(gunichar2), creator, 0); + ret =3D blk_co_pwrite(blk, VHDX_FILE_ID_OFFSET + sizeof(signature), + creator_items * sizeof(gunichar2), creator, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Failed to write creator field"); goto delete_and_exit; diff --git a/block/vmdk.c b/block/vmdk.c index fe07a54866..d7886a52e1 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1897,7 +1897,8 @@ static int vmdk_read_extent(VmdkExtent *extent, int64= _t cluster_offset, cluster_buf =3D g_malloc(buf_bytes); uncomp_buf =3D g_malloc(cluster_bytes); BLKDBG_EVENT(extent->file, BLKDBG_READ_COMPRESSED); - ret =3D bdrv_pread(extent->file, cluster_offset, buf_bytes, cluster_bu= f, 0); + ret =3D bdrv_co_pread(extent->file, cluster_offset, buf_bytes, cluster= _buf, + 0); if (ret < 0) { goto out; } @@ -2142,8 +2143,8 @@ vmdk_co_pwritev_compressed(BlockDriverState *bs, int6= 4_t offset, int64_t bytes, return length; } length =3D QEMU_ALIGN_UP(length, BDRV_SECTOR_SIZE); - ret =3D bdrv_truncate(s->extents[i].file, length, false, - PREALLOC_MODE_OFF, 0, NULL); + ret =3D bdrv_co_truncate(s->extents[i].file, length, false, + PREALLOC_MODE_OFF, 0, NULL); if (ret < 0) { return ret; } @@ -2584,7 +2585,7 @@ static int coroutine_fn vmdk_co_do_create(int64_t siz= e, desc_offset =3D 0x200; } =20 - ret =3D blk_pwrite(blk, desc_offset, desc_len, desc, 0); + ret =3D blk_co_pwrite(blk, desc_offset, desc_len, desc, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write description"); goto exit; @@ -2592,7 +2593,7 @@ static int coroutine_fn vmdk_co_do_create(int64_t siz= e, /* bdrv_pwrite write padding zeros to align to sector, we don't need t= hat * for description file */ if (desc_offset =3D=3D 0) { - ret =3D blk_truncate(blk, desc_len, false, PREALLOC_MODE_OFF, 0, e= rrp); + ret =3D blk_co_truncate(blk, desc_len, false, PREALLOC_MODE_OFF, 0= , errp); if (ret < 0) { goto exit; } diff --git a/blockdev.c b/blockdev.c index 9230888e34..beeb51211a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2453,7 +2453,7 @@ void coroutine_fn qmp_block_resize(bool has_device, c= onst char *device, bdrv_co_unlock(bs); =20 old_ctx =3D bdrv_co_enter(bs); - blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp); + blk_co_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp); bdrv_co_leave(bs, old_ctx); =20 bdrv_co_lock(bs); --=20 2.37.1