From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNklZ-0005Xt-Ns for qemu-devel@nongnu.org; Tue, 17 Feb 2015 11:12:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNklU-0003LD-6s for qemu-devel@nongnu.org; Tue, 17 Feb 2015 11:12:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNklT-0003L9-Vd for qemu-devel@nongnu.org; Tue, 17 Feb 2015 11:12:48 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1HGCkRp004758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 11:12:47 -0500 Message-ID: <54E3687D.3050309@redhat.com> Date: Tue, 17 Feb 2015 09:12:45 -0700 From: Eric Blake MIME-Version: 1.0 References: <1424183959-16897-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1424183959-16897-1-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jLVaLhSN7tQ3MHeW7ajsB92DPtLwHm74m" Subject: Re: [Qemu-devel] [PATCH v2] block: move I/O request processing to block/io.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jLVaLhSN7tQ3MHeW7ajsB92DPtLwHm74m Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/17/2015 07:39 AM, Stefan Hajnoczi wrote: > The block.c file has grown to over 6000 lines. It is time to split thi= s > file so there are fewer conflicts and the code is easier to maintain. >=20 > Extract I/O request processing code: > * Read > * Write > * Zero writes and making the image empty > * Flush > * Discard > * ioctl > * Tracked requests and queuing > * Throttling and copy-on-read > * Block status and allocated functions > * Refreshing block limits > * Reading/writing vmstate > * qemu_blockalign() and friends >=20 > The patch simply moves code from block.c into block/io.c. >=20 > No code changes are made except adding the following block_int.h > functions so they can be called across block.c and block/io.c: > bdrv_set_dirty(), bdrv_reset_dirty(). I spotted a couple of other changes that you may not have intended (or if you did, you should also call them out here). >=20 > I/O request processing needs to set up BlockDriver coroutine and AIO > emulation function pointers, so add bdrv_setup_io_funcs(bdrv) interface= > that block.c calls. >=20 > Signed-off-by: Stefan Hajnoczi > --- > This patch is based on the last block pull request from Fri 13th Februa= ry 2015. > This is necessary since the patch is prone to conflicts in block.c - we= need to > use the latest code! >=20 > If anyone wants to move more stuff, please consider sending follow-up p= atches > instead because it is painful to rebase this. >=20 > v2: > * Move bdrv_drain_all() [Kevin] > * Move bdrv_make_zero() [Kevin] > * Move bdrv_flush_all() [Kevin] > * Move bdrv_is_allocated/get_block_status family of functions [Kevin] > * Move bdrv_refresh_limits() [Kevin] > * Move load/save_vmstate() [Kevin] > * Move qemu_blockalign() and friends [Kevin] > -void bdrv_drain_all(void) > -{ > - /* Always run first iteration so any pending completion BHs run */= > - bool busy =3D true; > - BlockDriverState *bs; > - > - while (busy) { > - busy =3D false; > - > - QTAILQ_FOREACH(bs, &bdrv_states, device_list) { > - AioContext *aio_context =3D bdrv_get_aio_context(bs); > - > +void bdrv_drain_all(void) > +{ > + /* Always run first iteration so any pending completion BHs run */= > + bool busy =3D true; > + BlockDriverState *bs =3D NULL; > + > + while (busy) { > + busy =3D false; > + > + while ((bs =3D bdrv_next(bs))) { > + AioContext *aio_context =3D bdrv_get_aio_context(bs); > + You switched iteration from QTAILQ_FOREACH to a while(bdrv_next()) loop, here, and in bdrv_flush_all. I think the change is safe, but it would be smarter to split it into a separate patch and/or document it in the commit message as intentional. But I also agree that we want this patch in sooner rather than later to minimize conflict churn. So: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --jLVaLhSN7tQ3MHeW7ajsB92DPtLwHm74m Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJU42h9AAoJEKeha0olJ0Nq4UUH/2Ws17ZlKJuVNdlCtPUY126n ywAUwrHgWTntthC8BH0DcjNqZZj5+ADhyZXuhV03F3Fy9KWzAvmSI33kbj+Cxhkf 6ZTKsRXqbT3rvceanXrdRuji/k23cFDtOtGkyZWRRnI8G2c8Vs7/O8zphLOV+x91 U8AS1rsEXos5OWpE5SIiMNRJzrf5aSSMD6TIHxljMsPIrfH50KMSYUZE1WPFPEFf V2upBeYewgqmxMPPJQ7JKNqKiBdWis0n9U8oZI7EEMc/Nzyt2SKYefz+Tltf3aAv W9AY+CnOE+UNV1+Pm6ZpJ3GX8uHNY5m5AqlWLfi3ZE70e1vADGsVyK/PeYy9anM= =IbRJ -----END PGP SIGNATURE----- --jLVaLhSN7tQ3MHeW7ajsB92DPtLwHm74m--