Received: from eggs.gnu.org ([2001:4830:134:3::10]:48272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1Ey3-0008UE-Lv for qemu-devel@nongnu.org; Fri, 13 May 2016 11:25:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1Ey1-0007HF-9m for qemu-devel@nongnu.org; Fri, 13 May 2016 11:25:30 -0400 References: <1462354765-14037-1-git-send-email-kwolf@redhat.com> <1462354765-14037-13-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <8ede3bf0-a1a8-5ea8-c1cd-9bce3ac3f4fd@redhat.com> Date: Fri, 13 May 2016 17:25:15 +0200 MIME-Version: 1.0 In-Reply-To: <1462354765-14037-13-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aUf6h5vgi1Unr4aLgE15245rFIUixWLm4" Subject: Re: [Qemu-devel] [PATCH 12/14] backup: Use BlockBackend for I/O List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: jcody@redhat.com, jsnow@redhat.com, berto@igalia.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aUf6h5vgi1Unr4aLgE15245rFIUixWLm4 From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: jcody@redhat.com, jsnow@redhat.com, berto@igalia.com, qemu-devel@nongnu.org Message-ID: <8ede3bf0-a1a8-5ea8-c1cd-9bce3ac3f4fd@redhat.com> Subject: Re: [PATCH 12/14] backup: Use BlockBackend for I/O References: <1462354765-14037-1-git-send-email-kwolf@redhat.com> <1462354765-14037-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1462354765-14037-13-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 04.05.2016 11:39, Kevin Wolf wrote: > This changes the backup block job to use the job's BlockBackend for > performing its I/O. job->bs isn't used by the backup code any more > afterwards. >=20 > Signed-off-by: Kevin Wolf > --- > block/backup.c | 42 ++++++++++++++++++++++------------= -------- > block/block-backend.c | 14 ++++++++++++++ > block/io.c | 9 --------- > blockdev.c | 4 +--- > include/block/block.h | 2 -- > include/sysemu/block-backend.h | 2 ++ > trace-events | 2 +- > 7 files changed, 40 insertions(+), 35 deletions(-) >=20 > diff --git a/block/backup.c b/block/backup.c > index 670ba50..ba9eb42 100644 > --- a/block/backup.c > +++ b/block/backup.c [...] > @@ -548,9 +547,11 @@ void backup_start(BlockDriverState *bs, BlockDrive= rState *target, > goto error; > } > =20 > + job->target =3D blk_new(&error_abort); *cough* > + blk_insert_bs(job->target, target); > + > job->on_source_error =3D on_source_error; > job->on_target_error =3D on_target_error; > - job->target =3D target; > job->sync_mode =3D sync_mode; > job->sync_bitmap =3D sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL= ? > sync_bitmap : NULL; [...] > diff --git a/block/block-backend.c b/block/block-backend.c > index 8dc3aa5..2b3c55f 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -807,6 +807,20 @@ int coroutine_fn blk_co_readv(BlockBackend *blk, i= nt64_t sector_num, > nb_sectors << BDRV_SECTOR_BITS, qiov, 0); > } > =20 > +int coroutine_fn blk_co_readv_no_serialising(BlockBackend *blk, > + int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) > +{ > + trace_blk_co_readv_no_serialising(blk, blk_bs(blk), sector_num, nb= _sectors); > + > + if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { > + return -EINVAL; > + } > + > + return blk_co_preadv(blk, sector_num << BDRV_SECTOR_BITS, > + nb_sectors << BDRV_SECTOR_BITS, qiov, > + BDRV_REQ_NO_SERIALISING); > +} > + Same concern as in the other places whether we really want this to have a sector-based interface... > int coroutine_fn blk_co_copy_on_readv(BlockBackend *blk, > int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) > { [...] > diff --git a/blockdev.c b/blockdev.c > index 7a0196f..fa381ce 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -3268,8 +3268,8 @@ static void do_drive_backup(const char *device, c= onst char *target, > backup_start(bs, target_bs, speed, sync, bmap, > on_source_error, on_target_error, > block_job_cb, bs, txn, &local_err); > + bdrv_unref(target_bs); Alternatively you could pull it down under the "out" label and then remove another bdrv_unref(target_bs) instance in this function. Max > if (local_err !=3D NULL) { > - bdrv_unref(target_bs); > error_propagate(errp, local_err); > goto out; > } --aUf6h5vgi1Unr4aLgE15245rFIUixWLm4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXNfHbAAoJEDuxQgLoOKytuK0H/3Bvc+hqSKRrL9FsAo+3BQvK A6LPZtzjNEIUMYIdjQsmWTTuHDoZJyHVDMoHL5+Ko/Mr5Dv3esrLIPaHbSWnpSh7 evyr9p3L9rpoWi3bA0tSXMzwijVGkygG6fyNgk6+MIlfCjfRaQBJ3QsekVmptO7I 1okqi8QCJMR+4ya8JHnRrQYb/mYWyRtd938GWH/qoqOrNlF8sI5LL/bXgMAx7oSz MtvcgkM2cBZmM1iI2JLB7S4qxwW+PPzQiqYuaWIoXReokfMOYry0bZaKTgNejuK+ SSP770/vU8DXgSKuOHoAUXUC95+n+UCvDCjbrhc9rqE6EjC3+jKb6Acow2GfWfA= =sM2j -----END PGP SIGNATURE----- --aUf6h5vgi1Unr4aLgE15245rFIUixWLm4--