test-tool: fix async read/write test for bs != 512
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
eea5d3ba8e
commit
08cd206c4a
@@ -60,11 +60,10 @@ test_async_read(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
struct tests_async_read_state state = { 0, 0, 0 };
|
struct tests_async_read_state state = { 0, 0, 0 };
|
||||||
const int blocksize = 512;
|
|
||||||
const int blocks_per_io = 8;
|
const int blocks_per_io = 8;
|
||||||
const int num_ios = 1000;
|
const int num_ios = 1000;
|
||||||
/* IOs in flight concurrently, so need a buffer large enough for all */
|
/* 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);
|
CU_ASSERT_NOT_EQUAL(buf, NULL);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
@@ -87,13 +86,13 @@ test_async_read(void)
|
|||||||
uint32_t lba = i * blocks_per_io;
|
uint32_t lba = i * blocks_per_io;
|
||||||
struct scsi_task *atask;
|
struct scsi_task *atask;
|
||||||
|
|
||||||
atask = scsi_cdb_read10(lba, blocks_per_io * blocksize,
|
atask = scsi_cdb_read10(lba, blocks_per_io * block_size,
|
||||||
blocksize, 0, 0, 0, 0, 0);
|
block_size, 0, 0, 0, 0, 0);
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(atask);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(atask);
|
||||||
|
|
||||||
ret = scsi_task_add_data_in_buffer(atask,
|
ret = scsi_task_add_data_in_buffer(atask,
|
||||||
blocks_per_io * blocksize,
|
blocks_per_io * block_size,
|
||||||
&buf[lba * blocksize]);
|
&buf[lba * block_size]);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
ret = iscsi_scsi_command_async(sd->iscsi_ctx, sd->iscsi_lun,
|
ret = iscsi_scsi_command_async(sd->iscsi_ctx, sd->iscsi_lun,
|
||||||
|
|||||||
@@ -59,11 +59,10 @@ test_async_write(void)
|
|||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
struct tests_async_write_state state = { 0, 0, 0 };
|
struct tests_async_write_state state = { 0, 0, 0 };
|
||||||
int blocksize = 512;
|
|
||||||
int blocks_per_io = 8;
|
int blocks_per_io = 8;
|
||||||
int num_ios = 1000;
|
int num_ios = 1000;
|
||||||
/* IOs in flight concurrently, but all using the same src buffer */
|
/* 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_DATALOSS;
|
||||||
CHECK_FOR_SBC;
|
CHECK_FOR_SBC;
|
||||||
@@ -78,18 +77,18 @@ test_async_write(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, blocksize * blocks_per_io);
|
memset(buf, 0, block_size * blocks_per_io);
|
||||||
|
|
||||||
for (i = 0; i < num_ios; i++) {
|
for (i = 0; i < num_ios; i++) {
|
||||||
uint32_t lba = i * blocks_per_io;
|
uint32_t lba = i * blocks_per_io;
|
||||||
struct scsi_task *atask;
|
struct scsi_task *atask;
|
||||||
|
|
||||||
atask = scsi_cdb_write10(lba, blocks_per_io * blocksize,
|
atask = scsi_cdb_write10(lba, blocks_per_io * block_size,
|
||||||
blocksize, 0, 0, 0, 0, 0);
|
block_size, 0, 0, 0, 0, 0);
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(atask);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(atask);
|
||||||
|
|
||||||
ret = scsi_task_add_data_out_buffer(atask,
|
ret = scsi_task_add_data_out_buffer(atask,
|
||||||
blocks_per_io * blocksize,
|
blocks_per_io * block_size,
|
||||||
buf);
|
buf);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user