[PATCH 01/14] nvmet: for pt I/O cmds annotate req->sg_cnt likely

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Mon Aug 10 14:54:43 EDT 2020


I/O Commands (nvme_cmd_read, nvme_cmd_write) are most command commands
when accessing passthru controller. For I/O commands data is represented
in SG list, so sg_cnt != 0 in most cases.

Annotate req->sg_cnt check with likely.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/target/passthru.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
index 68701754b036..fd1f754de5b4 100644
--- a/drivers/nvme/target/passthru.c
+++ b/drivers/nvme/target/passthru.c
@@ -242,7 +242,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
 		goto out_put_ns;
 	}
 
-	if (req->sg_cnt) {
+	if (likely(req->sg_cnt)) {
 		ret = nvmet_passthru_map_sg(req, rq);
 		if (unlikely(ret)) {
 			status = NVME_SC_INTERNAL;
-- 
2.22.1




More information about the Linux-nvme mailing list