Message ID | 20210809230355.8186-2-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | [v5,01/52] core: Introduce the scsi_cmd_to_rq() function | expand |
On 8/10/21 1:03 AM, Bart Van Assche wrote: > The 'request' member of struct scsi_cmnd is superfluous. The struct > request and struct scsi_cmnd data structures are adjacent and hence the > request pointer can be derived easily from a scsi_cmnd pointer. Introduce > a helper function that performs that conversion in a type-safe way. This > patch is the first step towards removing the request member from struct > scsi_cmnd. Making that change has the following advantages: > - This is a performance optimization since adding an offset to a pointer > takes less time than dereferencing a pointer. > - struct scsi_cmnd becomes smaller. > > Cc: Christoph Hellwig <hch@lst.de> > Cc: Hannes Reinecke <hare@suse.de> > Cc: Ming Lei <ming.lei@redhat.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > include/scsi/scsi_cmnd.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h > index 90da9617d28a..e76278ea1fee 100644 > --- a/include/scsi/scsi_cmnd.h > +++ b/include/scsi/scsi_cmnd.h > @@ -146,6 +146,12 @@ struct scsi_cmnd { > unsigned int extra_len; /* length of alignment and padding */ > }; > > +/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */ > +static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd) > +{ > + return blk_mq_rq_from_pdu(scmd); > +} > + > /* > * Return the driver private allocation behind the command. > * Only works if cmd_size is set in the host template. > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
This seems to miss a cover letter and about 40 or your 52 patches. No idea how I am supposed to review it.
On 8/12/21 5:28 AM, Christoph Hellwig wrote: > This seems to miss a cover letter and about 40 or your 52 patches. No > idea how I am supposed to review it. Hi Christoph, Could this be an issue related to the server that supports your email inbox? As one can see here, the lore list server received all 53 emails: https://lore.kernel.org/linux-scsi/a6563829-2e1e-8117-de45-876004a288ff@acm.org/T/#t Thanks, Bart.
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 90da9617d28a..e76278ea1fee 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -146,6 +146,12 @@ struct scsi_cmnd { unsigned int extra_len; /* length of alignment and padding */ }; +/* Variant of blk_mq_rq_from_pdu() that verifies the type of its argument. */ +static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd) +{ + return blk_mq_rq_from_pdu(scmd); +} + /* * Return the driver private allocation behind the command. * Only works if cmd_size is set in the host template.
The 'request' member of struct scsi_cmnd is superfluous. The struct request and struct scsi_cmnd data structures are adjacent and hence the request pointer can be derived easily from a scsi_cmnd pointer. Introduce a helper function that performs that conversion in a type-safe way. This patch is the first step towards removing the request member from struct scsi_cmnd. Making that change has the following advantages: - This is a performance optimization since adding an offset to a pointer takes less time than dereferencing a pointer. - struct scsi_cmnd becomes smaller. Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- include/scsi/scsi_cmnd.h | 6 ++++++ 1 file changed, 6 insertions(+)