From d273281911e1cdaaed155efa0417f085066099c5 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Thu, 7 Jul 2022 02:34:30 +0900 Subject: [PATCH] nvme: Use opcode directly in submit_io submit_io is an internal functions and all callers pass the correct opcode in. Thus no need to reparse and select the right wrapper function (nvme_read, nvme_write, ...). Instead just pass the opcode to the generic nvme_io function. Note, the compare was fixed in 9b6d3fca4289 ("submit_io(): fix "nvme compare" to pass correct command") but missed the opportunity to cleanup this part. Signed-off-by: Tokunori Ikegami [dwagner: reworded commit message] Signed-off-by: Daniel Wagner --- nvme.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/nvme.c b/nvme.c index a54a5f6f..08fbcbb2 100644 --- a/nvme.c +++ b/nvme.c @@ -6602,12 +6602,7 @@ static int submit_io(int opcode, char *command, const char *desc, .result = NULL, }; gettimeofday(&start_time, NULL); - if (opcode == nvme_cmd_compare) - err = nvme_compare(&args); - else if (opcode & 1) - err = nvme_write(&args); - else - err = nvme_read(&args); + err = nvme_io(&args, opcode); gettimeofday(&end_time, NULL); if (cfg.latency) printf(" latency: %s: %llu us\n", -- 2.50.1