[PATCH 06/14] nvmet: use unlikely for uncommon commands

Keith Busch kbusch at kernel.org
Mon Aug 10 16:46:27 EDT 2020


On Mon, Aug 10, 2020 at 11:54:48AM -0700, Chaitanya Kulkarni wrote:
> I/O commands (nvme_cmd_read, nvme_cmd_write) are most common commands
> when accessing passthru controller, most controllers should not
> have set the effects for r/w I/O commnds (atleast I don't know at this
> moment).

The method that gets effects actually always returns 0 for IO commands,
which is the case if you are sending this command to a namespace.

>  	effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);

In which case you could skip retrieving effects if ns != NULL.

> -	if (req->p.use_workqueue || effects) {
> +	if (unlikely(req->p.use_workqueue || effects)) {
>  		INIT_WORK(&req->p.work, nvmet_passthru_execute_cmd_work);
>  		req->p.rq = rq;
>  		schedule_work(&req->p.work);



More information about the Linux-nvme mailing list