fio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Vincent Fu <vincent.fu@samsung.com>,
	Ankit Kumar <ankit.kumar@samsung.com>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	"krish.reddy@samsung.com" <krish.reddy@samsung.com>,
	"joshi.k@samsung.com" <joshi.k@samsung.com>,
	"anuj20.g@samsung.com" <anuj20.g@samsung.com>
Subject: Re: [PATCH v2 3/8] nvme: add nvme opcodes, structures and helper functions
Date: Fri, 27 May 2022 08:54:44 -0600	[thread overview]
Message-ID: <f2c8a94b-7c54-7b87-f417-602a134eef04@kernel.dk> (raw)
In-Reply-To: <9e2905ec01eb4350b1896491fc29dc8b@samsung.com>

On 5/27/22 8:45 AM, Vincent Fu wrote:
>> -----Original Message-----
>> From: Ankit Kumar [mailto:ankit.kumar@samsung.com]
> 
>> +
>> +	if (io_u->ddir == DDIR_READ)
>> +		cmd->opcode = nvme_cmd_read;
>> +	if (io_u->ddir == DDIR_WRITE)
>> +		cmd->opcode = nvme_cmd_write;
> 
> Consider changing this to a switch statement and adding a default:
> case in case someone tries to send an unsupported command.
> 
> Since this is in the  fast path a switch statement would also reduce
> the number of times ddir is checked.

A switch or if/else won't make any difference there, the compiler should
generate the same code. But I do agree that it's nicer to use a switch
so that unhandled cases are done properly.

-- 
Jens Axboe


  reply	other threads:[~2022-05-27 14:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220526145343epcas5p362cd1b702fc0d11d21bca2880d6e288c@epcas5p3.samsung.com>
2022-05-26 14:48 ` [PATCH v2 0/8] Add support for uring passthrough commands Ankit Kumar
     [not found]   ` <CGME20220526145349epcas5p3b905edd0d1015dfa3cb7b08c4e9344c4@epcas5p3.samsung.com>
2022-05-26 14:48     ` [PATCH v2 1/8] io_uring.h: add IORING_SETUP_SQE128 and IORING_SETUP_CQE32 Ankit Kumar
     [not found]   ` <CGME20220526145359epcas5p342b9d8def710f380169e109ba3824fae@epcas5p3.samsung.com>
2022-05-26 14:48     ` [PATCH v2 2/8] configure: check nvme uring command support Ankit Kumar
     [not found]   ` <CGME20220526145400epcas5p348be0238746b1cc70fae627a63a43eba@epcas5p3.samsung.com>
2022-05-26 14:48     ` [PATCH v2 3/8] nvme: add nvme opcodes, structures and helper functions Ankit Kumar
2022-05-27  7:29       ` Kanchan Joshi
2022-05-27 12:24         ` Jens Axboe
2022-05-27 13:21           ` Ankit Kumar
2022-05-27 14:45       ` Vincent Fu
2022-05-27 14:54         ` Jens Axboe [this message]
2022-05-27 18:07           ` Jens Axboe
     [not found]   ` <CGME20220526145402epcas5p4a73b9f0a092deb61f4182b170093a103@epcas5p4.samsung.com>
2022-05-26 14:48     ` [PATCH v2 4/8] engines/io_uring: add new I/O engine for uring passthrough support Ankit Kumar
2022-05-27  6:37       ` Kanchan Joshi
     [not found]   ` <CGME20220526145403epcas5p4add1a5a36f1ce8c5472c3d31f1c785b0@epcas5p4.samsung.com>
2022-05-26 14:48     ` [PATCH v2 5/8] docs: document options for io_uring_cmd I/O engine Ankit Kumar
2022-05-27  6:54       ` Kanchan Joshi
2022-05-27 13:26         ` Ankit Kumar
2022-05-27 15:19       ` Vincent Fu
     [not found]   ` <CGME20220526145404epcas5p264b0af9a5ab117cc8276710c9b648f38@epcas5p2.samsung.com>
2022-05-26 14:48     ` [PATCH v2 6/8] zbd: Check for direct flag only if its block device Ankit Kumar
2022-05-27 16:15       ` Vincent Fu
2022-05-30 10:14       ` Shinichiro Kawasaki
     [not found]   ` <CGME20220526145405epcas5p178fdf7c65f0682369617459e5c2abe51@epcas5p1.samsung.com>
2022-05-26 14:48     ` [PATCH v2 7/8] engines/io_uring: Enable zone device support for io_uring_cmd I/O engine Ankit Kumar
2022-05-27 17:23       ` Vincent Fu
     [not found]   ` <CGME20220526145406epcas5p255f21b413d5dd504ff415bb38577200b@epcas5p2.samsung.com>
2022-05-26 14:48     ` [PATCH v2 8/8] examples: add 2 example job file for io_uring_cmd engine Ankit Kumar
2022-05-27 17:30       ` Vincent Fu
2022-05-27 18:05         ` Jens Axboe
2022-05-27  7:02   ` [PATCH v2 0/8] Add support for uring passthrough commands Kanchan Joshi
2022-05-27 13:24     ` Ankit Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2c8a94b-7c54-7b87-f417-602a134eef04@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=ankit.kumar@samsung.com \
    --cc=anuj20.g@samsung.com \
    --cc=fio@vger.kernel.org \
    --cc=joshi.k@samsung.com \
    --cc=krish.reddy@samsung.com \
    --cc=vincent.fu@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).