From nobody Mon Apr 29 15:21:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945437; cv=none; d=zoho.com; s=zohoarc; b=DHFv8oQuyX/6n7KOOW383iUH3r5VNv5zFWAg60ppohd9axiOllJrMJHKpnJSwDikTGfaZPrgMnJIUL4ZG/61Q0QtTwwkBWT0L4kk5qpNw50733u1V33aWLTdccwVBgb5dFMhf/9TPajrY1xaS7rfKDra5qamaidSG6azmgfjZ/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945437; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0XxDmgfF22PP4Xu147HLRtIrVad/LSIXEfbfQ3mfaAQ=; b=ZqyuWl7C/YPCI+uoFiOU8NWvik+JzkUBSSHa/aRuCRKmobPOOA5bxW7pXnNZOZ9daWODZOITdSIl999bD+eW/Rli4MOf1DPcFvWwEBtaKwJT07wxG8nO8rWg/tNkSpWdBlRYMZmcjg6SqYJHyUomgw2vOATCzciZG/eVhubq7P0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945437506111.54847728227492; Mon, 22 Apr 2019 08:03:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:38489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaU6-0004pM-K3 for importer@patchew.org; Mon, 22 Apr 2019 11:03:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP5-0000np-Su for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00037r-KS for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:43 -0400 Received: from relay.sw.ru ([185.231.240.75]:55306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036L-BO; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP1-0003k3-9p; Mon, 22 Apr 2019 17:58:39 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:30 +0300 Message-Id: <20190422145838.70903-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 1/9] block: introduce byte-based io helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- include/block/block_int.h | 16 ++++++++++++++++ include/sysemu/block-backend.h | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/block/block_int.h b/include/block/block_int.h index 01e855a066..94d45c9708 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -925,6 +925,22 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); =20 +static inline int coroutine_fn bdrv_co_pread(BdrvChild *child, + int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) +{ + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + + return bdrv_co_preadv(child, offset, bytes, &qiov, flags); +} + +static inline int coroutine_fn bdrv_co_pwrite(BdrvChild *child, + int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) +{ + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + + return bdrv_co_pwritev(child, offset, bytes, &qiov, flags); +} + extern unsigned int bdrv_drain_all_count; void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_pare= nt); void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_pa= rent); diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 3be05c2d68..5be6224226 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -124,6 +124,25 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int6= 4_t offset, int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags); + +static inline int coroutine_fn blk_co_pread(BlockBackend *blk, int64_t off= set, + unsigned int bytes, void *buf, + BdrvRequestFlags flags) +{ + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + + 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, + BdrvRequestFlags flags) +{ + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); + + return blk_co_pwritev(blk, offset, bytes, &qiov, flags); +} + int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset, int bytes, BdrvRequestFlags flags); BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset, --=20 2.18.0 From nobody Mon Apr 29 15:21:01 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945257; cv=none; d=zoho.com; s=zohoarc; b=L+GMcJ1J3l6nG/qXWj5XCQHi2i7vvmpt7Y0pqXLMtuEziHT6kULDfBMeKZZ6kgbS2BwbOWEJg+S1zgAxHCxQ712Su3lK/4RwN7Nz3OpVZyyDk6OCiNa31LwPeANqbOsF95hwjjV8ENE5NPdluyXLzPlbfNW8O4cWd5Mkc/wnQfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945257; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=v7z1JsIGpOpdpX1LYisR/r7TBOr9XbigZyPjfmXF5sk=; b=FRnRe3OVGj1oie9Ul6gcBF7lAWT4iiIA48UOnYqiA5tdX8uZPOMvxH+Nyi3k4Yw1n03jQHtHOQPoJMIZhiukrTioppB7yZjMrIP8UMLnKaiJzIkSeXBIMLwfdaO+zXBikSiLKJaSseT4sh4YVdTztEL2hv1fND01NvS7l4XVEmk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945257349733.8859164561135; Mon, 22 Apr 2019 08:00:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:38443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaR0-000218-6n for importer@patchew.org; Mon, 22 Apr 2019 11:00:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP5-0000nn-ND for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00037u-KX for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:43 -0400 Received: from relay.sw.ru ([185.231.240.75]:55314) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036J-BB; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP1-0003k3-Cr; Mon, 22 Apr 2019 17:58:39 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:31 +0300 Message-Id: <20190422145838.70903-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 2/9] block/qcow2: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/qcow2.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 3ace3b2209..c3b2ea294d 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4088,7 +4088,6 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uin= t64_t offset, uint64_t bytes, QEMUIOVector *qiov) { BDRVQcow2State *s =3D bs->opaque; - QEMUIOVector hd_qiov; int ret; size_t out_len; uint8_t *buf, *out_buf; @@ -4155,10 +4154,8 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, ui= nt64_t offset, goto fail; } =20 - qemu_iovec_init_buf(&hd_qiov, out_buf, out_len); - BLKDBG_EVENT(s->data_file, BLKDBG_WRITE_COMPRESSED); - ret =3D bdrv_co_pwritev(s->data_file, cluster_offset, out_len, &hd_qio= v, 0); + ret =3D bdrv_co_pwrite(s->data_file, cluster_offset, out_len, out_buf,= 0); if (ret < 0) { goto fail; } @@ -4181,7 +4178,6 @@ qcow2_co_preadv_compressed(BlockDriverState *bs, int ret =3D 0, csize, nb_csectors; uint64_t coffset; uint8_t *buf, *out_buf; - QEMUIOVector local_qiov; int offset_in_cluster =3D offset_into_cluster(s, offset); =20 coffset =3D file_cluster_offset & s->cluster_offset_mask; @@ -4192,12 +4188,11 @@ qcow2_co_preadv_compressed(BlockDriverState *bs, if (!buf) { return -ENOMEM; } - qemu_iovec_init_buf(&local_qiov, buf, csize); =20 out_buf =3D qemu_blockalign(bs, s->cluster_size); =20 BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED); - ret =3D bdrv_co_preadv(bs->file, coffset, csize, &local_qiov, 0); + ret =3D bdrv_co_pread(bs->file, coffset, csize, buf, 0); if (ret < 0) { goto fail; } --=20 2.18.0 From nobody Mon Apr 29 15:21:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945436; cv=none; d=zoho.com; s=zohoarc; b=YlAN26B5/dOYx6AH8reofhgQrgiQYgqxPWCKO330m8wD/R+L67EhVc/DtqPnQMwFpX2XBVks7pklEW61uPYoNMdyAJAgjn7pvtX7cJ6az4408XlrdyKRHKfQD1U0PY7f+x61s6ZQHbORG6oDe4Qm4dsLtskPBmHmh+YNYnoT/dE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945436; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=G5he1vO4qHlkWXcSkq3TbvdPqBkQsmfzzqzgyUHTDcY=; b=gKM6a4yVr5Etqbs9vsEgreFeyuflCIXQjO2o1Wjz3EPfx8PkQp5Ky5L3LcbxeVPwU91s2Vih9O6OpVRCyxkjz0CO5kHmQe7QcAhn4eOQxn8mhoH7w69i1KQSOPtDl1tnnQ47XTUJGC9UoIYQ3+5OqmF3b7/A6osyA7x+wAKfSMA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945436923758.18870841036; Mon, 22 Apr 2019 08:03:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:38487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaU5-0004ny-1R for importer@patchew.org; Mon, 22 Apr 2019 11:03:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP6-0000nq-0D for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00037a-GF for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:43 -0400 Received: from relay.sw.ru ([185.231.240.75]:55312) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036I-9J; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP1-0003k3-HT; Mon, 22 Apr 2019 17:58:39 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:32 +0300 Message-Id: <20190422145838.70903-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 3/9] block/qcow: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/qcow.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/block/qcow.c b/block/qcow.c index 10d2cf14b3..1bb8fd05e2 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -631,7 +631,6 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState= *bs, uint64_t offset, int offset_in_cluster; int ret =3D 0, n; uint64_t cluster_offset; - QEMUIOVector hd_qiov; uint8_t *buf; void *orig_buf; =20 @@ -663,11 +662,10 @@ static coroutine_fn int qcow_co_preadv(BlockDriverSta= te *bs, uint64_t offset, if (!cluster_offset) { if (bs->backing) { /* read from the base image */ - qemu_iovec_init_buf(&hd_qiov, buf, n); qemu_co_mutex_unlock(&s->lock); /* qcow2 emits this on bs->file instead of bs->backing */ BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO); - ret =3D bdrv_co_preadv(bs->backing, offset, n, &hd_qiov, 0= ); + ret =3D bdrv_co_pread(bs->backing, offset, n, buf, 0); qemu_co_mutex_lock(&s->lock); if (ret < 0) { break; @@ -688,11 +686,10 @@ static coroutine_fn int qcow_co_preadv(BlockDriverSta= te *bs, uint64_t offset, ret =3D -EIO; break; } - qemu_iovec_init_buf(&hd_qiov, buf, n); qemu_co_mutex_unlock(&s->lock); BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO); - ret =3D bdrv_co_preadv(bs->file, cluster_offset + offset_in_cl= uster, - n, &hd_qiov, 0); + ret =3D bdrv_co_pread(bs->file, cluster_offset + offset_in_clu= ster, + n, buf, 0); qemu_co_mutex_lock(&s->lock); if (ret < 0) { break; @@ -731,7 +728,6 @@ static coroutine_fn int qcow_co_pwritev(BlockDriverStat= e *bs, uint64_t offset, int offset_in_cluster; uint64_t cluster_offset; int ret =3D 0, n; - QEMUIOVector hd_qiov; uint8_t *buf; void *orig_buf; =20 @@ -776,11 +772,10 @@ static coroutine_fn int qcow_co_pwritev(BlockDriverSt= ate *bs, uint64_t offset, } } =20 - qemu_iovec_init_buf(&hd_qiov, buf, n); qemu_co_mutex_unlock(&s->lock); BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); - ret =3D bdrv_co_pwritev(bs->file, cluster_offset + offset_in_clust= er, - n, &hd_qiov, 0); + ret =3D bdrv_co_pwrite(bs->file, cluster_offset + offset_in_cluste= r, + n, buf, 0); qemu_co_mutex_lock(&s->lock); if (ret < 0) { break; @@ -1056,7 +1051,6 @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint= 64_t offset, uint64_t bytes, QEMUIOVector *qiov) { BDRVQcowState *s =3D bs->opaque; - QEMUIOVector hd_qiov; z_stream strm; int ret, out_len; uint8_t *buf, *out_buf; @@ -1122,9 +1116,8 @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint= 64_t offset, } cluster_offset &=3D s->cluster_offset_mask; =20 - qemu_iovec_init_buf(&hd_qiov, out_buf, out_len); BLKDBG_EVENT(bs->file, BLKDBG_WRITE_COMPRESSED); - ret =3D bdrv_co_pwritev(bs->file, cluster_offset, out_len, &hd_qiov, 0= ); + ret =3D bdrv_co_pwrite(bs->file, cluster_offset, out_len, out_buf, 0); if (ret < 0) { goto fail; } --=20 2.18.0 From nobody Mon Apr 29 15:21:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945453; cv=none; d=zoho.com; s=zohoarc; b=OwOGRBrvIcgoR8wI0DMo/3eM+lefVCNqxKXXGjkFyzcNgpr+9NFL4Uj7LSSpN0jaRgnSqULnzX1Fi5ftTPUbEOGPhiqt/zfZeXMiuzSLq84sXCn7ZrUK1nmO3L0eNPxSduf7j2KUGwb8F9HKMdf4ubfNyZEDQ20LCc1rSIfEbl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945453; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=b/1PorrV9daFbpSRF4TvE+t5jMyGPxe6+9ZgdpL67N8=; b=nMD9QandjeGPUw3Wk+81P7+nmof/6JiuN8qpKKg/ylkHtKOBIwsTOIfcNkQukXTS1HRgwXyBf/V+UG2waEY4ujd+FZ2kIGeU0rFY7Pe2aCS5drw8lxbVMQ4ZXRvHUfw2xVVaEHEyCVXOzNhwAN+vOGNGoa/0/QmQ0hm6Ky+r5qc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945453813678.7520930238734; Mon, 22 Apr 2019 08:04:13 -0700 (PDT) Received: from localhost ([127.0.0.1]:38493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaUM-000515-Ch for importer@patchew.org; Mon, 22 Apr 2019 11:04:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP7-0000oH-35 for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00038c-Nc for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:45 -0400 Received: from relay.sw.ru ([185.231.240.75]:55294) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036M-DO; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP1-0003k3-Kw; Mon, 22 Apr 2019 17:58:39 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:33 +0300 Message-Id: <20190422145838.70903-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 4/9] block/qed: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move to _co_ versions of io functions qed_read_table() and qed_write_table(), as we use qemu_co_mutex_unlock() anyway. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/qed-table.c | 12 +++++------- block/qed.c | 6 ++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/block/qed-table.c b/block/qed-table.c index c497bd4aec..cf30edd977 100644 --- a/block/qed-table.c +++ b/block/qed-table.c @@ -21,22 +21,22 @@ /* Called with table_lock held. */ static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *tabl= e) { - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF( - qiov, table->offsets, s->header.cluster_size * s->header.table_siz= e); + unsigned int bytes =3D s->header.cluster_size * s->header.table_size; + int noffsets; int i, ret; =20 trace_qed_read_table(s, offset, table); =20 qemu_co_mutex_unlock(&s->table_lock); - ret =3D bdrv_preadv(s->bs->file, offset, &qiov); + ret =3D bdrv_co_pread(s->bs->file, offset, bytes, table->offsets, 0); qemu_co_mutex_lock(&s->table_lock); if (ret < 0) { goto out; } =20 /* Byteswap offsets */ - noffsets =3D qiov.size / sizeof(uint64_t); + noffsets =3D bytes / sizeof(uint64_t); for (i =3D 0; i < noffsets; i++) { table->offsets[i] =3D le64_to_cpu(table->offsets[i]); } @@ -66,7 +66,6 @@ static int qed_write_table(BDRVQEDState *s, uint64_t offs= et, QEDTable *table, unsigned int sector_mask =3D BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; unsigned int start, end, i; QEDTable *new_table; - QEMUIOVector qiov; size_t len_bytes; int ret; =20 @@ -79,7 +78,6 @@ static int qed_write_table(BDRVQEDState *s, uint64_t offs= et, QEDTable *table, len_bytes =3D (end - start) * sizeof(uint64_t); =20 new_table =3D qemu_blockalign(s->bs, len_bytes); - qemu_iovec_init_buf(&qiov, new_table->offsets, len_bytes); =20 /* Byteswap table */ for (i =3D start; i < end; i++) { @@ -91,7 +89,7 @@ static int qed_write_table(BDRVQEDState *s, uint64_t offs= et, QEDTable *table, offset +=3D start * sizeof(uint64_t); =20 qemu_co_mutex_unlock(&s->table_lock); - ret =3D bdrv_pwritev(s->bs->file, offset, &qiov); + ret =3D bdrv_co_pwrite(s->bs->file, offset, len_bytes, new_table->offs= ets, 0); qemu_co_mutex_lock(&s->table_lock); trace_qed_write_table_cb(s, table, flush, ret); if (ret < 0) { diff --git a/block/qed.c b/block/qed.c index 89af05d524..912edaf56a 100644 --- a/block/qed.c +++ b/block/qed.c @@ -113,15 +113,13 @@ static int coroutine_fn qed_write_header(BDRVQEDState= *s) int nsectors =3D DIV_ROUND_UP(sizeof(QEDHeader), BDRV_SECTOR_SIZE); size_t len =3D nsectors * BDRV_SECTOR_SIZE; uint8_t *buf; - QEMUIOVector qiov; int ret; =20 assert(s->allocating_acb || s->allocating_write_reqs_plugged); =20 buf =3D qemu_blockalign(s->bs, len); - qemu_iovec_init_buf(&qiov, buf, len); =20 - ret =3D bdrv_co_preadv(s->bs->file, 0, qiov.size, &qiov, 0); + ret =3D bdrv_co_pread(s->bs->file, 0, len, buf, 0); if (ret < 0) { goto out; } @@ -129,7 +127,7 @@ static int coroutine_fn qed_write_header(BDRVQEDState *= s) /* Update header */ qed_header_cpu_to_le(&s->header, (QEDHeader *) buf); =20 - ret =3D bdrv_co_pwritev(s->bs->file, 0, qiov.size, &qiov, 0); + ret =3D bdrv_co_pwrite(s->bs->file, 0, len, buf, 0); if (ret < 0) { goto out; } --=20 2.18.0 From nobody Mon Apr 29 15:21:02 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945257; cv=none; d=zoho.com; s=zohoarc; b=m5J2r1JyWe88I0MNaGIoslB5rY/p7Uexe5qkFrcon5CXOoikYo8F2gUiZV48Z3sja0FOi9+vmuS1vnY430zzVnm+kCpqYDbvlC+QufdNyCqboDQ17OjP1nX9dk4jKuchRrAbW95B+mBewLoqRFvT3u3EzNTca8rIFeq2L+0laYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945257; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+N90Rlh0UYD1CxCx7b42eIhWy4rEJy718qhiaTvH4bk=; b=deNoGpJGPyQkTJmjRyz7PHdLWH7i7mz2UPonzLMGegBDRWsoJIZ5ebAYAB7/h8uc0wkyKsrIKI57slXsUlonFYdTLvBV8dIR7SSoZElDRzDpITMjuzJyT/wRlaKs50ebTLiaaI0Pi5WiigQyZH2SxG362zcR/GTK539u/qTokg4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945257354434.70203841683065; Mon, 22 Apr 2019 08:00:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:38440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaQz-00020t-RG for importer@patchew.org; Mon, 22 Apr 2019 11:00:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP5-0000nk-Mo for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-000389-Le for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:43 -0400 Received: from relay.sw.ru ([185.231.240.75]:55298) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036N-Bm; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP1-0003k3-R9; Mon, 22 Apr 2019 17:58:39 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:34 +0300 Message-Id: <20190422145838.70903-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 5/9] block/parallels: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/parallels.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 15bc97b759..2747400577 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -220,20 +220,18 @@ static int64_t allocate_clusters(BlockDriverState *bs= , int64_t sector_num, if (bs->backing) { int64_t nb_cow_sectors =3D to_allocate * s->tracks; int64_t nb_cow_bytes =3D nb_cow_sectors << BDRV_SECTOR_BITS; - QEMUIOVector qiov =3D - QEMU_IOVEC_INIT_BUF(qiov, qemu_blockalign(bs, nb_cow_bytes), - nb_cow_bytes); + void *buf =3D qemu_blockalign(bs, nb_cow_bytes); =20 - ret =3D bdrv_co_preadv(bs->backing, idx * s->tracks * BDRV_SECTOR_= SIZE, - nb_cow_bytes, &qiov, 0); + ret =3D bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_S= IZE, + nb_cow_bytes, buf, 0); if (ret < 0) { - qemu_vfree(qemu_iovec_buf(&qiov)); + qemu_vfree(buf); return ret; } =20 ret =3D bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE, - nb_cow_bytes, &qiov, 0); - qemu_vfree(qemu_iovec_buf(&qiov)); + nb_cow_bytes, buf, 0); + qemu_vfree(buf); if (ret < 0) { return ret; } --=20 2.18.0 From nobody Mon Apr 29 15:21:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945258; cv=none; d=zoho.com; s=zohoarc; b=Br1su7cU4tlzVgdE1crqTy8n4LqPVY3WqRIFR7tFZe1Ov2UKhHdttGqL6GQSIG3DFvasPgeVPTYXA5IrATDVmejWWje7s+3wBBAUoFcMHHc5s6mVOSbdyErPlj44ATIGsnHTv0ksQToaA1AQQl3CS9sHzT2sDwxezLMNo00WEhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945258; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=RO5kJlvbeIheM/lqyAeEmILLq6kEUX/G73kV0DqG6Pc=; b=RD8UWDkAkmUCTUNYmLjtR01H61xcULEwjvGCOctfEzT8Oz+0RxUv4HovyYxaneMK5AkMRaYJeNEV6gZzP0F8oGs6WvguJkcTCF2vxuN8gCAtz390fk7PTs2m2gHF5MOtZ2XsMexoR/Pv6bREs5/TIVEnBBPPaxDg26eY5omvVD0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155594525849571.22789949618027; Mon, 22 Apr 2019 08:00:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:38449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaR5-00024c-87 for importer@patchew.org; Mon, 22 Apr 2019 11:00:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP5-0000no-PE for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00038Y-OL for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:43 -0400 Received: from relay.sw.ru ([185.231.240.75]:55292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036P-DJ; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP1-0003k3-Uv; Mon, 22 Apr 2019 17:58:39 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:35 +0300 Message-Id: <20190422145838.70903-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 6/9] block/backup: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/backup.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/block/backup.c b/block/backup.c index 9988753249..910ed764aa 100644 --- a/block/backup.c +++ b/block/backup.c @@ -107,7 +107,6 @@ static int coroutine_fn backup_cow_with_bounce_buffer(B= ackupBlockJob *job, void **bounce_buffer) { int ret; - QEMUIOVector qiov; BlockBackend *blk =3D job->common.blk; int nbytes; int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; @@ -118,9 +117,8 @@ static int coroutine_fn backup_cow_with_bounce_buffer(B= ackupBlockJob *job, if (!*bounce_buffer) { *bounce_buffer =3D blk_blockalign(blk, job->cluster_size); } - qemu_iovec_init_buf(&qiov, *bounce_buffer, nbytes); =20 - ret =3D blk_co_preadv(blk, start, qiov.size, &qiov, read_flags); + ret =3D blk_co_pread(blk, start, nbytes, *bounce_buffer, read_flags); if (ret < 0) { trace_backup_do_cow_read_fail(job, start, ret); if (error_is_read) { @@ -129,13 +127,13 @@ static int coroutine_fn backup_cow_with_bounce_buffer= (BackupBlockJob *job, goto fail; } =20 - if (qemu_iovec_is_zero(&qiov)) { + if (buffer_is_zero(*bounce_buffer, nbytes)) { ret =3D blk_co_pwrite_zeroes(job->target, start, - qiov.size, write_flags | BDRV_REQ_MAY_U= NMAP); + nbytes, write_flags | BDRV_REQ_MAY_UNMA= P); } else { - ret =3D blk_co_pwritev(job->target, start, - qiov.size, &qiov, write_flags | - (job->compress ? BDRV_REQ_WRITE_COMPRESSED : = 0)); + ret =3D blk_co_pwrite(job->target, start, + nbytes, *bounce_buffer, write_flags | + (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0= )); } if (ret < 0) { trace_backup_do_cow_write_fail(job, start, ret); --=20 2.18.0 From nobody Mon Apr 29 15:21:02 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945617; cv=none; d=zoho.com; s=zohoarc; b=cCvHHrtRnDXhVhJhKe3YAdxsd9hsYaJ/iAiXVVYNHrVbWbm0bbeRSWWWkY+ns7q3oy/F0r1C0BGvjbce4crfRtdVhEK5OhTjv0NYEzBzknvu4ySh3Xr3cWpBJWbtu68CeYMM5wotkVPSoORIc5Hx8v6hMfyTN6Qx4AAY1GEAbus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945617; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4HTrUj0WOPubKm5gOGfer267/YD7Kj/pGATnkM4BOZA=; b=dDR7PYD/slOYjLGpdHVhdJwQoE69sTRoU+hR2h4s+KV+EdBjYU40cvaArxcz4YJ45rSJzJj0+ReDXXjhOgjRUQiqv+mQ8ztvAAieteUuIS3HN17vsMptkd3Rs5QYBlchrLpvBZP7YU9RIlxI00NRHInj+HThcR+tpyXQxAQNkwM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945617515543.517337827718; Mon, 22 Apr 2019 08:06:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:38558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaWo-0007Gk-H7 for importer@patchew.org; Mon, 22 Apr 2019 11:06:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP6-0000ns-Ko for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00038k-ON for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from relay.sw.ru ([185.231.240.75]:55300) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036G-FE; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP2-0003k3-18; Mon, 22 Apr 2019 17:58:40 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:36 +0300 Message-Id: <20190422145838.70903-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 7/9] block/commit: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/commit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/commit.c b/block/commit.c index ba60fef58a..08204fa6f8 100644 --- a/block/commit.c +++ b/block/commit.c @@ -48,16 +48,15 @@ static int coroutine_fn commit_populate(BlockBackend *b= s, BlockBackend *base, void *buf) { int ret =3D 0; - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); =20 assert(bytes < SIZE_MAX); =20 - ret =3D blk_co_preadv(bs, offset, qiov.size, &qiov, 0); + ret =3D blk_co_pread(bs, offset, bytes, buf, 0); if (ret < 0) { return ret; } =20 - ret =3D blk_co_pwritev(base, offset, qiov.size, &qiov, 0); + ret =3D blk_co_pwrite(base, offset, bytes, buf, 0); if (ret < 0) { return ret; } --=20 2.18.0 From nobody Mon Apr 29 15:21:02 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945616; cv=none; d=zoho.com; s=zohoarc; b=QckvMMaHg1F1YtGfaduVzAyldDZLV42Ox9sujcTXiGCzl99z3BR2NpvbPqnuzy6VItSg+sWiBBus86vjJHi3a3zJ7AF+j6nTEu4BKufaoP1Q1F/RHD+hj1kpiZzjro7CIcqFyEGBnn9zEh+5piH/+0MySdf0smG+Bk7OnCnRu5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945616; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hKgYwwe4iooXFuIZIZnR2WbzG7RVjisKdCxtQAdHQAc=; b=kM0DzhHCqIS7yNXVEphaKVerh2kyuhXn0SLR1uI5/eORlgobzX9ZfsTtLQ4UYtkW0/9w5eodys7jTvIf8RoQu56Q1IQwYaQ9G5gR8LDdnCSiwlcHvyRbX4xea2HJb+Z+G5h3JT4pJIgEbyxr3htds82BzLY3txQr/sayno7IVRI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945616035217.15274669303597; Mon, 22 Apr 2019 08:06:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:38556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaWm-0007Fl-MM for importer@patchew.org; Mon, 22 Apr 2019 11:06:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP5-0000nl-Mt for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00038F-M4 for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:43 -0400 Received: from relay.sw.ru ([185.231.240.75]:55288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036K-Bu; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP2-0003k3-7T; Mon, 22 Apr 2019 17:58:40 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:37 +0300 Message-Id: <20190422145838.70903-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 8/9] block/stream: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- block/stream.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/stream.c b/block/stream.c index bfaebb861a..1a906fd860 100644 --- a/block/stream.c +++ b/block/stream.c @@ -42,12 +42,10 @@ static int coroutine_fn stream_populate(BlockBackend *b= lk, int64_t offset, uint64_t bytes, void *buf) { - QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); - assert(bytes < SIZE_MAX); =20 /* Copy-on-read the unallocated clusters */ - return blk_co_preadv(blk, offset, qiov.size, &qiov, BDRV_REQ_COPY_ON_R= EAD); + return blk_co_pread(blk, offset, bytes, buf, BDRV_REQ_COPY_ON_READ); } =20 static void stream_abort(Job *job) --=20 2.18.0 From nobody Mon Apr 29 15:21:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1555945442; cv=none; d=zoho.com; s=zohoarc; b=kXPyidrm1G3Nogo9hSpeHXyHXmyF/0pH1zs9VD+hpF+pgCWAqKKmP8xLMN3Ur2S9Gh6yk9sad4Ha9oagJt+3mejDSxs+HMOmmUAF2fZy1lCYw/KmN/T50WtSp0nncJEeqEl+cN3OCFheTNHWdOuK5S4XEDDjxHAtQamtMamejCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555945442; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=seOMBxgN0UJTPP1bqKRvHGt6BAfGyFXSlqcyKWkjrDU=; b=b6/q/WTXNqKrDJGgUK8OwHl+dnaqDXl/YgKVoAZfNtx4ndbZUzBtH6FAttie5f5xWft9lAtOR8p6KJUykLNzjNFxDzqY7FCRB03SKfGv9yc2gcLSKq1G1BlkGYHxAeFZl4xM9yVoSA0ja9Y2Imr1oFgJWLwnGYOGruYhC1Jbcw8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555945442272674.3289378312112; Mon, 22 Apr 2019 08:04:02 -0700 (PDT) Received: from localhost ([127.0.0.1]:38491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaUA-0004pg-5Z for importer@patchew.org; Mon, 22 Apr 2019 11:03:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIaP6-0000nr-Kq for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIaP4-00038Q-NA for qemu-devel@nongnu.org; Mon, 22 Apr 2019 10:58:44 -0400 Received: from relay.sw.ru ([185.231.240.75]:55286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIaP4-00036H-Ck; Mon, 22 Apr 2019 10:58:42 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hIaP2-0003k3-ED; Mon, 22 Apr 2019 17:58:40 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Apr 2019 17:58:38 +0300 Message-Id: <20190422145838.70903-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190422145838.70903-1-vsementsov@virtuozzo.com> References: <20190422145838.70903-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 9/9] qemu-img: use buffer-based io X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella --- qemu-img.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index aa6f81f1ea..c40a4e8b83 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1671,7 +1671,6 @@ static int coroutine_fn convert_co_read(ImgConvertSta= te *s, int64_t sector_num, int nb_sectors, uint8_t *buf) { int n, ret; - QEMUIOVector qiov; =20 assert(nb_sectors <=3D s->buf_sectors); while (nb_sectors > 0) { @@ -1687,11 +1686,10 @@ static int coroutine_fn convert_co_read(ImgConvertS= tate *s, int64_t sector_num, bs_sectors =3D s->src_sectors[src_cur]; =20 n =3D MIN(nb_sectors, bs_sectors - (sector_num - src_cur_offset)); - qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS); =20 - ret =3D blk_co_preadv( + ret =3D blk_co_pread( blk, (sector_num - src_cur_offset) << BDRV_SECTOR_BITS, - n << BDRV_SECTOR_BITS, &qiov, 0); + n << BDRV_SECTOR_BITS, buf, 0); if (ret < 0) { return ret; } @@ -1710,7 +1708,6 @@ static int coroutine_fn convert_co_write(ImgConvertSt= ate *s, int64_t sector_num, enum ImgConvertBlockStatus status) { int ret; - QEMUIOVector qiov; =20 while (nb_sectors > 0) { int n =3D nb_sectors; @@ -1738,10 +1735,8 @@ static int coroutine_fn convert_co_write(ImgConvertS= tate *s, int64_t sector_num, (s->compressed && !buffer_is_zero(buf, n * BDRV_SECTOR_SIZE))) { - qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS); - - ret =3D blk_co_pwritev(s->target, sector_num << BDRV_SECTO= R_BITS, - n << BDRV_SECTOR_BITS, &qiov, flags); + ret =3D blk_co_pwrite(s->target, sector_num << BDRV_SECTOR= _BITS, + n << BDRV_SECTOR_BITS, buf, flags); if (ret < 0) { return ret; } --=20 2.18.0