[ENBD] nbd with an SMP kernel?

Peter T. Breuer ptb@it.uc3m.es
Sat, 14 Oct 2000 01:28:32 +0200 (MET DST)


"A month of sundays ago leonid@hmdc-admin.fas.harvard.edu wrote:"
> Here's the compile line that I used (it's a combination of the module
> compile line from the redhat 'make modules' and the compile line from the
> nbd distribution): 
> 
> gcc -D__KERNEL__ -D_LARGEFILE64_SOURCE

That's standard. You can get rid of (my?) _LARGEFILE64_SOURCE addition.
It's only effective in userspace.

> -I/usr/local/src/nbd-2.4.14/linux/include -I/usr/src/linux-2.2.16/include

The second -I should be unnecessary if you have a link from
/usr/src/linux to linux-2.2.16, and you have the "linux" link fron
/usr/include/linux to /usr/src/linux/include/linux.  These are standard
(also the "asm" link).

> -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing

You can forget about all those except -O2, which you must have.

> -D__SMP__ -pipe -fno-strength-reduce -m486 -malign-loops=2 -malign-jumps=2

Forget about all those except -D__SMP__. 

> -malign-functions=2 -DCPU=686 -DMODULE -DDEBUG=0 -DMODVERSIONS -include

All forgettable except -DMODULE and -DMODVERSIONS. The latter is a
pain. I haven't seen the point of modversions for years now - either
the kernel interfaces are in the stable series and they don't change
and hence you can use modules with or without modversions, or the
kernel interfaces are in the development series and they change daily
and you can't use modversions anyway.

> /usr/src/linux-2.2.16/include/linux/modversions.h   -c -o nbd.o

I think that .h should have been included by the modules.h file.
Errr, well, sort of. the file seems to inclide modversions.h if
MODVERSIONS is _not_ defined. Including it forcibly when it is
defined seems strange! I can't make out the intention here.

> /usr/local/src/nbd-2.4.14/linux/drivers/block/nbd.c

> the following must be done before you can use the kernel source to compile
> an SMP module: 
> 
> cd /usr/src/linux
> cp /usr/src/redhat/SOURCES/kernel-2.2.16-i686-smp.config .config

Well, at least you have to config the kernel for smp!  The normal way of
doing this is to type "make menuconfig" or some such.  Editing .config
to set SMP and then running make oldconfig would be enough, I think.
You think so too ...

> make oldconfig
> make dep
> 
> This configures everything and sets dependencies correctly. Now the module

I don't think you had to worry about dependencies! (you didn't change
any files).

> I guess the above would take a sane person 15 or so minutes to figure out,
> but I've apparently been kinda brain-dead in the last couple of days. 

:-)

> The nbd block device I'm testing seems to be working like a charm
> now; I've even used successfully the /dev/nda1 as part of a raid1 mirror,
> though there're still some issues I have to figure out. 

Try "killall -USR1 nbd-client" when you lose the heartbeat.

Thanks!

Peter