Commit f8609162 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Konrad Sztyber
Browse files

dif: Rename internal generate/verify_copy() by insert/strip_copy()



We want to add NVMe PRACT handling into the DIF library.
If metadata size is equal with PI size, NVMe PRACT and insert/strip
are same. But, if metadata size is larger than PI size, NVMe PRACT
is overwrite/verify. Current generate/verify_copy() support only
insert/strip.

Hence, as a preparation, rename internal dif_generate/verify_copy()
by dif_insert/strip_copy().

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: Ic309d8bc41e5d92ad87cacf69909f15303c2cea1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23685


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent 0383e688
Loading
Loading
Loading
Loading
+28 −28
Original line number Diff line number Diff line
@@ -1156,7 +1156,7 @@ spdk_dif_update_crc32c(struct iovec *iovs, int iovcnt, uint32_t num_blocks,
}

static void
_dif_generate_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
_dif_insert_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		 uint32_t offset_blocks, const struct spdk_dif_ctx *ctx)
{
	uint32_t data_block_size;
@@ -1184,18 +1184,18 @@ _dif_generate_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
}

static void
dif_generate_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
dif_insert_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		uint32_t num_blocks, const struct spdk_dif_ctx *ctx)
{
	uint32_t offset_blocks;

	for (offset_blocks = 0; offset_blocks < num_blocks; offset_blocks++) {
		_dif_generate_copy(src_sgl, dst_sgl, offset_blocks, ctx);
		_dif_insert_copy(src_sgl, dst_sgl, offset_blocks, ctx);
	}
}

static void
_dif_generate_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
_dif_insert_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		       uint32_t offset_blocks, const struct spdk_dif_ctx *ctx)
{
	uint32_t data_block_size;
@@ -1220,13 +1220,13 @@ _dif_generate_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
}

static void
dif_generate_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
dif_insert_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		      uint32_t num_blocks, const struct spdk_dif_ctx *ctx)
{
	uint32_t offset_blocks;

	for (offset_blocks = 0; offset_blocks < num_blocks; offset_blocks++) {
		_dif_generate_copy_split(src_sgl, dst_sgl, offset_blocks, ctx);
		_dif_insert_copy_split(src_sgl, dst_sgl, offset_blocks, ctx);
	}
}

@@ -1292,16 +1292,16 @@ spdk_dif_generate_copy(struct iovec *iovs, int iovcnt, struct iovec *bounce_iovs

	if (_dif_sgl_is_bytes_multiple(&src_sgl, data_block_size) &&
	    _dif_sgl_is_bytes_multiple(&dst_sgl, ctx->block_size)) {
		dif_generate_copy(&src_sgl, &dst_sgl, num_blocks, ctx);
		dif_insert_copy(&src_sgl, &dst_sgl, num_blocks, ctx);
	} else {
		dif_generate_copy_split(&src_sgl, &dst_sgl, num_blocks, ctx);
		dif_insert_copy_split(&src_sgl, &dst_sgl, num_blocks, ctx);
	}

	return 0;
}

static int
_dif_verify_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
_dif_strip_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		uint32_t offset_blocks, const struct spdk_dif_ctx *ctx,
		struct spdk_dif_error *err_blk)
{
@@ -1336,7 +1336,7 @@ _dif_verify_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
}

static int
dif_verify_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
dif_strip_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
	       uint32_t num_blocks, const struct spdk_dif_ctx *ctx,
	       struct spdk_dif_error *err_blk)
{
@@ -1344,7 +1344,7 @@ dif_verify_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
	int rc;

	for (offset_blocks = 0; offset_blocks < num_blocks; offset_blocks++) {
		rc = _dif_verify_copy(src_sgl, dst_sgl, offset_blocks, ctx, err_blk);
		rc = _dif_strip_copy(src_sgl, dst_sgl, offset_blocks, ctx, err_blk);
		if (rc != 0) {
			return rc;
		}
@@ -1354,7 +1354,7 @@ dif_verify_copy(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
}

static int
_dif_verify_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
_dif_strip_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		      uint32_t offset_blocks, const struct spdk_dif_ctx *ctx,
		      struct spdk_dif_error *err_blk)
{
@@ -1380,7 +1380,7 @@ _dif_verify_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
}

static int
dif_verify_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
dif_strip_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
		     uint32_t num_blocks, const struct spdk_dif_ctx *ctx,
		     struct spdk_dif_error *err_blk)
{
@@ -1388,7 +1388,7 @@ dif_verify_copy_split(struct _dif_sgl *src_sgl, struct _dif_sgl *dst_sgl,
	int rc;

	for (offset_blocks = 0; offset_blocks < num_blocks; offset_blocks++) {
		rc = _dif_verify_copy_split(src_sgl, dst_sgl, offset_blocks, ctx, err_blk);
		rc = _dif_strip_copy_split(src_sgl, dst_sgl, offset_blocks, ctx, err_blk);
		if (rc != 0) {
			return rc;
		}
@@ -1460,9 +1460,9 @@ spdk_dif_verify_copy(struct iovec *iovs, int iovcnt, struct iovec *bounce_iovs,

	if (_dif_sgl_is_bytes_multiple(&dst_sgl, data_block_size) &&
	    _dif_sgl_is_bytes_multiple(&src_sgl, ctx->block_size)) {
		return dif_verify_copy(&src_sgl, &dst_sgl, num_blocks, ctx, err_blk);
		return dif_strip_copy(&src_sgl, &dst_sgl, num_blocks, ctx, err_blk);
	} else {
		return dif_verify_copy_split(&src_sgl, &dst_sgl, num_blocks, ctx, err_blk);
		return dif_strip_copy_split(&src_sgl, &dst_sgl, num_blocks, ctx, err_blk);
	}
}