Skip to content

Commit

Permalink
crct10: use isa-l for crc if available
Browse files Browse the repository at this point in the history
isa-l provides fast implementation for various polynomials
This will be only used for end to end data protection, and has
a significant impact on performance.

See: https://github.com/intel/isa-l

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
  • Loading branch information
ankit-sam committed Oct 31, 2023
1 parent 7a725c7 commit e4cb3e3
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions HOWTO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,10 @@ with the caveat that when used on the command line, they must come after the
If this is set to 0, fio generates protection information for
write case and verifies for read case. Default: 1.

For 16 bit CRC generation fio will use isa-l if available otherwise
it will use the default slower generator.
(see: https://github.com/intel/isa-l)

.. option:: pi_chk=str[,str][,str] : [io_uring_cmd]

Controls the protection information check. This can take one or more
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ endif
ifndef CONFIG_HAVE_STATX
SOURCE += oslib/statx.c
endif
ifdef CONFIG_LIBISAL
LIBS += $(LIBISAL_LIBS)
FIO_CFLAGS += $(LIBISAL_CFLAGS)
endif
ifdef CONFIG_GFAPI
SOURCE += engines/glusterfs.c
SOURCE += engines/glusterfs_sync.c
Expand Down
22 changes: 22 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ libiscsi="no"
libnbd="no"
libnfs=""
xnvme=""
isal=""
libblkio=""
libzbc=""
dfs=""
Expand Down Expand Up @@ -262,6 +263,8 @@ for opt do
;;
--disable-xnvme) xnvme="no"
;;
--disable-isal) isal="no"
;;
--disable-libblkio) libblkio="no"
;;
--disable-tcmalloc) disable_tcmalloc="yes"
Expand Down Expand Up @@ -322,6 +325,7 @@ if test "$show_help" = "yes" ; then
echo "--enable-libiscsi Enable iscsi support"
echo "--enable-libnbd Enable libnbd (NBD engine) support"
echo "--disable-xnvme Disable xnvme support even if found"
echo "--disable-isal Disable isal support even if found"
echo "--disable-libblkio Disable libblkio support even if found"
echo "--disable-libzbc Disable libzbc even if found"
echo "--disable-tcmalloc Disable tcmalloc support"
Expand Down Expand Up @@ -2684,6 +2688,19 @@ if test "$xnvme" != "no" ; then
fi
print_config "xnvme engine" "$xnvme"

##########################################
# Check if we have isa-l
if test "$isal" != "no" ; then
if check_min_lib_version libisal 2.30.0; then
isal="yes"
isal_cflags=$(pkg-config --cflags libisal)
isal_libs=$(pkg-config --libs libisal)
else
isal="no"
fi
fi
print_config "isa-l" "$isal"

##########################################
# Check if we have libblkio
if test "$libblkio" != "no" ; then
Expand Down Expand Up @@ -3334,6 +3351,11 @@ if test "$xnvme" = "yes" ; then
echo "LIBXNVME_CFLAGS=$xnvme_cflags" >> $config_host_mak
echo "LIBXNVME_LIBS=$xnvme_libs" >> $config_host_mak
fi
if test "$isal" = "yes" ; then
output_sym "CONFIG_LIBISAL"
echo "LIBISAL_CFLAGS=$isal_cflags" >> $config_host_mak
echo "LIBISAL_LIBS=$isal_libs" >> $config_host_mak
fi
if test "$libblkio" = "yes" ; then
output_sym "CONFIG_LIBBLKIO"
echo "LIBBLKIO_CFLAGS=$libblkio_cflags" >> $config_host_mak
Expand Down
13 changes: 13 additions & 0 deletions crc/crct10dif_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
*
*/

#ifdef CONFIG_LIBISAL
#include <isa-l/crc.h>

extern unsigned short fio_crc_t10dif(unsigned short crc,
const unsigned char *buffer,
unsigned int len)
{
return (crc16_t10dif(crc, buffer, len));
}

#else
#include "crc-t10dif.h"

/* Table generated using the following polynomium:
Expand Down Expand Up @@ -76,3 +87,5 @@ extern unsigned short fio_crc_t10dif(unsigned short crc,

return crc;
}

#endif
4 changes: 4 additions & 0 deletions fio.1
Original file line number Diff line number Diff line change
Expand Up @@ -2263,6 +2263,10 @@ size greater than protection information size, fio will not generate or verify
the protection information portion of metadata for write or read case
respectively. If this is set to 0, fio generates protection information for
write case and verifies for read case. Default: 1.

For 16 bit CRC generation fio will use isa-l if available otherwise it will
use the default slower generator.
(see: https://github.com/intel/isa-l)
.TP
.BI (io_uring_cmd)pi_chk \fR=\fPstr[,str][,str]
Controls the protection information check. This can take one or more of these
Expand Down

0 comments on commit e4cb3e3

Please sign in to comment.