blob_ut: fix bs_dev_common for dev blocklen != SPDK_BS_PAGE SIZE

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I396d5a7c3d2d736b5763d4c79284ed7483e2dce1

Reviewed-on: https://review.gerrithub.io/417704
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Piotr Pelplinski 2018-07-03 14:36:14 +02:00 committed by Jim Harris
parent 889ee6194a
commit 32f35c169e

View File

@ -82,8 +82,8 @@ dev_read(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload
{
uint64_t offset, length;
offset = lba * DEV_BUFFER_BLOCKLEN;
length = lba_count * DEV_BUFFER_BLOCKLEN;
offset = lba * dev->blocklen;
length = lba_count * dev->blocklen;
SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
memcpy(payload, &g_dev_buffer[offset], length);
spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
@ -96,8 +96,8 @@ dev_write(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payloa
{
uint64_t offset, length;
offset = lba * DEV_BUFFER_BLOCKLEN;
length = lba_count * DEV_BUFFER_BLOCKLEN;
offset = lba * dev->blocklen;
length = lba_count * dev->blocklen;
SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
memcpy(&g_dev_buffer[offset], payload, length);
spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
@ -124,8 +124,8 @@ dev_readv(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
uint64_t offset, length;
int i;
offset = lba * DEV_BUFFER_BLOCKLEN;
length = lba_count * DEV_BUFFER_BLOCKLEN;
offset = lba * dev->blocklen;
length = lba_count * dev->blocklen;
SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
__check_iov(iov, iovcnt, length);
@ -146,8 +146,8 @@ dev_writev(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
uint64_t offset, length;
int i;
offset = lba * DEV_BUFFER_BLOCKLEN;
length = lba_count * DEV_BUFFER_BLOCKLEN;
offset = lba * dev->blocklen;
length = lba_count * dev->blocklen;
SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
__check_iov(iov, iovcnt, length);
@ -173,8 +173,8 @@ dev_unmap(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
{
uint64_t offset, length;
offset = lba * DEV_BUFFER_BLOCKLEN;
length = lba_count * DEV_BUFFER_BLOCKLEN;
offset = lba * dev->blocklen;
length = lba_count * dev->blocklen;
SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
memset(&g_dev_buffer[offset], 0, length);
spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);
@ -187,8 +187,8 @@ dev_write_zeroes(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
{
uint64_t offset, length;
offset = lba * DEV_BUFFER_BLOCKLEN;
length = lba_count * DEV_BUFFER_BLOCKLEN;
offset = lba * dev->blocklen;
length = lba_count * dev->blocklen;
SPDK_CU_ASSERT_FATAL(offset + length <= DEV_BUFFER_SIZE);
memset(&g_dev_buffer[offset], 0, length);
spdk_thread_send_msg(spdk_get_thread(), dev_complete, cb_args);