test-tool: fix async read/write test for bs != 512

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
This commit is contained in:
Khazhismel Kumykov
2019-07-12 18:03:14 -07:00
committed by Ronnie Sahlberg
parent eea5d3ba8e
commit 08cd206c4a
2 changed files with 10 additions and 12 deletions

View File

@@ -60,11 +60,10 @@ test_async_read(void)
{
int i, ret;
struct tests_async_read_state state = { 0, 0, 0 };
const int blocksize = 512;
const int blocks_per_io = 8;
const int num_ios = 1000;
/* IOs in flight concurrently, so need a buffer large enough for all */
unsigned char *buf = calloc(blocksize * blocks_per_io, num_ios);
unsigned char *buf = calloc(block_size * blocks_per_io, num_ios);
CU_ASSERT_NOT_EQUAL(buf, NULL);
if (!buf)
@@ -87,13 +86,13 @@ test_async_read(void)
uint32_t lba = i * blocks_per_io;
struct scsi_task *atask;
atask = scsi_cdb_read10(lba, blocks_per_io * blocksize,
blocksize, 0, 0, 0, 0, 0);
atask = scsi_cdb_read10(lba, blocks_per_io * block_size,
block_size, 0, 0, 0, 0, 0);
CU_ASSERT_PTR_NOT_NULL_FATAL(atask);
ret = scsi_task_add_data_in_buffer(atask,
blocks_per_io * blocksize,
&buf[lba * blocksize]);
blocks_per_io * block_size,
&buf[lba * block_size]);
CU_ASSERT_EQUAL(ret, 0);
ret = iscsi_scsi_command_async(sd->iscsi_ctx, sd->iscsi_lun,

View File

@@ -59,11 +59,10 @@ test_async_write(void)
{
int i, ret;
struct tests_async_write_state state = { 0, 0, 0 };
int blocksize = 512;
int blocks_per_io = 8;
int num_ios = 1000;
/* IOs in flight concurrently, but all using the same src buffer */
unsigned char buf[blocksize * blocks_per_io];
unsigned char buf[block_size * blocks_per_io];
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
@@ -78,18 +77,18 @@ test_async_write(void)
return;
}
memset(buf, 0, blocksize * blocks_per_io);
memset(buf, 0, block_size * blocks_per_io);
for (i = 0; i < num_ios; i++) {
uint32_t lba = i * blocks_per_io;
struct scsi_task *atask;
atask = scsi_cdb_write10(lba, blocks_per_io * blocksize,
blocksize, 0, 0, 0, 0, 0);
atask = scsi_cdb_write10(lba, blocks_per_io * block_size,
block_size, 0, 0, 0, 0, 0);
CU_ASSERT_PTR_NOT_NULL_FATAL(atask);
ret = scsi_task_add_data_out_buffer(atask,
blocks_per_io * blocksize,
blocks_per_io * block_size,
buf);
CU_ASSERT_EQUAL(ret, 0);