From 4da8c7d11e6a7db5315a9fadabb359abc45f948e Mon Sep 17 00:00:00 2001 From: Volker Mauel Date: Thu, 7 Sep 2023 23:38:17 +0200 Subject: [PATCH 1/3] Intel QAT 1.7 compatibility Based on the intel QAT samples which are bundled in the 1.x drivers, this is the preferred approach since api version 1.6. See: https://www.intel.de/content/www/de/de/download/19734/intel-quickassist-technology-driver-for-linux-hw-version-1-x.html? Reviewed-by: Weigang Li Signed-off-by: Volker Mauel Closes #15190 --- module/os/linux/zfs/qat_compress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/os/linux/zfs/qat_compress.c b/module/os/linux/zfs/qat_compress.c index 07d5d34dae3..6d0595dd5f7 100644 --- a/module/os/linux/zfs/qat_compress.c +++ b/module/os/linux/zfs/qat_compress.c @@ -193,7 +193,9 @@ qat_dc_init(void) sd.huffType = CPA_DC_HT_FULL_DYNAMIC; sd.sessDirection = CPA_DC_DIR_COMBINED; sd.sessState = CPA_DC_STATELESS; +#if (CPA_DC_API_VERSION_NUM_MAJOR == 1 && CPA_DC_API_VERSION_NUM_MINOR < 6) sd.deflateWindowSize = 7; +#endif sd.checksum = CPA_DC_ADLER32; status = cpaDcGetSessionSize(dc_inst_handles[i], &sd, &sess_size, &ctx_size); From 739db06ce7d453f92b93c9274e1f2176f927992d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 7 Sep 2023 16:11:33 -0700 Subject: [PATCH 2/3] Tag 2.2.0-rc4 Signed-off-by: Brian Behlendorf --- META | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META b/META index e4e770026b5..0953cc51922 100644 --- a/META +++ b/META @@ -2,7 +2,7 @@ Meta: 1 Name: zfs Branch: 1.0 Version: 2.2.0 -Release: rc3 +Release: rc4 Release-Tags: relext License: CDDL Author: OpenZFS From e96fbdba344e9c25cad624a10d4a4b300fd35f6c Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 8 Sep 2023 17:25:43 -0400 Subject: [PATCH 3/3] Add more constraints for block cloning. - We cannot clone into files with smaller block size if there is more than one block, since we can not grow the block size. - Block size must be power-of-2 if destination offset != 0, since there can be no multiple blocks of non-power-of-2 size. The first should handle the case when destination file has several blocks but still is not bigger than one block of the source file. The second fixes panic in dmu_buf_hold_array_by_dnode() on attempt to concatenate files with equal but non-power-of-2 block sizes. While there, assert that error is reported if we made no progress. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- module/zfs/zfs_vnops.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index f8d13075d5c..a64e1e2dc83 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1172,9 +1172,20 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, inblksz = inzp->z_blksz; /* - * We cannot clone into files with different block size. + * We cannot clone into files with different block size if we can't + * grow it (block size is already bigger or more than one block). */ - if (inblksz != outzp->z_blksz && outzp->z_size > inblksz) { + if (inblksz != outzp->z_blksz && (outzp->z_size > outzp->z_blksz || + outzp->z_size > inblksz)) { + error = SET_ERROR(EINVAL); + goto unlock; + } + + /* + * Block size must be power-of-2 if destination offset != 0. + * There can be no multiple blocks of non-power-of-2 size. + */ + if (outoff != 0 && !ISP2(inblksz)) { error = SET_ERROR(EINVAL); goto unlock; } @@ -1358,6 +1369,12 @@ unlock: *inoffp += done; *outoffp += done; *lenp = done; + } else { + /* + * If we made no progress, there must be a good reason. + * EOF is handled explicitly above, before the loop. + */ + ASSERT3S(error, !=, 0); } zfs_exit_two(inzfsvfs, outzfsvfs, FTAG);