From nobody Fri Sep 19 04:54:04 2025 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=1665666251; cv=none; d=zohomail.com; s=zohoarc; b=lxx2M7ojGj2WNNEI9Sh57EPK0f8szzHgtfhwI+qfGuoxQPz/Tlv9eIvqSzSmNeFkKWTMklcYhlWfqlP0yX78ia2qNvrtcRmSudyhjhMx5x5fSCiAYjeGXDTn+wl8LZf8U348uC6NygCSwNDQVngaPSe65gl+mqoOKdiXxRxJsWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665666251; 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=oNFx5/K1a3V3pRYlIt3h1gVdlhsBpwN6ccrfN2/Fbao=; b=K9UWF6HcZr2wR8ZdR0o2O6TYM/wQ2AgnEUfOHcETDgZcWSKv+zH0f1eqcDZZ7aPo+n65cOq7GGj5E7lIZS100hqeHqGHginYumRRJmXScxHjYD5ZTc6JOIr+55R++DRcqM5yHSVFT2KiSG+Jqo2UVQmSANbJu4NzsmoVDGfk5pI= 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 1665666251626146.76474519956366; Thu, 13 Oct 2022 06:04:11 -0700 (PDT) Received: from localhost ([::1]:35000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oixsf-0000en-7T for importer@patchew.org; Thu, 13 Oct 2022 09:04:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oixU0-0001ih-Vi for qemu-devel@nongnu.org; Thu, 13 Oct 2022 08:38:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oixTi-0004HU-JS for qemu-devel@nongnu.org; Thu, 13 Oct 2022 08:38:33 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-594-DLprlRHCM9iLnKJeK7mbrg-1; Thu, 13 Oct 2022 08:38:17 -0400 Received: by mail-ed1-f69.google.com with SMTP id y6-20020a056402358600b0045932521633so1418172edc.17 for ; Thu, 13 Oct 2022 05:38:16 -0700 (PDT) Received: from avogadro.local ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id gc22-20020a1709072b1600b0078cf8a743d6sm2918473ejc.100.2022.10.13.05.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 05:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665664698; 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=oNFx5/K1a3V3pRYlIt3h1gVdlhsBpwN6ccrfN2/Fbao=; b=X29Zzn3MBOzfmoqopalECKZIvbF7IT4xYQtUcj/RciIbtyNG0AUaUPRjBfnCC2IWAmTWFJ Z9DKO/a5RArBIIzaoVqK0VVshSoLAntS+nCZ6gLLL4BV47sZ2d4spBG7zUQlWNIakOnuZW hUqNMQm6V6WZYjP/zoiWilc8PlZ6R6o= X-MC-Unique: DLprlRHCM9iLnKJeK7mbrg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oNFx5/K1a3V3pRYlIt3h1gVdlhsBpwN6ccrfN2/Fbao=; b=ViAqlOVQQAn5co9qVhx2/aRODTLW1y3VwheBTNDExXr1Z2uEDyIlgVy+iKKgPH+FOO QG40Ly339f/ORr3q7BDIz4xVmBLf9Vycjmo5IG9ls71f2Q6r6asqckKSb3WwwxqFFKqq gKjHD827jDOhJru6oAEt9gYO75XJ+529ILgmlw4uQ+pt1RJz78toW1UgJ4iB4JBIsUL0 fwEZ0u7zBzzy6PRdx1McewiUEdnAher1bG0H9jgBYupDlAj8ifkfP5wvkH4adPUUf+K2 3DyhOJn3ByzCZrWQ2ifzt7+HVz5/ac8pm5hc+9Ydy4RrU9HekBsoZiNvNqHnxi3l7FZP XPIA== X-Gm-Message-State: ACrzQf1pSWb/3VpCKG3fYpqGy9fdZhqQhXksLthNJbGNLu7zT9Z2Iyw4 Zefl3o0WpQrz/wfndgH+mMOnV8K39/8BZ89dS3LdJupoOQwXKssfyTKjDB+8ggHMPCMMGQBt8bc y/eIbwOFZ16PE29186V/l5Myg1hNsHp5jza/tNkM/RKnPWqayswBoOTkvmxe8/c11Ocs= X-Received: by 2002:a17:907:3e96:b0:78d:f399:57e3 with SMTP id hs22-20020a1709073e9600b0078df39957e3mr6102725ejc.699.1665664695392; Thu, 13 Oct 2022 05:38:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zyqZAaOmlnScIFVLtMPH0qwwI/oiXdo0YCn1eMxyFzmZb3SiNPFx0MGgWxeImgFIfkeTs1g== X-Received: by 2002:a17:907:3e96:b0:78d:f399:57e3 with SMTP id hs22-20020a1709073e9600b0078df39957e3mr6102704ejc.699.1665664695035; Thu, 13 Oct 2022 05:38:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, afaria@redhat.com Subject: [PATCH 21/24] vdi: switch to *_co_* functions Date: Thu, 13 Oct 2022 14:37:08 +0200 Message-Id: <20221013123711.620631-22-pbonzini@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221013123711.620631-1-pbonzini@redhat.com> References: <20221013123711.620631-1-pbonzini@redhat.com> MIME-Version: 1.0 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=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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: 1665666253493100001 Content-Type: text/plain; charset="utf-8" From: Alberto Faria Signed-off-by: Alberto Faria Signed-off-by: Paolo Bonzini --- block/vdi.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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; --=20 2.37.3