Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
engines: Add Network Block Device (NBD) support using libnbd.
This commit adds a new engine for testing Network Block Devices
directly.  It requires libnbd (https://github.com/libguestfs/libnbd).

To see how to test nbdkit or qemu-nbd read examples/nbd.fio.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
rwmjones authored and axboe committed Aug 2, 2019
1 parent 66b182f commit d643a1e
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 0 deletions.
2 changes: 2 additions & 0 deletions HOWTO
Expand Up @@ -1998,6 +1998,8 @@ I/O engine
requests for IME. FIO will then decide when to commit these requests.
**libiscsi**
Read and write iscsi lun with libiscsi.
**nbd**
Synchronous read and write a Network Block Device (NBD).

I/O engine specific parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Expand Up @@ -65,6 +65,12 @@ ifdef CONFIG_LIBISCSI
SOURCE += engines/libiscsi.c
endif

ifdef CONFIG_LIBNBD
CFLAGS += $(LIBNBD_CFLAGS)
LIBS += $(LIBNBD_LIBS)
SOURCE += engines/nbd.c
endif

ifdef CONFIG_64BIT
CFLAGS += -DBITS_PER_LONG=64
endif
Expand Down
27 changes: 27 additions & 0 deletions configure
Expand Up @@ -149,6 +149,7 @@ disable_pmem="no"
disable_native="no"
march_set="no"
libiscsi="no"
libnbd="no"
prefix=/usr/local

# parse options
Expand Down Expand Up @@ -207,6 +208,8 @@ for opt do
;;
--enable-libiscsi) libiscsi="yes"
;;
--enable-libnbd) libnbd="yes"
;;
--disable-tcmalloc) disable_tcmalloc="yes"
;;
--help)
Expand Down Expand Up @@ -245,6 +248,7 @@ if test "$show_help" = "yes" ; then
echo "--disable-native Don't build for native host"
echo "--with-ime= Install path for DDN's Infinite Memory Engine"
echo "--enable-libiscsi Enable iscsi support"
echo "--enable-libnbd Enable libnbd (NBD engine) support"
echo "--disable-tcmalloc Disable tcmalloc support"
exit $exit_val
fi
Expand Down Expand Up @@ -2014,6 +2018,23 @@ if test "$libiscsi" = "yes" ; then
fi
print_config "iscsi engine" "$libiscsi"

##########################################
# Check if we have libnbd (for NBD support).
minimum_libnbd=0.9.6
if test "$libnbd" = "yes" ; then
if $(pkg-config --atleast-version=$minimum_libnbd libnbd); then
libnbd="yes"
libnbd_cflags=$(pkg-config --cflags libnbd)
libnbd_libs=$(pkg-config --libs libnbd)
else
if test "$libnbd" = "yes" ; then
echo "libnbd" "Install libnbd >= $minimum_libnbd"
fi
libnbd="no"
fi
fi
print_config "NBD engine" "$libnbd"

##########################################
# Check if we have lex/yacc available
yacc="no"
Expand Down Expand Up @@ -2698,6 +2719,12 @@ if test "$libiscsi" = "yes" ; then
echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
fi
if test "$libnbd" = "yes" ; then
output_sym "CONFIG_LIBNBD"
echo "CONFIG_LIBNBD=m" >> $config_host_mak
echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak
echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak
fi
cat > $TMPC << EOF
int main(int argc, char **argv)
{
Expand Down

0 comments on commit d643a1e

Please sign in to comment.