Received: from eggs.gnu.org ([2001:4830:134:3::10]:57710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXYNm-0004hs-Dv for qemu-devel@nongnu.org; Wed, 10 Aug 2016 14:37:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXYNk-00007S-9m for qemu-devel@nongnu.org; Wed, 10 Aug 2016 14:37:37 -0400 References: <1470679640-18366-1-git-send-email-clord@redhat.com> <1470679640-18366-4-git-send-email-clord@redhat.com> From: Max Reitz Message-ID: <62914d01-ac55-efba-2b2d-866cb833c823@redhat.com> Date: Wed, 10 Aug 2016 20:37:26 +0200 MIME-Version: 1.0 In-Reply-To: <1470679640-18366-4-git-send-email-clord@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="38WJcdavs2lIetVv3jfcK2IQl9mlTIAtF" Subject: Re: [Qemu-devel] [PATCH v7 3/4] blockdev: Add dynamic module loading for block drivers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Marc Mari This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --38WJcdavs2lIetVv3jfcK2IQl9mlTIAtF From: Max Reitz To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Marc Mari Message-ID: <62914d01-ac55-efba-2b2d-866cb833c823@redhat.com> Subject: Re: [PATCH v7 3/4] blockdev: Add dynamic module loading for block drivers References: <1470679640-18366-1-git-send-email-clord@redhat.com> <1470679640-18366-4-git-send-email-clord@redhat.com> In-Reply-To: <1470679640-18366-4-git-send-email-clord@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08.08.2016 20:07, Colin Lord wrote: > From: Marc Mari >=20 > Extend the current module interface to allow for block drivers to be > loaded dynamically on request. The only block drivers that can be > converted into modules are the drivers that don't perform any init > operation except for registering themselves. >=20 > In addition, only the protocol drivers are being modularized, as they > are the only ones which see significant performance benefits. The forma= t > drivers do not generally link to external libraries, so modularizing > them is of no benefit from a performance perspective. >=20 > All the necessary module information is located in a new structure foun= d > in module_block.h >=20 > Signed-off-by: Marc Mar=C3=AD > Signed-off-by: Colin Lord > Reviewed-by: Stefan Hajnoczi > --- > Makefile | 3 --- > block.c | 62 +++++++++++++++++++++++++++++++++++++++++++= ++------ > block/Makefile.objs | 3 +-- > include/qemu/module.h | 3 +++ > util/module.c | 38 +++++++++---------------------- > 5 files changed, 70 insertions(+), 39 deletions(-) >=20 [...] > diff --git a/block.c b/block.c > index 30d64e6..6c5e249 100644 > --- a/block.c > +++ b/block.c > @@ -26,6 +26,7 @@ > #include "block/block_int.h" > #include "block/blockjob.h" > #include "qemu/error-report.h" > +#include "module_block.h" > #include "qemu/module.h" > #include "qapi/qmp/qerror.h" > #include "qapi/qmp/qbool.h" > @@ -241,17 +242,40 @@ BlockDriverState *bdrv_new(void) > return bs; > } > =20 > -BlockDriver *bdrv_find_format(const char *format_name) > +static BlockDriver *bdrv_do_find_format(const char *format_name) > { > BlockDriver *drv1; > + > QLIST_FOREACH(drv1, &bdrv_drivers, list) { > if (!strcmp(drv1->format_name, format_name)) { > return drv1; > } > } > + > return NULL; > } > =20 > +BlockDriver *bdrv_find_format(const char *format_name) > +{ > + BlockDriver *drv1; > + size_t i; > + > + drv1 =3D bdrv_do_find_format(format_name); > + if (drv1) { > + return drv1; > + } > + > + /* The driver isn't registered, maybe we need to load a module */ > + for (i =3D 0; i < ARRAY_SIZE(block_driver_modules); ++i) { > + if (!strcmp(block_driver_modules[i].format_name, format_name))= { > + block_module_load_one(block_driver_modules[i].library_name= ); > + break; > + } > + } > + > + return bdrv_do_find_format(format_name); > +} > + Did you reintroduce this function for dmg? I thought Fam is taking care of that? I'm confused as to how Fam's patch for dmg and this series are supposed to interact; the fact that the script added in patch 2 breaks down with Fam's patch isn't exactly helping... Hm, so is this series now supposed to be applied without Fam's patch with the idea of sorting dmg out later on? Max > static int bdrv_is_whitelisted(BlockDriver *drv, bool read_only) > { > static const char *whitelist_rw[] =3D { --38WJcdavs2lIetVv3jfcK2IQl9mlTIAtF 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 iQEvBAEBCAAZBQJXq3RmEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrTw4 B/9jRuaV0md8x1y0cpEf2ZO51Mwtz9GEoLDCFHPXramJbS4xp6V5i9RRchD+aVpI HoN9Firw4I8s/Unbmzbo8N12jIur5cQuAgAwAXhwmXTzlqX1ZQDaPVVvdCfrS8Xh BOlmPT7isl9xQ5iAWaLV5NBRZqHKAQCzoZYmIGew41FMVXdJnvBrdMgS8fOsqnnY 3/Dc3XBayF1mKJpIhmMp2IKg5q6xoyjnaanACNFOV8t4sK72aBPS1VEguelzlcWN +mZlB3gr8KWsrBqoS2KCsFQlN/qsgQwijEXVEBmZS70SZQ9VH9hbkuhMBcUe5AxZ KT0tuWVHMpI2GdJEtaHEVYzA =DIbG -----END PGP SIGNATURE----- --38WJcdavs2lIetVv3jfcK2IQl9mlTIAtF--