hw/block/nvme: replace nvme_ns_status
The inline nvme_ns_status() helper only has a single call site. Remove it from the header file and inline it for real. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
de482d1fad
commit
0c76fee2f8
@ -3609,8 +3609,8 @@ static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req)
|
|||||||
|
|
||||||
static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
|
static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
|
||||||
{
|
{
|
||||||
|
NvmeNamespace *ns;
|
||||||
uint32_t nsid = le32_to_cpu(req->cmd.nsid);
|
uint32_t nsid = le32_to_cpu(req->cmd.nsid);
|
||||||
uint16_t status;
|
|
||||||
|
|
||||||
trace_pci_nvme_io_cmd(nvme_cid(req), nsid, nvme_sqid(req),
|
trace_pci_nvme_io_cmd(nvme_cid(req), nsid, nvme_sqid(req),
|
||||||
req->cmd.opcode, nvme_io_opc_str(req->cmd.opcode));
|
req->cmd.opcode, nvme_io_opc_str(req->cmd.opcode));
|
||||||
@ -3642,21 +3642,22 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
|
|||||||
return nvme_flush(n, req);
|
return nvme_flush(n, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
req->ns = nvme_ns(n, nsid);
|
ns = nvme_ns(n, nsid);
|
||||||
if (unlikely(!req->ns)) {
|
if (unlikely(!ns)) {
|
||||||
return NVME_INVALID_FIELD | NVME_DNR;
|
return NVME_INVALID_FIELD | NVME_DNR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(req->ns->iocs[req->cmd.opcode] & NVME_CMD_EFF_CSUPP)) {
|
if (!(ns->iocs[req->cmd.opcode] & NVME_CMD_EFF_CSUPP)) {
|
||||||
trace_pci_nvme_err_invalid_opc(req->cmd.opcode);
|
trace_pci_nvme_err_invalid_opc(req->cmd.opcode);
|
||||||
return NVME_INVALID_OPCODE | NVME_DNR;
|
return NVME_INVALID_OPCODE | NVME_DNR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = nvme_ns_status(req->ns);
|
if (ns->status) {
|
||||||
if (unlikely(status)) {
|
return ns->status;
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req->ns = ns;
|
||||||
|
|
||||||
switch (req->cmd.opcode) {
|
switch (req->cmd.opcode) {
|
||||||
case NVME_CMD_WRITE_ZEROES:
|
case NVME_CMD_WRITE_ZEROES:
|
||||||
return nvme_write_zeroes(n, req);
|
return nvme_write_zeroes(n, req);
|
||||||
|
@ -137,11 +137,6 @@ typedef struct NvmeNamespace {
|
|||||||
} features;
|
} features;
|
||||||
} NvmeNamespace;
|
} NvmeNamespace;
|
||||||
|
|
||||||
static inline uint16_t nvme_ns_status(NvmeNamespace *ns)
|
|
||||||
{
|
|
||||||
return ns->status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t nvme_nsid(NvmeNamespace *ns)
|
static inline uint32_t nvme_nsid(NvmeNamespace *ns)
|
||||||
{
|
{
|
||||||
if (ns) {
|
if (ns) {
|
||||||
|
Loading…
Reference in New Issue
Block a user