From nobody Fri Oct 24 22:17:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.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 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519841713041501.2608131929228; Wed, 28 Feb 2018 10:15:13 -0800 (PST) Received: from localhost ([::1]:46005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er6Fv-0003qm-2Q for importer@patchew.org; Wed, 28 Feb 2018 13:15:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er66z-0004Sb-MA for qemu-devel@nongnu.org; Wed, 28 Feb 2018 13:05:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er66y-0004JF-GM for qemu-devel@nongnu.org; Wed, 28 Feb 2018 13:05:53 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43292 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1er66t-0004GE-0O; Wed, 28 Feb 2018 13:05:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99F0387ABA; Wed, 28 Feb 2018 18:05:46 +0000 (UTC) Received: from localhost (unknown [10.40.205.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2F86946C1; Wed, 28 Feb 2018 18:05:39 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 28 Feb 2018 19:04:59 +0100 Message-Id: <20180228180507.3964-9-mreitz@redhat.com> In-Reply-To: <20180228180507.3964-1-mreitz@redhat.com> References: <20180228180507.3964-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 28 Feb 2018 18:05:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 28 Feb 2018 18:05:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mreitz@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v3 08/16] block/mirror: Use source as a BdrvChild 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: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With this, the mirror_top_bs is no longer just a technically required node in the BDS graph but actually represents the block job operation. Also, drop MirrorBlockJob.source, as we can reach it through mirror_top_bs->backing. Signed-off-by: Max Reitz --- block/mirror.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index d65fab3b45..addfdff4dd 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -43,7 +43,6 @@ typedef struct MirrorBlockJob { RateLimit limit; BlockBackend *target; BlockDriverState *mirror_top_bs; - BlockDriverState *source; BlockDriverState *base; =20 /* The name of the graph node to replace */ @@ -301,7 +300,6 @@ static void coroutine_fn mirror_co_read(void *opaque) { MirrorOp *op =3D opaque; MirrorBlockJob *s =3D op->s; - BlockBackend *source =3D s->common.blk; int nb_chunks; uint64_t ret; uint64_t max_bytes; @@ -351,7 +349,8 @@ static void coroutine_fn mirror_co_read(void *opaque) s->bytes_in_flight +=3D op->bytes; trace_mirror_one_iteration(s, op->offset, op->bytes); =20 - ret =3D blk_co_preadv(source, op->offset, op->bytes, &op->qiov, 0); + ret =3D bdrv_co_preadv(s->mirror_top_bs->backing, op->offset, op->byte= s, + &op->qiov, 0); mirror_read_complete(op, ret); } =20 @@ -429,7 +428,7 @@ static unsigned mirror_perform(MirrorBlockJob *s, int64= _t offset, =20 static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) { - BlockDriverState *source =3D s->source; + BlockDriverState *source =3D s->mirror_top_bs->backing->bs; MirrorOp *pseudo_op; int64_t offset; uint64_t delay_ns =3D 0, ret =3D 0; @@ -604,7 +603,7 @@ static void mirror_exit(BlockJob *job, void *opaque) MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common); MirrorExitData *data =3D opaque; AioContext *replace_aio_context =3D NULL; - BlockDriverState *src =3D s->source; + BlockDriverState *src =3D s->mirror_top_bs->backing->bs; BlockDriverState *target_bs =3D blk_bs(s->target); BlockDriverState *mirror_top_bs =3D s->mirror_top_bs; Error *local_err =3D NULL; @@ -719,7 +718,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJo= b *s) { int64_t offset; BlockDriverState *base =3D s->base; - BlockDriverState *bs =3D s->source; + BlockDriverState *bs =3D s->mirror_top_bs->backing->bs; BlockDriverState *target_bs =3D blk_bs(s->target); int ret; int64_t count; @@ -801,7 +800,7 @@ static void coroutine_fn mirror_run(void *opaque) { MirrorBlockJob *s =3D opaque; MirrorExitData *data; - BlockDriverState *bs =3D s->source; + BlockDriverState *bs =3D s->mirror_top_bs->backing->bs; BlockDriverState *target_bs =3D blk_bs(s->target); bool need_drain =3D true; int64_t length; @@ -1288,7 +1287,6 @@ static void mirror_start_job(const char *job_id, Bloc= kDriverState *bs, /* The block job now has a reference to this node */ bdrv_unref(mirror_top_bs); =20 - s->source =3D bs; s->mirror_top_bs =3D mirror_top_bs; =20 /* No resize for the target either; while the mirror is still running,= a --=20 2.14.3