test: remove unnecessary indirection in bdev_io test functions
Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I43dec4387dff82d18a6ca03a21b807370e507256
This commit is contained in:
parent
f93bb8a32d
commit
ac6e76991d
@ -130,7 +130,7 @@ check_io_completion(void)
|
||||
struct iovec iov;
|
||||
|
||||
static int
|
||||
blockdev_write(struct io_target *target, void *bdev_task_ctx, char **tx_buf,
|
||||
blockdev_write(struct io_target *target, void *bdev_task_ctx, char *tx_buf,
|
||||
uint64_t offset, int data_len)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io;
|
||||
@ -138,7 +138,7 @@ blockdev_write(struct io_target *target, void *bdev_task_ctx, char **tx_buf,
|
||||
complete = 0;
|
||||
completion_status_per_io = SPDK_BDEV_IO_STATUS_FAILED;
|
||||
|
||||
iov.iov_base = *tx_buf;
|
||||
iov.iov_base = tx_buf;
|
||||
iov.iov_len = data_len;
|
||||
bdev_io = spdk_bdev_writev(target->bdev, &iov, 1, (uint64_t)offset,
|
||||
iov.iov_len, quick_test_complete,
|
||||
@ -151,7 +151,7 @@ blockdev_write(struct io_target *target, void *bdev_task_ctx, char **tx_buf,
|
||||
}
|
||||
|
||||
static int
|
||||
blockdev_read(struct io_target *target, void *bdev_task_ctx, char **rx_buf,
|
||||
blockdev_read(struct io_target *target, void *bdev_task_ctx, char *rx_buf,
|
||||
uint64_t offset, int data_len)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io;
|
||||
@ -159,7 +159,7 @@ blockdev_read(struct io_target *target, void *bdev_task_ctx, char **rx_buf,
|
||||
complete = 0;
|
||||
completion_status_per_io = SPDK_BDEV_IO_STATUS_FAILED;
|
||||
|
||||
bdev_io = spdk_bdev_read(target->bdev, *rx_buf, offset, data_len,
|
||||
bdev_io = spdk_bdev_read(target->bdev, rx_buf, offset, data_len,
|
||||
quick_test_complete, bdev_task_ctx);
|
||||
|
||||
if (!bdev_io) {
|
||||
@ -170,13 +170,13 @@ blockdev_read(struct io_target *target, void *bdev_task_ctx, char **rx_buf,
|
||||
}
|
||||
|
||||
static int
|
||||
blockdev_write_read_data_match(char **rx_buf, char **tx_buf, int data_length)
|
||||
blockdev_write_read_data_match(char *rx_buf, char *tx_buf, int data_length)
|
||||
{
|
||||
int rc;
|
||||
rc = memcmp(*rx_buf, *tx_buf, data_length);
|
||||
rc = memcmp(rx_buf, tx_buf, data_length);
|
||||
|
||||
rte_free(*rx_buf);
|
||||
rte_free(*tx_buf);
|
||||
rte_free(rx_buf);
|
||||
rte_free(tx_buf);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -201,7 +201,7 @@ blockdev_write_read(uint32_t data_length, int pattern, uint64_t offset,
|
||||
initialize_buffer(&tx_buf, pattern, data_length);
|
||||
initialize_buffer(&rx_buf, 0, data_length);
|
||||
|
||||
rc = blockdev_write(target, (void *)bdev_task_ctx, &tx_buf,
|
||||
rc = blockdev_write(target, (void *)bdev_task_ctx, tx_buf,
|
||||
offset, data_length);
|
||||
|
||||
/* Assert the rc of the respective blockdev */
|
||||
@ -216,7 +216,7 @@ blockdev_write_read(uint32_t data_length, int pattern, uint64_t offset,
|
||||
CU_ASSERT_EQUAL(completion_status_per_io, SPDK_BDEV_IO_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
rc = blockdev_read(target, (void *)bdev_task_ctx, &rx_buf,
|
||||
rc = blockdev_read(target, (void *)bdev_task_ctx, rx_buf,
|
||||
offset, data_length);
|
||||
|
||||
/* Assert the rc of the respective blockdev */
|
||||
@ -232,7 +232,7 @@ blockdev_write_read(uint32_t data_length, int pattern, uint64_t offset,
|
||||
}
|
||||
|
||||
if (completion_status_per_io == SPDK_BDEV_IO_STATUS_SUCCESS) {
|
||||
rc = blockdev_write_read_data_match(&rx_buf, &tx_buf, data_length);
|
||||
rc = blockdev_write_read_data_match(rx_buf, tx_buf, data_length);
|
||||
/* Assert the write by comparing it with values read
|
||||
* from each blockdev */
|
||||
CU_ASSERT_EQUAL(rc, 0);
|
||||
@ -345,7 +345,7 @@ blockdev_write_read_offset_plus_nbytes_equals_bdev_size(void)
|
||||
initialize_buffer(&tx_buf, 0xA3, bdev->blocklen);
|
||||
initialize_buffer(&rx_buf, 0, bdev->blocklen);
|
||||
|
||||
rc = blockdev_write(target, (void *)bdev_task_ctx, &tx_buf,
|
||||
rc = blockdev_write(target, (void *)bdev_task_ctx, tx_buf,
|
||||
offset, bdev->blocklen);
|
||||
|
||||
/* Assert the rc of the respective blockdev */
|
||||
@ -356,7 +356,7 @@ blockdev_write_read_offset_plus_nbytes_equals_bdev_size(void)
|
||||
check_io_completion();
|
||||
CU_ASSERT_EQUAL(completion_status_per_io, SPDK_BDEV_IO_STATUS_SUCCESS);
|
||||
|
||||
rc = blockdev_read(target, (void *)bdev_task_ctx, &rx_buf,
|
||||
rc = blockdev_read(target, (void *)bdev_task_ctx, rx_buf,
|
||||
offset, bdev->blocklen);
|
||||
|
||||
/* Assert the rc of the respective blockdev */
|
||||
@ -367,7 +367,7 @@ blockdev_write_read_offset_plus_nbytes_equals_bdev_size(void)
|
||||
check_io_completion();
|
||||
CU_ASSERT_EQUAL(completion_status_per_io, SPDK_BDEV_IO_STATUS_SUCCESS);
|
||||
|
||||
rc = blockdev_write_read_data_match(&rx_buf, &tx_buf, bdev->blocklen);
|
||||
rc = blockdev_write_read_data_match(rx_buf, tx_buf, bdev->blocklen);
|
||||
/* Assert the write by comparing it with values read
|
||||
* from each blockdev */
|
||||
CU_ASSERT_EQUAL(rc, 0);
|
||||
@ -410,7 +410,7 @@ blockdev_write_read_offset_plus_nbytes_gt_bdev_size(void)
|
||||
initialize_buffer(&tx_buf, pattern, data_length);
|
||||
initialize_buffer(&rx_buf, 0, data_length);
|
||||
|
||||
rc = blockdev_write(target, (void *)bdev_task_ctx, &tx_buf,
|
||||
rc = blockdev_write(target, (void *)bdev_task_ctx, tx_buf,
|
||||
offset, data_length);
|
||||
|
||||
/* Assert the rc of the respective blockdev */
|
||||
@ -420,7 +420,7 @@ blockdev_write_read_offset_plus_nbytes_gt_bdev_size(void)
|
||||
* and the completion_status_per_io is SPDK_BDEV_IO_STATUS_FAILED */
|
||||
CU_ASSERT_EQUAL(completion_status_per_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||
|
||||
rc = blockdev_read(target, (void *)bdev_task_ctx, &rx_buf,
|
||||
rc = blockdev_read(target, (void *)bdev_task_ctx, rx_buf,
|
||||
offset, data_length);
|
||||
|
||||
/* Assert the rc of the respective blockdev */
|
||||
|
Loading…
Reference in New Issue
Block a user