Skip to content

Commit

Permalink
nvme: directly cache command effects log
Browse files Browse the repository at this point in the history
Remove the struct used for tracking known command effects logs in a
list. This is now saved in an xarray that doesn't use these elements.
Instead, store the log directly instead of the wrapper struct.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Keith Busch authored and Christoph Hellwig committed Nov 14, 2020
1 parent 0f0d2c8 commit f6224b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
9 changes: 4 additions & 5 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,7 @@ int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi,
static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
struct nvme_effects_log **log)
{
struct nvme_cel *cel = xa_load(&ctrl->cels, csi);
struct nvme_effects_log *cel = xa_load(&ctrl->cels, csi);
int ret;

if (cel)
Expand All @@ -2940,16 +2940,15 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
return -ENOMEM;

ret = nvme_get_log(ctrl, 0x00, NVME_LOG_CMD_EFFECTS, 0, csi,
&cel->log, sizeof(cel->log), 0);
cel, sizeof(*cel), 0);
if (ret) {
kfree(cel);
return ret;
}

cel->csi = csi;
xa_store(&ctrl->cels, cel->csi, cel, GFP_KERNEL);
xa_store(&ctrl->cels, csi, cel, GFP_KERNEL);
out:
*log = &cel->log;
*log = cel;
return 0;
}

Expand Down
6 changes: 0 additions & 6 deletions drivers/nvme/host/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,6 @@ struct nvme_fault_inject {
#endif
};

struct nvme_cel {
struct list_head entry;
struct nvme_effects_log log;
u8 csi;
};

struct nvme_ctrl {
bool comp_seen;
enum nvme_ctrl_state state;
Expand Down

0 comments on commit f6224b8

Please sign in to comment.