mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Chengfei Zhu <chengfeix.zhu@intel.com> Signed-off-by: hedong.zhang <h_d_zhang@163.com> Closes #12343
This commit is contained in:
parent
46b2623586
commit
4357552785
@ -419,30 +419,11 @@ qat_compress_impl(qat_compress_dir_t dir, char *src, int src_len,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
flat_buf_dst = (CpaFlatBuffer *)(buf_list_dst + 1);
|
/* get adler32 checksum and append footer */
|
||||||
/* move to the last page */
|
*(Cpa32U*)(dst + hdr_sz + compressed_sz) =
|
||||||
flat_buf_dst += (compressed_sz + hdr_sz) >> PAGE_SHIFT;
|
BSWAP_32(dc_results.checksum);
|
||||||
|
|
||||||
/* no space for gzip footer in the last page */
|
*c_len = hdr_sz + compressed_sz + ZLIB_FOOT_SZ;
|
||||||
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;
|
|
||||||
QAT_STAT_INCR(comp_total_out_bytes, *c_len);
|
QAT_STAT_INCR(comp_total_out_bytes, *c_len);
|
||||||
} else {
|
} else {
|
||||||
ASSERT3U(dir, ==, QAT_DECOMPRESS);
|
ASSERT3U(dir, ==, QAT_DECOMPRESS);
|
||||||
|
Loading…
Reference in New Issue
Block a user