Skip to content

Commit

Permalink
create fio plugin for cstor replica (openzfs#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Kryl committed Jun 26, 2018
1 parent 0daccaf commit 06126ac
Show file tree
Hide file tree
Showing 11 changed files with 912 additions and 4 deletions.
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ env:
- ZFS_BUILD_TAGS=0
- ZFS_BUILD_TAGS=1
before_install:
# sudo apt-get -qq update
# sudo apt-get -qq update
- sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r) libaio-dev
- sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev
- sudo apt-get install --yes -qq lcov libjemalloc-dev
# packages for tests
# packages for tests
- sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio
- sudo apt-get install --yes -qq libgtest-dev cmake
install:
Expand All @@ -25,6 +25,12 @@ install:
- sudo cp *.a /usr/lib
- popd
- cd ..
# we need fio repo to build zfs replica fio engine
- git clone https://github.com/axboe/fio
- cd fio
- ./configure
- make
- cd ..
- git clone https://github.com/openebs/spl
- cd spl
- git checkout spl-0.7.4
Expand All @@ -39,7 +45,7 @@ install:
- cd ../zfs
- sh autogen.sh
- if [ $ZFS_BUILD_TAGS = 0 ]; then
./configure --enable-code-coverage=yes --enable-debug --enable-uzfs=yes --with-jemalloc || travis_terminate 1;
./configure --enable-code-coverage=yes --enable-debug --enable-uzfs=yes --with-jemalloc --with-fio=$PWD/../fio || travis_terminate 1;
make;
else
./configure --enable-code-coverage=yes --enable-debug || travis_terminate 1;
Expand All @@ -52,6 +58,7 @@ script:
# run ztest and test supported zio backends
- if [ $ZFS_BUILD_TAGS = 0 ]; then
sudo mkdir /etc/zfs;
export FIO_SRCDIR=$PWD/../fio;
travis_wait 60 sudo bash ./tests/cbtest/script/test_uzfs.sh || travis_terminate 1;
else
sudo /sbin/modprobe zfs;
Expand Down
11 changes: 11 additions & 0 deletions config/user-fio.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AC_DEFUN([ZFS_AC_CONFIG_USER_FIO], [
AC_ARG_WITH(fio,
[AC_HELP_STRING([--with-fio=dir],
[build with FIO engine for replica protocol])],
[AC_CHECK_FILE($withval/fio.h,
[FIO_SRCDIR=$withval],
[AC_MSG_FAILURE([Not a valid fio repository])])])
])

AC_SUBST([FIO_SRCDIR])
])
1 change: 1 addition & 0 deletions config/user.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_NO_FORMAT_TRUNCATION
ZFS_AC_CONFIG_USER_LIBAIO
ZFS_AC_CONFIG_USER_JEMALLOC
ZFS_AC_CONFIG_USER_FIO
ZFS_AC_TEST_FRAMEWORK
Expand Down
1 change: 1 addition & 0 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ AC_DEFUN([ZFS_AC_CONFIG], [
[test "x$qatsrc" != x ])
AM_CONDITIONAL([WANT_DEVNAME2DEVID], [test "x$user_libudev" = xyes ])
AM_CONDITIONAL([WANT_MMAP_LIBAIO], [test "x$user_libaio" = xyes ])
AM_CONDITIONAL([CONFIG_FIO], [test x$FIO_SRCDIR != x ])
])

dnl #
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ AC_CONFIG_FILES([
lib/libzfs/Makefile
lib/libzfs_core/Makefile
lib/libshare/Makefile
lib/fio/Makefile
cmd/Makefile
cmd/uzfs_test/Makefile
cmd/zdb/Makefile
Expand Down
4 changes: 4 additions & 0 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ SUBDIRS = libspl libavl libefi libshare libunicode libicp
# These four libraries, which are installed as the final build product,
# incorporate the six convenience libraries given above.
SUBDIRS += libuutil libnvpair libzpool libzfs_core libzfs

if CONFIG_FIO
SUBDIRS += fio
endif
12 changes: 12 additions & 0 deletions lib/fio/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include $(top_srcdir)/config/Rules.am

DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(FIO_SRCDIR)

lib_LTLIBRARIES = replica.la

replica_la_SOURCES = replica.c
replica_la_LDFLAGS = -module
# required for fio external plugins on linux
replica_la_CFLAGS = -D_GNU_SOURCE -DCONFIG_STRSEP
31 changes: 31 additions & 0 deletions lib/fio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

This is a fio engine for zfs replica using replica network protocol to
configure data connections and issue IOs over them.

# Build

Use `--with-fio=DIR` in addition to `--enable-uzfs` configure option to
enable building it. `DIR` is a path to fio repository with fio include
files.

# Run

We assume that fio command is executed from the fio's repository directory.
In following command change path to zfs repository as appropriate:

```bash
LD_LIBRARY_PATH=/repos/zfs/lib/fio/.libs ./fio replica.fio
```

fio should get stuck and print a message `waiting for connection from replica`.
In another window start zfs replica and instruct it to connect to "fio
target" which is listening on loopback interface:

```bash
sudo /repos/zfs/cmd/zrepl/zrepl 127.0.0.1
```

At most after 5 secs `zrepl` will connect to fio and IO will start flowing.
`address` and `port` replica fio engine configuration options can be used
to avoid the listening phase and create data connection directly from fio
engine to zfs replica.
Loading

0 comments on commit 06126ac

Please sign in to comment.