dix: calculate CRC of metadata after data
In the similar codes that for dif (precisely speaking, _dif_generate_copy_split() and _dif_verify_copy_split()), they calculate CRC of metadata after data, so let's make them consistent. Change-Id: I2d725277ab42657ba2e0253ae8cece829fd868b4 Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com> Reviewed-on: https://review.gerrithub.io/c/439824 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
3816dbf89b
commit
2ce9296ed2
@ -1038,10 +1038,6 @@ _dix_generate_split(struct _iov_iter *data_iter, struct _iov_iter *md_iter,
|
||||
_iov_iter_get_buf(md_iter, &md_buf, NULL);
|
||||
|
||||
guard = 0;
|
||||
if (ctx->dif_flags & SPDK_DIF_GUARD_CHECK) {
|
||||
guard = spdk_crc16_t10dif(0, md_buf, ctx->guard_interval);
|
||||
}
|
||||
|
||||
offset_in_block = 0;
|
||||
|
||||
while (offset_in_block < ctx->block_size) {
|
||||
@ -1056,6 +1052,10 @@ _dix_generate_split(struct _iov_iter *data_iter, struct _iov_iter *md_iter,
|
||||
offset_in_block += data_buf_len;
|
||||
}
|
||||
|
||||
if (ctx->dif_flags & SPDK_DIF_GUARD_CHECK) {
|
||||
guard = spdk_crc16_t10dif(guard, md_buf, ctx->guard_interval);
|
||||
}
|
||||
|
||||
_iov_iter_advance(md_iter, ctx->md_size);
|
||||
|
||||
_dif_generate(md_buf + ctx->guard_interval, guard, offset_blocks, ctx);
|
||||
@ -1152,10 +1152,6 @@ _dix_verify_split(struct _iov_iter *data_iter, struct _iov_iter *md_iter,
|
||||
_iov_iter_get_buf(md_iter, &md_buf, NULL);
|
||||
|
||||
guard = 0;
|
||||
if (ctx->dif_flags & SPDK_DIF_GUARD_CHECK) {
|
||||
guard = spdk_crc16_t10dif(0, md_buf, ctx->guard_interval);
|
||||
}
|
||||
|
||||
offset_in_block = 0;
|
||||
|
||||
while (offset_in_block < ctx->block_size) {
|
||||
@ -1170,6 +1166,10 @@ _dix_verify_split(struct _iov_iter *data_iter, struct _iov_iter *md_iter,
|
||||
offset_in_block += data_buf_len;
|
||||
}
|
||||
|
||||
if (ctx->dif_flags & SPDK_DIF_GUARD_CHECK) {
|
||||
guard = spdk_crc16_t10dif(guard, md_buf, ctx->guard_interval);
|
||||
}
|
||||
|
||||
_iov_iter_advance(md_iter, ctx->md_size);
|
||||
|
||||
return _dif_verify(md_buf + ctx->guard_interval, guard, offset_blocks, ctx, err_blk);
|
||||
|
Loading…
x
Reference in New Issue
Block a user