diff mbox series

hw/block/nvme: remove redundant invalid_lba_range trace

Message ID 20210414070435.3702-1-anaidu.gollu@samsung.com
State New
Headers show
Series hw/block/nvme: remove redundant invalid_lba_range trace | expand

Commit Message

Gollu Appalanaidu April 14, 2021, 7:04 a.m. UTC
Currently pci_nvme_err_invalid_lba_range tace being called indvidually
at each function, add this in nvme_check_bounds and remove redundant
usage of it.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
---
 hw/block/nvme.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Philippe Mathieu-Daudé April 14, 2021, 12:38 p.m. UTC | #1
On 4/14/21 9:04 AM, Gollu Appalanaidu wrote:
> Currently pci_nvme_err_invalid_lba_range tace being called indvidually

Typos "trace", "individually".

> at each function, add this in nvme_check_bounds and remove redundant
> usage of it.
> 
> Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> ---
>  hw/block/nvme.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Klaus Jensen April 15, 2021, 6:15 a.m. UTC | #2
On Apr 14 12:34, Gollu Appalanaidu wrote:
>Currently pci_nvme_err_invalid_lba_range tace being called indvidually
>at each function, add this in nvme_check_bounds and remove redundant
>usage of it.
>
>Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
>---
> hw/block/nvme.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
>diff --git a/hw/block/nvme.c b/hw/block/nvme.c
>index 6842b01ab5..c67d3315a1 100644
>--- a/hw/block/nvme.c
>+++ b/hw/block/nvme.c
>@@ -1424,6 +1424,7 @@ static inline uint16_t nvme_check_bounds(NvmeNamespace *ns, uint64_t slba,
>     uint64_t nsze = le64_to_cpu(ns->id_ns.nsze);
>
>     if (unlikely(UINT64_MAX - slba < nlb || slba + nlb > nsze)) {
>+        trace_pci_nvme_err_invalid_lba_range(slba, nlb, nsze);
>         return NVME_LBA_RANGE | NVME_DNR;
>     }
>
>@@ -2266,7 +2267,6 @@ static void nvme_copy_in_complete(NvmeRequest *req)
>
>     status = nvme_check_bounds(ns, sdlba, ctx->nlb);
>     if (status) {
>-        trace_pci_nvme_err_invalid_lba_range(sdlba, ctx->nlb, ns->id_ns.nsze);
>         goto invalid;
>     }
>
>@@ -2528,8 +2528,6 @@ static uint16_t nvme_dsm(NvmeCtrl *n, NvmeRequest *req)
>             uint32_t nlb = le32_to_cpu(range[i].nlb);
>
>             if (nvme_check_bounds(ns, slba, nlb)) {
>-                trace_pci_nvme_err_invalid_lba_range(slba, nlb,
>-                                                     ns->id_ns.nsze);
>                 continue;
>             }
>
>@@ -2602,7 +2600,6 @@ static uint16_t nvme_verify(NvmeCtrl *n, NvmeRequest *req)
>
>     status = nvme_check_bounds(ns, slba, nlb);
>     if (status) {
>-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
>         return status;
>     }
>
>@@ -2687,7 +2684,6 @@ static uint16_t nvme_copy(NvmeCtrl *n, NvmeRequest *req)
>
>         status = nvme_check_bounds(ns, slba, _nlb);
>         if (status) {
>-            trace_pci_nvme_err_invalid_lba_range(slba, _nlb, ns->id_ns.nsze);
>             goto out;
>         }
>
>@@ -2816,7 +2812,6 @@ static uint16_t nvme_compare(NvmeCtrl *n, NvmeRequest *req)
>
>     status = nvme_check_bounds(ns, slba, nlb);
>     if (status) {
>-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
>         return status;
>     }
>
>@@ -2935,7 +2930,6 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req)
>
>     status = nvme_check_bounds(ns, slba, nlb);
>     if (status) {
>-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
>         goto invalid;
>     }
>
>@@ -3015,7 +3009,6 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
>
>     status = nvme_check_bounds(ns, slba, nlb);
>     if (status) {
>-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
>         goto invalid;
>     }
>

Thanks. Applied to nvme-next!
diff mbox series

Patch

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 6842b01ab5..c67d3315a1 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1424,6 +1424,7 @@  static inline uint16_t nvme_check_bounds(NvmeNamespace *ns, uint64_t slba,
     uint64_t nsze = le64_to_cpu(ns->id_ns.nsze);
 
     if (unlikely(UINT64_MAX - slba < nlb || slba + nlb > nsze)) {
+        trace_pci_nvme_err_invalid_lba_range(slba, nlb, nsze);
         return NVME_LBA_RANGE | NVME_DNR;
     }
 
@@ -2266,7 +2267,6 @@  static void nvme_copy_in_complete(NvmeRequest *req)
 
     status = nvme_check_bounds(ns, sdlba, ctx->nlb);
     if (status) {
-        trace_pci_nvme_err_invalid_lba_range(sdlba, ctx->nlb, ns->id_ns.nsze);
         goto invalid;
     }
 
@@ -2528,8 +2528,6 @@  static uint16_t nvme_dsm(NvmeCtrl *n, NvmeRequest *req)
             uint32_t nlb = le32_to_cpu(range[i].nlb);
 
             if (nvme_check_bounds(ns, slba, nlb)) {
-                trace_pci_nvme_err_invalid_lba_range(slba, nlb,
-                                                     ns->id_ns.nsze);
                 continue;
             }
 
@@ -2602,7 +2600,6 @@  static uint16_t nvme_verify(NvmeCtrl *n, NvmeRequest *req)
 
     status = nvme_check_bounds(ns, slba, nlb);
     if (status) {
-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
         return status;
     }
 
@@ -2687,7 +2684,6 @@  static uint16_t nvme_copy(NvmeCtrl *n, NvmeRequest *req)
 
         status = nvme_check_bounds(ns, slba, _nlb);
         if (status) {
-            trace_pci_nvme_err_invalid_lba_range(slba, _nlb, ns->id_ns.nsze);
             goto out;
         }
 
@@ -2816,7 +2812,6 @@  static uint16_t nvme_compare(NvmeCtrl *n, NvmeRequest *req)
 
     status = nvme_check_bounds(ns, slba, nlb);
     if (status) {
-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
         return status;
     }
 
@@ -2935,7 +2930,6 @@  static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req)
 
     status = nvme_check_bounds(ns, slba, nlb);
     if (status) {
-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
         goto invalid;
     }
 
@@ -3015,7 +3009,6 @@  static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
 
     status = nvme_check_bounds(ns, slba, nlb);
     if (status) {
-        trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze);
         goto invalid;
     }