diff options
author | hedongzhang <[email protected]> | 2021-08-04 01:46:33 +0800 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2021-09-14 14:29:46 -0700 |
commit | ddb732e2c8aacc62615887af13795fad0fa01943 (patch) | |
tree | b71a64c3a78a35d5451428f5103972567356735d /module | |
parent | 451d6da98838a570a9a1b8607c02802462999c28 (diff) |
Modify checksum obtain method of QAT
CpaDcGeneratefooter function that obtain the checksum code
does not support the CPA_DC_STATELESS mode. So we get the
adler32 chencksum of the end of the zlib from dc_results.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Chengfei Zhu <[email protected]>
Signed-off-by: hedong.zhang <[email protected]>
Closes #12343
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/qat_compress.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/module/os/linux/zfs/qat_compress.c b/module/os/linux/zfs/qat_compress.c index ad3ead3b1..1d099c95b 100644 --- a/module/os/linux/zfs/qat_compress.c +++ b/module/os/linux/zfs/qat_compress.c @@ -419,30 +419,11 @@ qat_compress_impl(qat_compress_dir_t dir, char *src, int src_len, goto fail; } - flat_buf_dst = (CpaFlatBuffer *)(buf_list_dst + 1); - /* move to the last page */ - flat_buf_dst += (compressed_sz + hdr_sz) >> PAGE_SHIFT; + /* get adler32 checksum and append footer */ + *(Cpa32U*)(dst + hdr_sz + compressed_sz) = + BSWAP_32(dc_results.checksum); - /* no space for gzip footer in the last page */ - if (((compressed_sz + hdr_sz) % PAGE_SIZE) - + ZLIB_FOOT_SZ > PAGE_SIZE) { - status = CPA_STATUS_INCOMPRESSIBLE; - goto fail; - } - - /* jump to the end of the buffer and append footer */ - flat_buf_dst->pData = - (char *)((unsigned long)flat_buf_dst->pData & PAGE_MASK) - + ((compressed_sz + hdr_sz) % PAGE_SIZE); - flat_buf_dst->dataLenInBytes = ZLIB_FOOT_SZ; - - dc_results.produced = 0; - status = cpaDcGenerateFooter(session_handle, - flat_buf_dst, &dc_results); - if (status != CPA_STATUS_SUCCESS) - goto fail; - - *c_len = compressed_sz + dc_results.produced + hdr_sz; + *c_len = hdr_sz + compressed_sz + ZLIB_FOOT_SZ; QAT_STAT_INCR(comp_total_out_bytes, *c_len); } else { ASSERT3U(dir, ==, QAT_DECOMPRESS); |