mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 15:12:07 -06:00
hw/block/nvme: align with existing style
Change status checks to align with the existing style and remove the explicit check against NVME_SUCCESS. Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com> Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com> Reviewed-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
0065f42ef1
commit
74eb89219e
1 changed files with 10 additions and 10 deletions
|
@ -1198,7 +1198,7 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns,
|
||||||
status = nvme_check_zone_state_for_write(zone);
|
status = nvme_check_zone_state_for_write(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
trace_pci_nvme_err_zone_write_not_ok(slba, nlb, status);
|
trace_pci_nvme_err_zone_write_not_ok(slba, nlb, status);
|
||||||
} else {
|
} else {
|
||||||
assert(nvme_wp_is_valid(zone));
|
assert(nvme_wp_is_valid(zone));
|
||||||
|
@ -1253,7 +1253,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba,
|
||||||
uint16_t status;
|
uint16_t status;
|
||||||
|
|
||||||
status = nvme_check_zone_state_for_read(zone);
|
status = nvme_check_zone_state_for_read(zone);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
;
|
;
|
||||||
} else if (unlikely(end > bndry)) {
|
} else if (unlikely(end > bndry)) {
|
||||||
if (!ns->params.cross_zone_read) {
|
if (!ns->params.cross_zone_read) {
|
||||||
|
@ -1266,7 +1266,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba,
|
||||||
do {
|
do {
|
||||||
zone++;
|
zone++;
|
||||||
status = nvme_check_zone_state_for_read(zone);
|
status = nvme_check_zone_state_for_read(zone);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (end > nvme_zone_rd_boundary(ns, zone));
|
} while (end > nvme_zone_rd_boundary(ns, zone));
|
||||||
|
@ -1677,7 +1677,7 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req)
|
||||||
|
|
||||||
if (ns->params.zoned) {
|
if (ns->params.zoned) {
|
||||||
status = nvme_check_zone_read(ns, slba, nlb);
|
status = nvme_check_zone_read(ns, slba, nlb);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status);
|
trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status);
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
@ -1748,12 +1748,12 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
|
||||||
zone = nvme_get_zone_by_slba(ns, slba);
|
zone = nvme_get_zone_by_slba(ns, slba);
|
||||||
|
|
||||||
status = nvme_check_zone_write(n, ns, zone, slba, nlb, append);
|
status = nvme_check_zone_write(n, ns, zone, slba, nlb, append);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = nvme_auto_open_zone(ns, zone);
|
status = nvme_auto_open_zone(ns, zone);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1852,14 +1852,14 @@ static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone,
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case NVME_ZONE_STATE_EMPTY:
|
case NVME_ZONE_STATE_EMPTY:
|
||||||
status = nvme_aor_check(ns, 1, 0);
|
status = nvme_aor_check(ns, 1, 0);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
nvme_aor_inc_active(ns);
|
nvme_aor_inc_active(ns);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case NVME_ZONE_STATE_CLOSED:
|
case NVME_ZONE_STATE_CLOSED:
|
||||||
status = nvme_aor_check(ns, 0, 1);
|
status = nvme_aor_check(ns, 0, 1);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
if (state == NVME_ZONE_STATE_EMPTY) {
|
if (state == NVME_ZONE_STATE_EMPTY) {
|
||||||
nvme_aor_dec_active(ns);
|
nvme_aor_dec_active(ns);
|
||||||
}
|
}
|
||||||
|
@ -1972,7 +1972,7 @@ static uint16_t nvme_set_zd_ext(NvmeNamespace *ns, NvmeZone *zone)
|
||||||
|
|
||||||
if (state == NVME_ZONE_STATE_EMPTY) {
|
if (state == NVME_ZONE_STATE_EMPTY) {
|
||||||
status = nvme_aor_check(ns, 1, 0);
|
status = nvme_aor_check(ns, 1, 0);
|
||||||
if (status != NVME_SUCCESS) {
|
if (status) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
nvme_aor_inc_active(ns);
|
nvme_aor_inc_active(ns);
|
||||||
|
@ -3301,7 +3301,7 @@ static uint16_t nvme_set_feature_timestamp(NvmeCtrl *n, NvmeRequest *req)
|
||||||
|
|
||||||
ret = nvme_dma(n, (uint8_t *)×tamp, sizeof(timestamp),
|
ret = nvme_dma(n, (uint8_t *)×tamp, sizeof(timestamp),
|
||||||
DMA_DIRECTION_TO_DEVICE, req);
|
DMA_DIRECTION_TO_DEVICE, req);
|
||||||
if (ret != NVME_SUCCESS) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue