diff mbox

[v7,4/4] blockdev: Modularize nfs block driver

Message ID 1470679640-18366-5-git-send-email-clord@redhat.com
State New
Headers show

Commit Message

clord@redhat.com Aug. 8, 2016, 6:07 p.m. UTC
Modularizes the nfs block driver so that it gets dynamically loaded.

Signed-off-by: Colin Lord <clord@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/Makefile.objs | 1 +
 configure           | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Max Reitz Aug. 10, 2016, 7:04 p.m. UTC | #1
On 08.08.2016 20:07, Colin Lord wrote:
> Modularizes the nfs block driver so that it gets dynamically loaded.
> 
> Signed-off-by: Colin Lord <clord@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  block/Makefile.objs | 1 +
>  configure           | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)

I'm not quite sure what this achieves. From what I can see, the NFS
block driver is still linked hard into qemu and it is unconditionally
registered at qemu startup.

(The output from a printf() in nfs_block_init() is visible even when
just starting qemu-img or qemu-io without any arguments; most notably
without bdrv_find_protocol() having been invoked at all.)

Max
clord@redhat.com Aug. 10, 2016, 7:22 p.m. UTC | #2
On 08/10/2016 03:04 PM, Max Reitz wrote:
> On 08.08.2016 20:07, Colin Lord wrote:
>> Modularizes the nfs block driver so that it gets dynamically loaded.
>>
>> Signed-off-by: Colin Lord <clord@redhat.com>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> ---
>>  block/Makefile.objs | 1 +
>>  configure           | 4 ++--
>>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> I'm not quite sure what this achieves. From what I can see, the NFS
> block driver is still linked hard into qemu and it is unconditionally
> registered at qemu startup.
> 
ldd seems to be telling me that libnfs is not linked to the main binary
after this patch.
> (The output from a printf() in nfs_block_init() is visible even when
> just starting qemu-img or qemu-io without any arguments; most notably
> without bdrv_find_protocol() having been invoked at all.)
> 
> Max
> 
I can't seem to reproduce this. Is it possible you applied this patch
without applying the first 3 before it? Or maybe didn't have modules
enabled in the configuration? As far as I can tell NFS seems to building
as a module and doesn't seem to be hard linked, so I'm not really sure
what's going on.

Colin
Max Reitz Aug. 12, 2016, 12:31 p.m. UTC | #3
On 10.08.2016 21:22, Colin Lord wrote:
> On 08/10/2016 03:04 PM, Max Reitz wrote:
>> On 08.08.2016 20:07, Colin Lord wrote:
>>> Modularizes the nfs block driver so that it gets dynamically loaded.
>>>
>>> Signed-off-by: Colin Lord <clord@redhat.com>
>>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>>> ---
>>>  block/Makefile.objs | 1 +
>>>  configure           | 4 ++--
>>>  2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> I'm not quite sure what this achieves. From what I can see, the NFS
>> block driver is still linked hard into qemu and it is unconditionally
>> registered at qemu startup.
>>
> ldd seems to be telling me that libnfs is not linked to the main binary
> after this patch.
>> (The output from a printf() in nfs_block_init() is visible even when
>> just starting qemu-img or qemu-io without any arguments; most notably
>> without bdrv_find_protocol() having been invoked at all.)
>>
>> Max
>>
> I can't seem to reproduce this. Is it possible you applied this patch
> without applying the first 3 before it? Or maybe didn't have modules
> enabled in the configuration?

I'm so stupid. Yep, that's it. Works great now. :D

Reviewed-by: Max Reitz <mreitz@redhat.com>

>                               As far as I can tell NFS seems to building
> as a module and doesn't seem to be hard linked, so I'm not really sure
> what's going on.
> 
> Colin
>
diff mbox

Patch

diff --git a/block/Makefile.objs b/block/Makefile.objs
index 595f366..fa4d8b8 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -28,6 +28,7 @@  block-obj-y += crypto.o
 common-obj-y += stream.o
 common-obj-y += backup.o
 
+nfs.o-libs         := $(LIBNFS_LIBS)
 iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
 iscsi.o-libs       := $(LIBISCSI_LIBS)
 curl.o-cflags      := $(CURL_CFLAGS)
diff --git a/configure b/configure
index f57fcc6..f1e7d14 100755
--- a/configure
+++ b/configure
@@ -4561,7 +4561,6 @@  if test "$libnfs" != "no" ; then
   if $pkg_config --atleast-version=1.9.3 libnfs; then
     libnfs="yes"
     libnfs_libs=$($pkg_config --libs libnfs)
-    LIBS="$LIBS $libnfs_libs"
   else
     if test "$libnfs" = "yes" ; then
       feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
@@ -5320,7 +5319,8 @@  if test "$libiscsi" = "yes" ; then
 fi
 
 if test "$libnfs" = "yes" ; then
-  echo "CONFIG_LIBNFS=y" >> $config_host_mak
+  echo "CONFIG_LIBNFS=m" >> $config_host_mak
+  echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
 fi
 
 if test "$seccomp" = "yes"; then