Skip to content

Commit

Permalink
Fix bbssd I/O processing
Browse files Browse the repository at this point in the history
  • Loading branch information
huaicheng committed Oct 12, 2021
1 parent 2748796 commit 1715760
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
11 changes: 7 additions & 4 deletions hw/block/femu/bbssd/ftl.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,15 +884,18 @@ static void *ftl_thread(void *arg)
}

ftl_assert(req);
switch (req->is_write) {
case 1:
switch (req->cmd.opcode) {
case NVME_CMD_WRITE:
lat = ssd_write(ssd, req);
break;
case 0:
case NVME_CMD_READ:
lat = ssd_read(ssd, req);
break;
case NVME_CMD_DSM:
break;
default:
ftl_err("FTL received unkown request type, ERROR\n");
//ftl_err("FTL received unkown request type, ERROR\n");
;
}

req->reqlat = lat;
Expand Down
19 changes: 1 addition & 18 deletions hw/block/femu/nvme-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,6 @@ static inline void nvme_copy_cmd(NvmeCmd *dst, NvmeCmd *src)
#endif
}

/*
* For now, only the I/Os which needs delay emulation will be handled by the
* FEMU thread
*/
static bool should_emulate_delay(NvmeCmd *cmd)
{
int opc = cmd->opcode;

if (opc == NVME_CMD_READ || opc == NVME_CMD_WRITE ||
opc == NVME_CMD_OC_ERASE || opc == NVME_CMD_OC_WRITE ||
opc == NVME_CMD_OC_READ) {
return true;
}

return false;
}

static void nvme_process_sq_io(void *opaque, int index_poller)
{
NvmeSQueue *sq = opaque;
Expand Down Expand Up @@ -90,7 +73,7 @@ static void nvme_process_sq_io(void *opaque, int index_poller)
}

status = nvme_io_cmd(n, &cmd, req);
if (should_emulate_delay(&cmd) && status == NVME_SUCCESS) {
if (1 && status == NVME_SUCCESS) {
req->status = status;

int rc = femu_ring_enqueue(n->to_ftl[index_poller], (void *)&req, 1);
Expand Down

0 comments on commit 1715760

Please sign in to comment.