From: Bart Van Assche <bvanassche@acm.org>
To: Christoph Hellwig <hch@lst.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 04/10] scsi: simplify varlen CDB length checking
Date: Mon, 5 Oct 2020 09:06:48 -0700 [thread overview]
Message-ID: <7f975da0-e793-ff23-064e-a4cf91396b09@acm.org> (raw)
In-Reply-To: <20201005084130.143273-5-hch@lst.de>
On 10/5/20 1:41 AM, Christoph Hellwig wrote:
> diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
> index 8ea44c6595efa7..b6222df7254a3a 100644
> --- a/drivers/scsi/scsi_logging.c
> +++ b/drivers/scsi/scsi_logging.c
> @@ -111,7 +111,7 @@ static size_t scsi_format_opcode_name(char *buffer, size_t buf_len,
>
> cdb0 = cdbp[0];
> if (cdb0 == VARIABLE_LENGTH_CMD) {
> - int len = scsi_varlen_cdb_length(cdbp);
> + int len = cdbp[7] + 8;
>
> if (len < 10) {
> off = scnprintf(buffer, buf_len,
> diff --git a/include/scsi/scsi_common.h b/include/scsi/scsi_common.h
> index 731ac09ed23135..297fc1881607b6 100644
> --- a/include/scsi/scsi_common.h
> +++ b/include/scsi/scsi_common.h
> @@ -9,20 +9,15 @@
> #include <linux/types.h>
> #include <scsi/scsi_proto.h>
>
> -static inline unsigned
> -scsi_varlen_cdb_length(const void *hdr)
> -{
> - return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
> -}
> -
> extern const unsigned char scsi_command_size_tbl[8];
> #define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
>
> static inline unsigned
> scsi_command_size(const unsigned char *cmnd)
> {
> - return (cmnd[0] == VARIABLE_LENGTH_CMD) ?
> - scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
> + if (cmnd[0] == VARIABLE_LENGTH_CMD)
> + return cmnd[7] + 8;
> + return COMMAND_SIZE(cmnd[0]);
> }
>
> /* Returns a human-readable name for the device */
> diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h
> index c3686011193224..c57f9cd8185526 100644
> --- a/include/scsi/scsi_proto.h
> +++ b/include/scsi/scsi_proto.h
> @@ -176,16 +176,6 @@
>
> #define SCSI_MAX_VARLEN_CDB_SIZE 260
>
> -/* defined in T10 SCSI Primary Commands-2 (SPC2) */
> -struct scsi_varlen_cdb_hdr {
> - __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */
> - __u8 control;
> - __u8 misc[5];
> - __u8 additional_cdb_length; /* total cdb length - 8 */
> - __be16 service_action;
> - /* service specific data follows */
> -};
I'm OK with removing struct scsi_varlen_cdb_hdr but not with the removal of the
scsi_varlen_cdb_length() function. I'd like to keep that function because I think
it makes code that handles variable length CDBs easier to read.
Thanks,
Bart.
next prev parent reply other threads:[~2020-10-05 16:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 8:41 misc I/O submission cleanups Christoph Hellwig
2020-10-05 8:41 ` [PATCH 01/10] scsi: don't export scsi_device_from_queue Christoph Hellwig
2020-10-05 9:00 ` Hannes Reinecke
2020-10-13 22:42 ` Martin K. Petersen
2020-10-05 8:41 ` [PATCH 02/10] scsi: remove scsi_init_cmd_errh Christoph Hellwig
2020-10-05 9:01 ` Hannes Reinecke
2020-10-05 8:41 ` [PATCH 03/10] scsi: move command size detection out of the fast path Christoph Hellwig
2020-10-05 9:02 ` Hannes Reinecke
2020-10-05 8:41 ` [PATCH 04/10] scsi: simplify varlen CDB length checking Christoph Hellwig
2020-10-05 9:03 ` Hannes Reinecke
2020-10-05 16:06 ` Bart Van Assche [this message]
2020-10-07 2:36 ` Martin K. Petersen
2020-10-05 8:41 ` [PATCH 05/10] scsi: use rq_dma_dir in scsi_setup_cmnd Christoph Hellwig
2020-10-05 9:04 ` Hannes Reinecke
2020-10-05 8:41 ` [PATCH 06/10] scsi: rename scsi_prep_state_check to scsi_device_state_check Christoph Hellwig
2020-10-05 9:04 ` Hannes Reinecke
2020-10-05 8:41 ` [PATCH 07/10] scsi: rename scsi_mq_prep_fn to scsi_prepare_cmd Christoph Hellwig
2020-10-05 9:05 ` Hannes Reinecke
2020-10-05 8:41 ` [PATCH 08/10] scsi: cleanup allocation and freeing of sgtables Christoph Hellwig
2020-10-06 5:49 ` Hannes Reinecke
2020-10-05 8:41 ` [PATCH 09/10] scsi: remove scsi_setup_cmnd and scsi_setup_fs_cmnd Christoph Hellwig
2020-10-05 8:41 ` [PATCH 10/10] scsi: only start the request just before dispatching Christoph Hellwig
2020-10-05 16:11 ` Bart Van Assche
2020-10-07 2:37 ` misc I/O submission cleanups Martin K. Petersen
2020-10-08 16:39 ` Qian Cai
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=7f975da0-e793-ff23-064e-a4cf91396b09@acm.org \
--to=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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