Blob Blame History Raw
From: Kanchan Joshi <joshi.k@samsung.com>
Date: Tue, 9 Mar 2021 00:48:04 +0530
Subject: nvme: reduce checks for zero command effects
Patch-mainline: v5.13-rc1
Git-commit: 18479ddb7fd5fd0994bd10a95618bf866713a11b
References: bsc#1184259, bsc#1178612, bsc#1186155

For passthrough I/O commands, effects are usually to be zero.
nvme_passthrough_end() does three checks in futility for this case.
Bail out of function-call/checks.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Martin Wilck <mwilck@suse.com>
---
 drivers/nvme/host/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1047,7 +1047,8 @@ void nvme_execute_passthru_rq(struct req
 
 	effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
 	blk_execute_rq(rq->q, disk, rq, 0);
-	nvme_passthru_end(ctrl, effects);
+	if (effects) /* nothing to be done for zero cmd effects */
+		nvme_passthru_end(ctrl, effects);
 }
 EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU);