dif: Rename parameters of dif_generate_stream to match related APIs
using data_offset and data_len is consistent with related APIs, and is done in this patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ic9d216e25880f7b5ab33b764f45d332c090fa88c Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456291 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
6d156d5b7d
commit
3894a7bc68
@ -305,13 +305,13 @@ int spdk_dif_set_md_interleave_iovs(struct iovec *iovs, int iovcnt,
|
|||||||
*
|
*
|
||||||
* \param iovs iovec array describing the extended LBA payload.
|
* \param iovs iovec array describing the extended LBA payload.
|
||||||
* \param iovcnt Number of elements in the iovec array.
|
* \param iovcnt Number of elements in the iovec array.
|
||||||
* \param offset Offset to the newly read data in the extended LBA payload.
|
* \param data_offset Offset to the newly read data in the extended LBA payload.
|
||||||
* \param read_len Length of the newly read data in the extended LBA payload.
|
* \param data_len Length of the newly read data in the extended LBA payload.
|
||||||
* \param ctx DIF context.
|
* \param ctx DIF context.
|
||||||
*
|
*
|
||||||
* \return 0 on success and negated errno otherwise.
|
* \return 0 on success and negated errno otherwise.
|
||||||
*/
|
*/
|
||||||
int spdk_dif_generate_stream(struct iovec *iovs, int iovcnt,
|
int spdk_dif_generate_stream(struct iovec *iovs, int iovcnt,
|
||||||
uint32_t offset, uint32_t read_len,
|
uint32_t data_offset, uint32_t data_len,
|
||||||
const struct spdk_dif_ctx *ctx);
|
const struct spdk_dif_ctx *ctx);
|
||||||
#endif /* SPDK_DIF_H */
|
#endif /* SPDK_DIF_H */
|
||||||
|
@ -1502,7 +1502,7 @@ spdk_dif_set_md_interleave_iovs(struct iovec *iovs, int iovcnt,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
dif_generate_stream(uint8_t *buf, uint32_t buf_len,
|
dif_generate_stream(uint8_t *buf, uint32_t buf_len,
|
||||||
uint32_t offset, uint32_t read_len,
|
uint32_t data_offset, uint32_t data_len,
|
||||||
const struct spdk_dif_ctx *ctx)
|
const struct spdk_dif_ctx *ctx)
|
||||||
{
|
{
|
||||||
uint32_t data_block_size, offset_blocks, num_blocks, i;
|
uint32_t data_block_size, offset_blocks, num_blocks, i;
|
||||||
@ -1510,17 +1510,17 @@ dif_generate_stream(uint8_t *buf, uint32_t buf_len,
|
|||||||
|
|
||||||
data_block_size = ctx->block_size - ctx->md_size;
|
data_block_size = ctx->block_size - ctx->md_size;
|
||||||
|
|
||||||
offset_blocks = offset / data_block_size;
|
offset_blocks = data_offset / data_block_size;
|
||||||
read_len += offset % data_block_size;
|
data_len += data_offset % data_block_size;
|
||||||
|
|
||||||
offset = offset_blocks * ctx->block_size;
|
data_offset = offset_blocks * ctx->block_size;
|
||||||
num_blocks = read_len / data_block_size;
|
num_blocks = data_len / data_block_size;
|
||||||
|
|
||||||
if (offset + num_blocks * ctx->block_size > buf_len) {
|
if (data_offset + num_blocks * ctx->block_size > buf_len) {
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf += offset;
|
buf += data_offset;
|
||||||
|
|
||||||
for (i = 0; i < num_blocks; i++) {
|
for (i = 0; i < num_blocks; i++) {
|
||||||
if (ctx->dif_flags & SPDK_DIF_FLAGS_GUARD_CHECK) {
|
if (ctx->dif_flags & SPDK_DIF_FLAGS_GUARD_CHECK) {
|
||||||
@ -1537,7 +1537,7 @@ dif_generate_stream(uint8_t *buf, uint32_t buf_len,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
dif_generate_stream_split(struct iovec *iovs, int iovcnt,
|
dif_generate_stream_split(struct iovec *iovs, int iovcnt,
|
||||||
uint32_t offset, uint32_t read_len,
|
uint32_t data_offset, uint32_t data_len,
|
||||||
const struct spdk_dif_ctx *ctx)
|
const struct spdk_dif_ctx *ctx)
|
||||||
{
|
{
|
||||||
uint32_t data_block_size, offset_blocks, num_blocks, i;
|
uint32_t data_block_size, offset_blocks, num_blocks, i;
|
||||||
@ -1545,19 +1545,19 @@ dif_generate_stream_split(struct iovec *iovs, int iovcnt,
|
|||||||
|
|
||||||
data_block_size = ctx->block_size - ctx->md_size;
|
data_block_size = ctx->block_size - ctx->md_size;
|
||||||
|
|
||||||
offset_blocks = offset / data_block_size;
|
offset_blocks = data_offset / data_block_size;
|
||||||
read_len += offset % data_block_size;
|
data_len += data_offset % data_block_size;
|
||||||
|
|
||||||
offset = offset_blocks * ctx->block_size;
|
data_offset = offset_blocks * ctx->block_size;
|
||||||
num_blocks = read_len / data_block_size;
|
num_blocks = data_len / data_block_size;
|
||||||
|
|
||||||
_dif_sgl_init(&sgl, iovs, iovcnt);
|
_dif_sgl_init(&sgl, iovs, iovcnt);
|
||||||
|
|
||||||
if (!_dif_sgl_is_valid(&sgl, offset + num_blocks * ctx->block_size)) {
|
if (!_dif_sgl_is_valid(&sgl, data_offset + num_blocks * ctx->block_size)) {
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dif_sgl_advance(&sgl, offset);
|
_dif_sgl_advance(&sgl, data_offset);
|
||||||
|
|
||||||
for (i = 0; i < num_blocks; i++) {
|
for (i = 0; i < num_blocks; i++) {
|
||||||
_dif_generate_split(&sgl, offset_blocks + i, ctx);
|
_dif_generate_split(&sgl, offset_blocks + i, ctx);
|
||||||
@ -1568,7 +1568,7 @@ dif_generate_stream_split(struct iovec *iovs, int iovcnt,
|
|||||||
|
|
||||||
int
|
int
|
||||||
spdk_dif_generate_stream(struct iovec *iovs, int iovcnt,
|
spdk_dif_generate_stream(struct iovec *iovs, int iovcnt,
|
||||||
uint32_t offset, uint32_t read_len,
|
uint32_t data_offset, uint32_t data_len,
|
||||||
const struct spdk_dif_ctx *ctx)
|
const struct spdk_dif_ctx *ctx)
|
||||||
{
|
{
|
||||||
if (iovs == NULL || iovcnt == 0) {
|
if (iovs == NULL || iovcnt == 0) {
|
||||||
@ -1577,8 +1577,8 @@ spdk_dif_generate_stream(struct iovec *iovs, int iovcnt,
|
|||||||
|
|
||||||
if (iovcnt == 1) {
|
if (iovcnt == 1) {
|
||||||
return dif_generate_stream(iovs[0].iov_base, iovs[0].iov_len,
|
return dif_generate_stream(iovs[0].iov_base, iovs[0].iov_len,
|
||||||
offset, read_len, ctx);
|
data_offset, data_len, ctx);
|
||||||
} else {
|
} else {
|
||||||
return dif_generate_stream_split(iovs, iovcnt, offset, read_len, ctx);
|
return dif_generate_stream_split(iovs, iovcnt, data_offset, data_len, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user