RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent
authorBart Van Assche <bvanassche@acm.org>
Mon, 24 May 2021 04:12:11 +0000 (21:12 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 28 May 2021 23:21:21 +0000 (20:21 -0300)
commitad215aaea4f9d637f441566cdbbc610e9849e1fa
tree170e88c6a79a46ce5d1b139cfd200f290e195a43
parent7ec2e27a3afff64c96bfe7a77685c33619db84be
RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent

Define .init_cmd_priv and .exit_cmd_priv callback functions in struct
scsi_host_template. Set .cmd_size such that the SCSI core allocates
per-command private data. Use scsi_cmd_priv() to access that private
data. Remove the req_ring pointer from struct srp_rdma_ch since it is no
longer necessary. Convert srp_alloc_req_data() and srp_free_req_data()
into functions that initialize one instance of the SRP-private command
data. This is a micro-optimization since this patch removes several
pointer dereferences from the hot path.

Note: due to commit e73a5e8e8003 ("scsi: core: Only return started
requests from scsi_host_find_tag()"), it is no longer necessary to protect
the completion path against duplicate responses.

Link: https://lore.kernel.org/r/20210524041211.9480-6-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srp/ib_srp.h