Skip to content

Commit

Permalink
level 4.3.2580
Browse files Browse the repository at this point in the history
-includes unmap support
  • Loading branch information
vageline committed Oct 17, 2017
1 parent 32847ad commit 77703da
Show file tree
Hide file tree
Showing 49 changed files with 1,562 additions and 827 deletions.
2 changes: 1 addition & 1 deletion config.aix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ else
TESTGEN = ${ROOTPATH}/src/usr/cxxtest/cxxtestgen.pl
endif

INCDIR = ${ROOTPATH}/src/include /usr/include /usr/include/sys .
INCDIR = . ${ROOTPATH}/src/include /usr/include /usr/include/sys
_INCDIRS = ${INCDIR} ${EXTRAINCDIR}
INCFLAGS = $(addprefix -I, ${_INCDIRS} )
ASMINCFLAGS = $(addprefix $(lastword -Wa,-I), ${_INCDIRS})
Expand Down
2 changes: 1 addition & 1 deletion config.linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ endif
ASMFLAGS = ${COMMONFLAGS}
CXXFLAGS += ${CFLAGS} -fno-rtti -fno-exceptions -Wall

INCDIR = ${ROOTPATH}/src/include . /usr/include /usr/include/misc
INCDIR = . ${ROOTPATH}/src/include /usr/include /usr/include/misc
_INCDIRS = ${INCDIR} ${EXTRAINCDIR}
INCFLAGS = $(addprefix -I, ${_INCDIRS} )
ASMINCFLAGS = $(addprefix $(lastword -Wa,-I), ${_INCDIRS})
Expand Down
5 changes: 3 additions & 2 deletions debian/cxlflash.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ libarkdb-0.so cxlflash #MINVER#
am_malloc@Base 4.3~
am_realloc@Base 4.3~
ardes@Base 4.3~
ari_active@Base 4.3~
ark_actual@Base 4.3~
ark_allocated@Base 4.3~
ark_anyreturn@Base 4.3~
Expand Down Expand Up @@ -96,6 +95,8 @@ libarkdb-0.so cxlflash #MINVER#
bl_len@Base 4.3~
bl_new@Base 4.3~
bl_next@Base 4.3~
bls_add@Base 4.3~
bls_rem@Base 4.3~
bl_rechain@Base 4.3~
bl_release@Base 4.3~
bl_reserve@Base 4.3~
Expand All @@ -122,7 +123,6 @@ libarkdb-0.so cxlflash #MINVER#
bv_get@Base 4.3~
bv_new@Base 4.3~
bv_set@Base 4.3~
c_strings@Base 4.3~
check_alloc_error_injects@Base 4.3~
check_harv_error_injects@Base 4.3~
check_sched_error_injects@Base 4.3~
Expand Down Expand Up @@ -164,6 +164,7 @@ libarkdb-0.so cxlflash #MINVER#
pAT@Base 4.3~
pool_function@Base 4.3~
popcount@Base 4.3~
process_unmapQ@Base 4.3~
ptr_align@Base 4.3~
queue_deq@Base 4.3~
queue_deq_unsafe@Base 4.3~
Expand Down
38 changes: 33 additions & 5 deletions src/block/bin/blockio.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ typedef struct
uint64_t tlat_rd;
uint64_t tlat_wr;
uint32_t tmiss;
uint32_t unmap;
size_t lba;
size_t last_lba;
uint32_t nblocks;
Expand All @@ -135,6 +136,7 @@ uint32_t COMP = 0;
uint32_t eto = 1000000;
uint32_t lto = 10000;
uint32_t hbar = 0;
uint32_t UNMAP = 0;
double ns_per_tick = 0;

/**
Expand Down Expand Up @@ -317,8 +319,16 @@ void run_async(SGDEV_t *dev)
*----------------------------------------------------------------*/
for (i=0; i<QD && TIME && dev->WR && dev->issN<QD; i++)
{
rc = cblk_awrite(dev->id, dev->wbuf, dev->lba, dev->nblocks,
&rtag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
if (dev->unmap)
{
rc = cblk_aunmap(dev->id, dev->wbuf, dev->lba, dev->nblocks,
&rtag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
}
else
{
rc = cblk_awrite(dev->id, dev->wbuf, dev->lba, dev->nblocks,
&rtag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
}
if (0 == rc) {OP_BEG(dev,(dev->op+rtag),WRITE);}
else if (EBUSY == errno) {break;}
else {IO_ISS_ERR(WRITE);}
Expand Down Expand Up @@ -420,12 +430,13 @@ int main(int argc, char **argv)
uint32_t tmiss = 0;
uint32_t esecs = 0;
uint64_t sticks = 0;
pthread_t pth[8];
chunk_attrs_t attrs;
pthread_t pth[32];

/*--------------------------------------------------------------------------
* process and verify input parms
*------------------------------------------------------------------------*/
while (FF != (c=getopt(argc, argv, "d:r:q:n:s:e:S:R:l:phivD")))
while (FF != (c=getopt(argc, argv, "d:r:q:n:s:e:S:R:l:phivUD")))
{
switch (c)
{
Expand All @@ -441,6 +452,7 @@ int main(int argc, char **argv)
case 'p': plun = 1; break;
case 'i': intrp_thds = 1; break;
case 'D': DEBUG = 1; break;
case 'U': UNMAP = 1; break;
case 'v': verbose = 1; break;
case 'h':
case '?': usage(); break;
Expand Down Expand Up @@ -520,7 +532,8 @@ int main(int argc, char **argv)
_4K*nblocks, rc);
exit(0);
}
memset(devs[i].wbuf,0x79,_4K*nblocks);
if (UNMAP) {memset(devs[i].wbuf,0, _4K*nblocks);}
else {memset(devs[i].wbuf,0x79,_4K*nblocks);}
}

/*--------------------------------------------------------------------------
Expand Down Expand Up @@ -567,6 +580,19 @@ int main(int argc, char **argv)
exit(errno);
}
}

if (UNMAP)
{
dev->unmap = 1;
bzero(&attrs, sizeof(attrs));
cblk_get_attrs(dev->id, &attrs, 0);
if (!(attrs.flags1 & CFLSH_ATTR_UNMAP))
{
printf("%s: unmap is not supported\n", devStrs[i]);
dev->unmap=0;
}
}

debug("open: %s dev:%p id:%d nblks:%ld\n",
devStrs[i],dev, dev->id, dev->last_lba+1);

Expand Down Expand Up @@ -617,6 +643,7 @@ int main(int argc, char **argv)
/*--------------------------------------------------------------------------
* print IO stats
*------------------------------------------------------------------------*/
if (cnt==0) {goto cleanup;}
printf("r:%d q:%d s:%d p:%d n:%d i:%d v:%d eto:%d miss:%d/%d \
lat:%d mbps:%d iops:%d",
nRD, QD, nsecs, plun, nblocks,
Expand All @@ -630,6 +657,7 @@ lat:%d mbps:%d iops:%d",
(uint32_t)((tlat_wr*ns_per_tick)/cnt_wr/1000));}
printf("\n"); fflush(stdout);

cleanup:
/*--------------------------------------------------------------------------
* cleanup
*------------------------------------------------------------------------*/
Expand Down
22 changes: 13 additions & 9 deletions src/block/cflash_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ int cblk_build_issue_rw_cmd(cflsh_chunk_t *chunk, int *cmd_index, void *buf,cfla
cflsh_async_thread_cmp_t *async_data;
#endif
cflsh_cmd_mgm_t *cmd = NULL;
size_t buf_len=0;

CFLASH_BLOCK_LOCK(chunk->lock);

Expand Down Expand Up @@ -931,22 +932,25 @@ int cblk_build_issue_rw_cmd(cflsh_chunk_t *chunk, int *cmd_index, void *buf,cfla

if (op_code == SCSI_READ_16) {

local_flags = CFLASH_READ_DIR_OP;
chunk->cmd_info[cmd->index].flags |= CFLSH_MODE_READ;
buf_len = CAPI_FLASH_BLOCK_SIZE * nblocks;
local_flags = CFLASH_READ_DIR_OP;
chunk->cmd_info[cmd->index].flags |= CFLSH_MODE_READ;

} else if (op_code == SCSI_WRITE_16) {

local_flags = CFLASH_WRITE_DIR_OP;
chunk->cmd_info[cmd->index].flags |= CFLSH_MODE_WRITE;

buf_len = CAPI_FLASH_BLOCK_SIZE * nblocks;
local_flags = CFLASH_WRITE_DIR_OP;
chunk->cmd_info[cmd->index].flags |= CFLSH_MODE_WRITE;

} else if (op_code == SCSI_WRITE_SAME_16) {

local_flags = CFLASH_WRITE_DIR_OP;
chunk->cmd_info[cmd->index].flags |= CFLSH_MODE_WRITE;

buf_len = CAPI_FLASH_BLOCK_SIZE;
local_flags = CFLASH_WRITE_DIR_OP;
chunk->cmd_info[cmd->index].flags |= CFLSH_MODE_WRITE;

}

CBLK_BUILD_ADAP_CMD(chunk,cmd,buf,(CAPI_FLASH_BLOCK_SIZE * nblocks),local_flags);
CBLK_BUILD_ADAP_CMD(chunk,cmd,buf,buf_len,local_flags);


cdb = CBLK_GET_CMD_CDB(chunk,cmd);
Expand Down
189 changes: 189 additions & 0 deletions src/block/test/fvt_block.C
Original file line number Diff line number Diff line change
Expand Up @@ -6053,6 +6053,195 @@ TEST(Block_FVT_Suite, BLK_API_FVT_plun_polling_unmap_rw_tst)
}
}

/**
********************************************************************************
** \brief
*******************************************************************************/
TEST(Block_FVT_Suite, BLK_API_FVT_plun_unmap_BIG_BLOCKS)
{
int open_flags=0;
chunk_id_t id = 0;
int flags = 0;
int max_reqs = 64;
int er_no = 0;
int open_cnt = 1;
int ret = 0;
size_t temp_sz = 64*1024; // 16 unmap cmds, 256mb
int blks = 4096;
chunk_attrs_t attrs;

ASSERT_EQ(0,blk_fvt_setup(1));

blk_open_tst(&id, max_reqs, &er_no, open_cnt, open_flags, mode);
ASSERT_NE(NULL_CHUNK_ID, id);

bzero(&attrs, sizeof(attrs));
ret = cblk_get_attrs(id, &attrs, 0);
ASSERT_EQ(ret,0);

if (attrs.flags1 & CFLSH_ATTR_UNMAP)
{
char *buf = NULL;
int rc = 0;
int tag = -1;
uint64_t status = 0;

if ((rc=posix_memalign((void**)&buf, 128, 4096*temp_sz)))
{
EXPECT_EQ(rc,0);
goto exit;
}

rc = cblk_write(id, buf, 0, blks, 0);
ASSERT_EQ(blks, rc);
rc = cblk_unmap(id, buf, 0, blks, 0);
ASSERT_EQ(blks, rc);

rc = cblk_awrite(id, buf, 0, blks, &tag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
ASSERT_EQ(0, rc);
rc=cblk_aresult(id, &tag, &status, CBLK_ARESULT_BLOCKING);
ASSERT_EQ(blks, rc);
ASSERT_EQ(0, errno);

rc = cblk_aunmap(id, buf, 0, blks, &tag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
ASSERT_EQ(0, rc);
rc=cblk_aresult(id, &tag, &status, CBLK_ARESULT_BLOCKING);
ASSERT_EQ(blks, rc);
ASSERT_EQ(0, errno);
free(buf);
}
else
{
TESTCASE_SKIP("unmap is not supported");
}

exit:
blk_open_tst_cleanup(flags, &ret,&er_no);
EXPECT_EQ(0, ret);
}

/**
********************************************************************************
** \brief
*******************************************************************************/
TEST(Block_FVT_Suite, BLK_API_FVT_vlun_unmap_scrub_small)
{
int open_flags = CBLK_OPN_VIRT_LUN | CBLK_OPN_SCRUB_DATA;
chunk_id_t id = 0;
int flags = 0;
int max_reqs = 64;
int er_no = 0;
int open_cnt = 1;
int ret = 0;
size_t temp_sz = 5000;
chunk_attrs_t attrs;

ASSERT_EQ(0,blk_fvt_setup(1));

blk_open_tst(&id, max_reqs, &er_no, open_cnt, open_flags, mode);
ASSERT_NE(NULL_CHUNK_ID, id);

bzero(&attrs, sizeof(attrs));
ret = cblk_get_attrs(id, &attrs, 0);
ASSERT_EQ(ret,0);

blk_fvt_get_set_lun_size(id, &temp_sz, 0, 2, &ret,&er_no);
EXPECT_EQ(0, ret);

if (attrs.flags1 & CFLSH_ATTR_UNMAP)
{
char buf[4096] = {0};
int rc = 0;
int tag = -1;
uint64_t status = 0;

rc = cblk_write(id, buf, 0, 1, 0);
ASSERT_EQ(1, rc);
rc = cblk_unmap(id, buf, 0, 1, 0);
ASSERT_EQ(1, rc);

rc = cblk_awrite(id, buf, 0, 1, &tag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
ASSERT_EQ(0, rc);
rc=cblk_aresult(id, &tag, &status, CBLK_ARESULT_BLOCKING);
ASSERT_EQ(1, rc);
ASSERT_EQ(0, errno);

rc = cblk_aunmap(id, buf, 0, 1, &tag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
ASSERT_EQ(0, rc);
rc=cblk_aresult(id, &tag, &status, CBLK_ARESULT_BLOCKING);
ASSERT_EQ(1, rc);
ASSERT_EQ(0, errno);
}
else
{
TESTCASE_SKIP("unmap is not supported");
}

blk_open_tst_cleanup(flags, &ret,&er_no);
EXPECT_EQ(0, ret);
}

/**
********************************************************************************
** \brief
*******************************************************************************/
TEST(Block_FVT_Suite, BLK_API_FVT_vlun_unmap_scrub_big)
{
int open_flags = CBLK_OPN_VIRT_LUN | CBLK_OPN_SCRUB_DATA;
chunk_id_t id = 0;
int flags = 0;
int max_reqs = 64;
int er_no = 0;
int open_cnt = 1;
int ret = 0;
size_t temp_sz = 500000;
chunk_attrs_t attrs;

ASSERT_EQ(0,blk_fvt_setup(1));

blk_open_tst(&id, max_reqs, &er_no, open_cnt, open_flags, mode);
ASSERT_NE(NULL_CHUNK_ID, id);

bzero(&attrs, sizeof(attrs));
ret = cblk_get_attrs(id, &attrs, 0);
ASSERT_EQ(ret,0);

blk_fvt_get_set_lun_size(id, &temp_sz, 0, 2, &ret,&er_no);
EXPECT_EQ(0, ret);

if (attrs.flags1 & CFLSH_ATTR_UNMAP)
{
char buf[4096] = {0};
int rc = 0;
int tag = -1;
uint64_t status = 0;

rc = cblk_write(id, buf, 0, 1, 0);
ASSERT_EQ(1, rc);
rc = cblk_unmap(id, buf, 0, 1, 0);
ASSERT_EQ(1, rc);

rc = cblk_awrite(id, buf, 0, 1, &tag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
ASSERT_EQ(0, rc);
rc=cblk_aresult(id, &tag, &status, CBLK_ARESULT_BLOCKING);
ASSERT_EQ(1, rc);
ASSERT_EQ(0, errno);

rc = cblk_aunmap(id, buf, 0, 1, &tag, NULL, CBLK_ARW_WAIT_CMD_FLAGS);
ASSERT_EQ(0, rc);
rc=cblk_aresult(id, &tag, &status, CBLK_ARESULT_BLOCKING);
ASSERT_EQ(1, rc);
ASSERT_EQ(0, errno);
}
else
{
TESTCASE_SKIP("unmap is not supported");
}

blk_open_tst_cleanup(flags, &ret,&er_no);
EXPECT_EQ(0, ret);
}

TEST(Block_FVT_Suite, BLK_API_FVT_plun_blocking_perf_test)
{

Expand Down
Loading

0 comments on commit 77703da

Please sign in to comment.