diff --git a/config/kernel.m4 b/config/kernel.m4 index 465f69b72b36..8be30f602e21 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -280,27 +280,27 @@ dnl # Most modern Linux distributions have separate locations for bare dnl # source (source) and prebuilt (build) files. Additionally, there are dnl # `source` and `build` symlinks in `/lib/modules/$(KERNEL_VERSION)` dnl # pointing to them. The directory search order is now: -dnl # +dnl # dnl # - `configure` command line values if both `--with-linux` and dnl # `--with-linux-obj` were defined -dnl # +dnl # dnl # - If only `--with-linux` was defined, `--with-linux-obj` is assumed dnl # to have the same value as `--with-linux` -dnl # +dnl # dnl # - If neither `--with-linux` nor `--with-linux-obj` were defined dnl # autodetection is used: -dnl # +dnl # dnl # - `/lib/modules/$(uname -r)/{source,build}` respectively, if exist. -dnl # +dnl # dnl # - If only `/lib/modules/$(uname -r)/build` exists, it is assumed dnl # to be both source and build directory. -dnl # +dnl # dnl # - The first directory in `/lib/modules` with the highest version dnl # number according to `sort -V` which contains both `source` and dnl # `build` symlinks/directories. If module directory contains only dnl # `build` component, it is assumed to be both source and build dnl # directory. -dnl # +dnl # dnl # - Last resort: the first directory matching `/usr/src/kernels/*` dnl # and `/usr/src/linux-*` with the highest version number according dnl # to `sort -V` is assumed to be both source and build directory. @@ -491,10 +491,10 @@ AC_DEFUN([ZFS_AC_QAT], [ AC_MSG_RESULT([$qatbuild]) QAT_OBJ=${qatbuild} - AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [ + AS_IF([ ! test -e "$QAT_OBJ/libqat_s.so" ], [ AC_MSG_ERROR([ *** Please make sure the qat driver is installed then try again. - *** Failed to find icp_qa_al.ko or qat_api.ko in: + *** Failed to find libqat_s.so in: $QAT_OBJ]) ]) @@ -510,7 +510,7 @@ AC_DEFUN([ZFS_AC_QAT], [ dnl # AS_IF([test ! -z "${qatsrc}"], [ AC_MSG_CHECKING([qat file for module symbols]) - QAT_SYMBOLS=$QAT_SRC/lookaside/access_layer/src/Module.symvers + QAT_SYMBOLS=$QAT_SRC/qat/Module.symvers AS_IF([test -r $QAT_SYMBOLS], [ AC_MSG_RESULT([$QAT_SYMBOLS]) diff --git a/module/Kbuild.in b/module/Kbuild.in index c62a38b8201f..07d41afd8c82 100644 --- a/module/Kbuild.in +++ b/module/Kbuild.in @@ -529,6 +529,6 @@ ZFS_QAT_PROVIDER_OBJS := \ @ZIA_ENABLED_TRUE@@CONFIG_QAT_TRUE@$(addprefix $(obj)/zfs-qat-provider/,$(ZFS_QAT_PROVIDER_OBJS)) : ccflags-y += -I@abs_top_builddir@ $(ZFS_MODULE_CFLAGS) -I@abs_srcdir@/zfs-qat-provider/ -I@DPUSM_ROOT@/include/ -I@QAT_SRC@/include/ -Wframe-larger-than=20480 -@ZIA_ENABLED_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@ +@ZIA_ENABLED_TRUE@@CONFIG_QAT_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@ endif diff --git a/module/zfs-qat-provider/provider.c b/module/zfs-qat-provider/provider.c index 571d3e658b4e..76008a839f9f 100644 --- a/module/zfs-qat-provider/provider.c +++ b/module/zfs-qat-provider/provider.c @@ -184,6 +184,7 @@ zfs_qat_provider_copy_from_generic(dpusm_mv_t *mv, const void *buf, size_t size) { memcpy(ptr_start(dst, mv->offset), buf, size); } + return (DPUSM_OK); } @@ -203,350 +204,350 @@ zfs_qat_provider_copy_to_generic(dpusm_mv_t *mv, void *buf, size_t size) return (DPUSM_OK); } -static int -zfs_qat_provider_zero_fill(void *handle, size_t offset, size_t size) -{ - memset(ptr_start(handle, offset), 0, size); - return (DPUSM_OK); -} - -static int -zfs_qat_provider_all_zeros(void *handle, size_t offset, size_t size) -{ - zqh_t *zqh = (zqh_t *)handle; - for (size_t i = 0; i < size; i++) { - if (((char *)zqh->ptr)[offset + i]) { - return (DPUSM_ERROR); - } - } - return (DPUSM_OK); -} - -static int -zfs_qat_provider_compress(dpusm_compress_t alg, int level, - void *src, size_t s_len, void *dst, size_t *d_len) -{ - (void) alg; /* unused */ - (void) level; /* unused */ - - /* check if hardware accelerator can be used */ - if (!qat_dc_use_accel(s_len)) { - return (DPUSM_ERROR); - } - - zqh_t *s = (zqh_t *)src; - zqh_t *d = (zqh_t *)dst; - - if ((s_len > s->size) || - (*d_len > d->size)) { - return (DPUSM_ERROR); - } - - void *s_start = ptr_start(s, 0); - void *d_start = ptr_start(d, 0); - - const int ret = qat_compress(QAT_COMPRESS, - s_start, s_len, d_start, *d_len, d_len); - - if (ret == CPA_STATUS_SUCCESS) { - return (DPUSM_OK); - } else if (ret == CPA_STATUS_INCOMPRESSIBLE) { - *d_len = s_len; - return (DPUSM_OK); - } - return (DPUSM_ERROR); -} - -static int -zfs_qat_provider_decompress(dpusm_compress_t alg, int *level, - void *src, size_t s_len, void *dst, size_t *d_len) -{ - (void) alg; /* unused */ - (void) level; /* unused */ - - /* check if hardware accelerator can be used */ - if (!qat_dc_use_accel(*d_len)) { - return (DPUSM_ERROR); - } - - zqh_t *s = (zqh_t *)src; - zqh_t *d = (zqh_t *)dst; - - if ((s_len > s->size) || - (*d_len > d->size)) { - return (DPUSM_ERROR); - } - - void *s_start = ptr_start(s, 0); - void *d_start = ptr_start(d, 0); - - if (qat_compress(QAT_DECOMPRESS, s_start, s_len, - d_start, *d_len, d_len) == CPA_STATUS_SUCCESS) { - return (DPUSM_OK); - } - - return (DPUSM_ERROR); -} - -static int -zfs_qat_provider_checksum(dpusm_checksum_t alg, - dpusm_checksum_byteorder_t order, void *data, size_t size, - void *cksum, size_t cksum_size) -{ - (void) order; /* might have to handle here */ - - if (!qat_checksum_use_accel(size)) { - return (DPUSM_ERROR); - } - - if (alg != DPUSM_CHECKSUM_SHA256) { - return (DPUSM_NOT_IMPLEMENTED); - } - - if (cksum_size < sizeof (zio_cksum_t)) { - return (DPUSM_ERROR); - } - - zqh_t *src = (zqh_t *)data; - if (size > src->size) { - return (DPUSM_ERROR); - } - - const int ret = qat_checksum(ZIO_CHECKSUM_SHA256, src->ptr, size, - cksum); - return ((ret == CPA_STATUS_SUCCESS)?DPUSM_OK:DPUSM_ERROR); -} - -static int -zfs_qat_provider_raidz_can_compute(size_t nparity, size_t ndata, - size_t *col_sizes, int rec) -{ - if ((nparity < 1) || (nparity > 3)) { - return (DPUSM_NOT_SUPPORTED); - } - - return (DPUSM_OK); -} - -static void * -zfs_qat_provider_raidz_alloc(size_t nparity, size_t ndata) -{ - const size_t ncols = nparity + ndata; - - const size_t rr_size = offsetof(raidz_row_t, rr_col[ncols]); - raidz_row_t *rr = kzalloc(rr_size, GFP_KERNEL); - rr->rr_cols = ncols; - rr->rr_firstdatacol = nparity; - - return (rr); -} - -/* attaches a column to the raidz struct */ -static int -zfs_qat_provider_raidz_set_column(void *raidz, uint64_t c, - void *col, size_t size) -{ - raidz_row_t *rr = (raidz_row_t *)raidz; - zqh_t *zqh = (zqh_t *)col; - - if (!rr || !zqh) { - return (DPUSM_ERROR); - } - - /* c is too big */ - if (c >= rr->rr_cols) { - return (DPUSM_ERROR); - } - - /* "active" size is larger than allocated size */ - if (size > zqh->size) { - return (DPUSM_ERROR); - } - - raidz_col_t *rc = &rr->rr_col[c]; - - /* clean up old column */ - abd_free(rc->rc_abd); - - /* - * rc->rc_abd does not take ownership of zqh->ptr, - * so don't need to release ownership - */ - rc->rc_abd = abd_get_from_buf(zqh->ptr, size); - rc->rc_size = size; - - return (DPUSM_OK); -} - -static int -zfs_qat_provider_raidz_free(void *raidz) -{ - raidz_row_t *rr = (raidz_row_t *)raidz; - for (int c = 0; c < rr->rr_cols; c++) { - raidz_col_t *rc = &rr->rr_col[c]; - abd_free(rc->rc_abd); - } - kfree(rr); - - return (DPUSM_OK); -} - -static int -zfs_qat_provider_raidz_gen(void *raidz) -{ - raidz_row_t *rr = (raidz_row_t *)raidz; - switch (rr->rr_firstdatacol) { - case 1: - vdev_raidz_generate_parity_p(rr); - break; - case 2: - vdev_raidz_generate_parity_pq(rr); - break; - case 3: - vdev_raidz_generate_parity_pqr(rr); - break; - } - - return (DPUSM_OK); -} - -static int -zfs_qat_provider_raidz_rec(void *raidz, int *tgts, int ntgts) -{ - raidz_row_t *rr = (raidz_row_t *)raidz; - vdev_raidz_reconstruct_general(rr, tgts, ntgts); - - return (DPUSM_OK); -} - -static int -zfs_qat_provider_raidz_cmp(void *lhs_handle, void *rhs_handle, int *diff) -{ - zqh_t *lhs = (zqh_t *)lhs_handle; - zqh_t *rhs = (zqh_t *)rhs_handle; - - if (!diff) { - return (DPUSM_ERROR); - } - - size_t len = rhs->size; - if (lhs->size != rhs->size) { - len = - (lhs->size < rhs->size)?lhs->size:rhs->size; - } - - *diff = memcmp(ptr_start(lhs, 0), - ptr_start(rhs, 0), len); - - return (DPUSM_OK); -} - -static void * -zfs_qat_provider_file_open(const char *path, int flags, int mode) -{ - zfs_file_t *fp = NULL; - /* on error, fp should still be NULL */ - zfs_file_open(path, flags, mode, &fp); - return (fp); -} - -static int -zfs_qat_provider_file_write(void *fp_handle, void *handle, size_t count, - size_t trailing_zeros, loff_t offset, ssize_t *resid, int *err) -{ - zfs_file_t *fp = (zfs_file_t *)fp_handle; - zqh_t *zqh = (zqh_t *)handle; - - if (!err) { - return (EIO); - } - - *err = zfs_file_pwrite(fp, ptr_start(zqh, 0), - count, offset, resid); - - if (*err == 0) { - void *zeros = kzalloc(trailing_zeros, GFP_KERNEL); - *err = zfs_file_pwrite(fp, zeros, - trailing_zeros, offset + count, resid); - kfree(zeros); - } - - return (*err); -} - -static void -zfs_qat_provider_file_close(void *fp_handle) -{ - zfs_file_close(fp_handle); -} - -static void * -zfs_qat_provider_disk_open(dpusm_dd_t *disk_data) -{ - return (disk_data->bdev); -} - -static int -zfs_qat_provider_disk_invalidate(void *disk_handle) -{ - struct block_device *bdev = - (struct block_device *)disk_handle; - invalidate_bdev(bdev); - return (DPUSM_OK); -} - -static int -zfs_qat_provider_disk_write(void *disk_handle, void *handle, size_t data_size, - size_t trailing_zeros, uint64_t io_offset, int flags, - dpusm_disk_write_completion_t write_completion, void *wc_args) -{ - struct block_device *bdev = - (struct block_device *)disk_handle; - zqh_t *zqh = (zqh_t *)handle; - - const size_t io_size = data_size + trailing_zeros; - - if (trailing_zeros) { - /* create a copy of the data with the trailing zeros attached */ - void *copy = kzalloc(io_size, GFP_KERNEL); - memcpy(copy, ptr_start(zqh, 0), data_size); - - /* need to keep copy alive, so replace zqh->ptr */ - if (zqh->type == ZQH_REAL) { - kfree(zqh->ptr); - } - - zqh->type = ZQH_REAL; - zqh->ptr = copy; - zqh->size = io_size; - } - - abd_t *abd = abd_get_from_buf(zqh->ptr, io_size); - zio_push_transform(wc_args, abd, io_size, io_size, NULL); - - /* __vdev_disk_physio already adds write_completion */ - (void) write_completion; - - return (__vdev_classic_physio(bdev, wc_args, - io_size, io_offset, WRITE, flags)); -} - -static int -zfs_qat_provider_disk_flush(void *disk_handle, - dpusm_disk_flush_completion_t flush_completion, void *fc_args) -{ - struct block_device *bdev = - (struct block_device *)disk_handle; - - /* vdev_disk_io_flush already adds flush completion */ - (void) flush_completion; - - return (vdev_disk_io_flush(bdev, fc_args)); -} - -static void -zfs_qat_provider_disk_close(void *disk_handle) -{} +/* static int */ +/* zfs_qat_provider_zero_fill(void *handle, size_t offset, size_t size) */ +/* { */ +/* memset(ptr_start(handle, offset), 0, size); */ +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_all_zeros(void *handle, size_t offset, size_t size) */ +/* { */ +/* zqh_t *zqh = (zqh_t *)handle; */ +/* for (size_t i = 0; i < size; i++) { */ +/* if (((char *)zqh->ptr)[offset + i]) { */ +/* return (DPUSM_ERROR); */ +/* } */ +/* } */ +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_compress(dpusm_compress_t alg, int level, */ +/* void *src, size_t s_len, void *dst, size_t *d_len) */ +/* { */ +/* (void) alg; /\* unused *\/ */ +/* (void) level; /\* unused *\/ */ + +/* /\* check if hardware accelerator can be used *\/ */ +/* if (!qat_dc_use_accel(s_len)) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* zqh_t *s = (zqh_t *)src; */ +/* zqh_t *d = (zqh_t *)dst; */ + +/* if ((s_len > s->size) || */ +/* (*d_len > d->size)) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* void *s_start = ptr_start(s, 0); */ +/* void *d_start = ptr_start(d, 0); */ + +/* const int ret = qat_compress(QAT_COMPRESS, */ +/* s_start, s_len, d_start, *d_len, d_len); */ + +/* if (ret == CPA_STATUS_SUCCESS) { */ +/* return (DPUSM_OK); */ +/* } else if (ret == CPA_STATUS_INCOMPRESSIBLE) { */ +/* *d_len = s_len; */ +/* return (DPUSM_OK); */ +/* } */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_decompress(dpusm_compress_t alg, int *level, */ +/* void *src, size_t s_len, void *dst, size_t *d_len) */ +/* { */ +/* (void) alg; /\* unused *\/ */ +/* (void) level; /\* unused *\/ */ + +/* /\* check if hardware accelerator can be used *\/ */ +/* if (!qat_dc_use_accel(*d_len)) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* zqh_t *s = (zqh_t *)src; */ +/* zqh_t *d = (zqh_t *)dst; */ + +/* if ((s_len > s->size) || */ +/* (*d_len > d->size)) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* void *s_start = ptr_start(s, 0); */ +/* void *d_start = ptr_start(d, 0); */ + +/* if (qat_compress(QAT_DECOMPRESS, s_start, s_len, */ +/* d_start, *d_len, d_len) == CPA_STATUS_SUCCESS) { */ +/* return (DPUSM_OK); */ +/* } */ + +/* return (DPUSM_ERROR); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_checksum(dpusm_checksum_t alg, */ +/* dpusm_checksum_byteorder_t order, void *data, size_t size, */ +/* void *cksum, size_t cksum_size) */ +/* { */ +/* (void) order; /\* might have to handle here *\/ */ + +/* if (!qat_checksum_use_accel(size)) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* if (alg != DPUSM_CHECKSUM_SHA256) { */ +/* return (DPUSM_NOT_IMPLEMENTED); */ +/* } */ + +/* if (cksum_size < sizeof (zio_cksum_t)) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* zqh_t *src = (zqh_t *)data; */ +/* if (size > src->size) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* const int ret = qat_checksum(ZIO_CHECKSUM_SHA256, src->ptr, size, */ +/* cksum); */ +/* return ((ret == CPA_STATUS_SUCCESS)?DPUSM_OK:DPUSM_ERROR); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_raidz_can_compute(size_t nparity, size_t ndata, */ +/* size_t *col_sizes, int rec) */ +/* { */ +/* if ((nparity < 1) || (nparity > 3)) { */ +/* return (DPUSM_NOT_SUPPORTED); */ +/* } */ + +/* return (DPUSM_OK); */ +/* } */ + +/* static void * */ +/* zfs_qat_provider_raidz_alloc(size_t nparity, size_t ndata) */ +/* { */ +/* const size_t ncols = nparity + ndata; */ + +/* const size_t rr_size = offsetof(raidz_row_t, rr_col[ncols]); */ +/* raidz_row_t *rr = kzalloc(rr_size, GFP_KERNEL); */ +/* rr->rr_cols = ncols; */ +/* rr->rr_firstdatacol = nparity; */ + +/* return (rr); */ +/* } */ + +/* /\* attaches a column to the raidz struct *\/ */ +/* static int */ +/* zfs_qat_provider_raidz_set_column(void *raidz, uint64_t c, */ +/* void *col, size_t size) */ +/* { */ +/* raidz_row_t *rr = (raidz_row_t *)raidz; */ +/* zqh_t *zqh = (zqh_t *)col; */ + +/* if (!rr || !zqh) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* /\* c is too big *\/ */ +/* if (c >= rr->rr_cols) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* /\* "active" size is larger than allocated size *\/ */ +/* if (size > zqh->size) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* raidz_col_t *rc = &rr->rr_col[c]; */ + +/* /\* clean up old column *\/ */ +/* abd_free(rc->rc_abd); */ + +/* /\* */ +/* * rc->rc_abd does not take ownership of zqh->ptr, */ +/* * so don't need to release ownership */ +/* *\/ */ +/* rc->rc_abd = abd_get_from_buf(zqh->ptr, size); */ +/* rc->rc_size = size; */ + +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_raidz_free(void *raidz) */ +/* { */ +/* raidz_row_t *rr = (raidz_row_t *)raidz; */ +/* for (int c = 0; c < rr->rr_cols; c++) { */ +/* raidz_col_t *rc = &rr->rr_col[c]; */ +/* abd_free(rc->rc_abd); */ +/* } */ +/* kfree(rr); */ + +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_raidz_gen(void *raidz) */ +/* { */ +/* raidz_row_t *rr = (raidz_row_t *)raidz; */ +/* switch (rr->rr_firstdatacol) { */ +/* case 1: */ +/* vdev_raidz_generate_parity_p(rr); */ +/* break; */ +/* case 2: */ +/* vdev_raidz_generate_parity_pq(rr); */ +/* break; */ +/* case 3: */ +/* vdev_raidz_generate_parity_pqr(rr); */ +/* break; */ +/* } */ + +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_raidz_rec(void *raidz, int *tgts, int ntgts) */ +/* { */ +/* raidz_row_t *rr = (raidz_row_t *)raidz; */ +/* vdev_raidz_reconstruct_general(rr, tgts, ntgts); */ + +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_raidz_cmp(void *lhs_handle, void *rhs_handle, int *diff) */ +/* { */ +/* zqh_t *lhs = (zqh_t *)lhs_handle; */ +/* zqh_t *rhs = (zqh_t *)rhs_handle; */ + +/* if (!diff) { */ +/* return (DPUSM_ERROR); */ +/* } */ + +/* size_t len = rhs->size; */ +/* if (lhs->size != rhs->size) { */ +/* len = */ +/* (lhs->size < rhs->size)?lhs->size:rhs->size; */ +/* } */ + +/* *diff = memcmp(ptr_start(lhs, 0), */ +/* ptr_start(rhs, 0), len); */ + +/* return (DPUSM_OK); */ +/* } */ + +/* static void * */ +/* zfs_qat_provider_file_open(const char *path, int flags, int mode) */ +/* { */ +/* zfs_file_t *fp = NULL; */ +/* /\* on error, fp should still be NULL *\/ */ +/* zfs_file_open(path, flags, mode, &fp); */ +/* return (fp); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_file_write(void *fp_handle, void *handle, size_t count, */ +/* size_t trailing_zeros, loff_t offset, ssize_t *resid, int *err) */ +/* { */ +/* zfs_file_t *fp = (zfs_file_t *)fp_handle; */ +/* zqh_t *zqh = (zqh_t *)handle; */ + +/* if (!err) { */ +/* return (EIO); */ +/* } */ + +/* *err = zfs_file_pwrite(fp, ptr_start(zqh, 0), */ +/* count, offset, resid); */ + +/* if (*err == 0) { */ +/* void *zeros = kzalloc(trailing_zeros, GFP_KERNEL); */ +/* *err = zfs_file_pwrite(fp, zeros, */ +/* trailing_zeros, offset + count, resid); */ +/* kfree(zeros); */ +/* } */ + +/* return (*err); */ +/* } */ + +/* static void */ +/* zfs_qat_provider_file_close(void *fp_handle) */ +/* { */ +/* zfs_file_close(fp_handle); */ +/* } */ + +/* static void * */ +/* zfs_qat_provider_disk_open(dpusm_dd_t *disk_data) */ +/* { */ +/* return (disk_data->bdev); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_disk_invalidate(void *disk_handle) */ +/* { */ +/* struct block_device *bdev = */ +/* (struct block_device *)disk_handle; */ +/* invalidate_bdev(bdev); */ +/* return (DPUSM_OK); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_disk_write(void *disk_handle, void *handle, size_t data_size, */ +/* size_t trailing_zeros, uint64_t io_offset, int flags, */ +/* dpusm_disk_write_completion_t write_completion, void *wc_args) */ +/* { */ +/* struct block_device *bdev = */ +/* (struct block_device *)disk_handle; */ +/* zqh_t *zqh = (zqh_t *)handle; */ + +/* const size_t io_size = data_size + trailing_zeros; */ + +/* if (trailing_zeros) { */ +/* /\* create a copy of the data with the trailing zeros attached *\/ */ +/* void *copy = kzalloc(io_size, GFP_KERNEL); */ +/* memcpy(copy, ptr_start(zqh, 0), data_size); */ + +/* /\* need to keep copy alive, so replace zqh->ptr *\/ */ +/* if (zqh->type == ZQH_REAL) { */ +/* kfree(zqh->ptr); */ +/* } */ + +/* zqh->type = ZQH_REAL; */ +/* zqh->ptr = copy; */ +/* zqh->size = io_size; */ +/* } */ + +/* abd_t *abd = abd_get_from_buf(zqh->ptr, io_size); */ +/* zio_push_transform(wc_args, abd, io_size, io_size, NULL); */ + +/* /\* __vdev_disk_physio already adds write_completion *\/ */ +/* (void) write_completion; */ + +/* return (__vdev_classic_physio(bdev, wc_args, */ +/* io_size, io_offset, WRITE, flags)); */ +/* } */ + +/* static int */ +/* zfs_qat_provider_disk_flush(void *disk_handle, */ +/* dpusm_disk_flush_completion_t flush_completion, void *fc_args) */ +/* { */ +/* struct block_device *bdev = */ +/* (struct block_device *)disk_handle; */ + +/* /\* vdev_disk_io_flush already adds flush completion *\/ */ +/* (void) flush_completion; */ + +/* return (vdev_disk_io_flush(bdev, fc_args)); */ +/* } */ + +/* static void */ +/* zfs_qat_provider_disk_close(void *disk_handle) */ +/* {} */ /* * "zfs-qat-provider" instead of "qat-provider" @@ -574,32 +575,32 @@ static const dpusm_pf_t zfs_qat_provider_functions = { .at_connect = NULL, .at_disconnect = NULL, .mem_stats = NULL, - .zero_fill = zfs_qat_provider_zero_fill, - .all_zeros = zfs_qat_provider_all_zeros, - .compress = zfs_qat_provider_compress, - .decompress = zfs_qat_provider_decompress, - .checksum = zfs_qat_provider_checksum, - .raid = { - .can_compute = zfs_qat_provider_raidz_can_compute, - .alloc = zfs_qat_provider_raidz_alloc, - .set_column = zfs_qat_provider_raidz_set_column, - .free = zfs_qat_provider_raidz_free, - .gen = zfs_qat_provider_raidz_gen, - .cmp = zfs_qat_provider_raidz_cmp, - .rec = zfs_qat_provider_raidz_rec, - }, - .file = { - .open = zfs_qat_provider_file_open, - .write = zfs_qat_provider_file_write, - .close = zfs_qat_provider_file_close, - }, - .disk = { - .open = zfs_qat_provider_disk_open, - .invalidate = zfs_qat_provider_disk_invalidate, - .write = zfs_qat_provider_disk_write, - .flush = zfs_qat_provider_disk_flush, - .close = zfs_qat_provider_disk_close, - }, + /* .zero_fill = zfs_qat_provider_zero_fill, */ + /* .all_zeros = zfs_qat_provider_all_zeros, */ + /* .compress = zfs_qat_provider_compress, */ + /* .decompress = zfs_qat_provider_decompress, */ + /* .checksum = zfs_qat_provider_checksum, */ + /* .raid = { */ + /* .can_compute = zfs_qat_provider_raidz_can_compute, */ + /* .alloc = zfs_qat_provider_raidz_alloc, */ + /* .set_column = zfs_qat_provider_raidz_set_column, */ + /* .free = zfs_qat_provider_raidz_free, */ + /* .gen = zfs_qat_provider_raidz_gen, */ + /* .cmp = zfs_qat_provider_raidz_cmp, */ + /* .rec = zfs_qat_provider_raidz_rec, */ + /* }, */ + /* .file = { */ + /* .open = zfs_qat_provider_file_open, */ + /* .write = zfs_qat_provider_file_write, */ + /* .close = zfs_qat_provider_file_close, */ + /* }, */ + /* .disk = { */ + /* .open = zfs_qat_provider_disk_open, */ + /* .invalidate = zfs_qat_provider_disk_invalidate, */ + /* .write = zfs_qat_provider_disk_write, */ + /* .flush = zfs_qat_provider_disk_flush, */ + /* .close = zfs_qat_provider_disk_close, */ + /* }, */ }; /* END CSTYLED */ @@ -614,15 +615,48 @@ zfs_qat_provider_init(void) return (-ENODEV); } - if (dev_count == 0) { - printk("%s: Error: No devices found\n", - module_name(THIS_MODULE)); - return (-ENODEV); - } + /* if (dev_count == 0) { */ + /* printk("%s: Error: No devices found\n", */ + /* module_name(THIS_MODULE)); */ + /* return (-ENODEV); */ + /* } */ printk("%s: Initialized\n", module_name(THIS_MODULE)); + /* const size_t size = 4096; */ + + /* void *mem = kmalloc(size, GFP_KERNEL); */ + /* snprintf(mem, size, "hello world"); */ + + /* void *qat = zfs_qat_provider_alloc(size); */ + + /* dpusm_mv_t mv = { */ + /* .handle = qat, */ + /* .offset = 0, */ + /* }; */ + + /* zfs_qat_provider_copy_from_generic(&mv, mem, size); */ + + /* size_t comp_size = size * 2; */ + /* void *qat2 = zfs_qat_provider_alloc(comp_size); */ + + /* int rc = zfs_qat_provider_compress(DPUSM_COMPRESS_GZIP_6, 6, */ + /* qat, size, qat2, &comp_size); */ + /* printk("%d\n", rc); */ + + /* /\* void *mem2 = kmalloc(size, GFP_KERNEL); *\/ */ + /* /\* zfs_qat_provider_copy_to_generic(&mv, mem2, size); *\/ */ + /* /\* printk("[%s]\n", (char *) mem2); *\/ */ + /* /\* kfree(mem2); *\/ */ + + /* zfs_qat_provider_free(qat2); */ + + /* zfs_qat_provider_free(qat); */ + + /* kfree(mem); */ + return (dpusm_register_bsd(THIS_MODULE, &zfs_qat_provider_functions)); + /* return 0; */ } static void __exit