On Wed, Aug 07, 2019 at 01:42:44PM +0200, Douglas Gilbert wrote: > The biggest single item in the sg_request object is the sense > buffer array which is SCSI_SENSE_BUFFERSIZE bytes long. That > constant started out at 18 bytes 20 years ago and is 96 bytes > now and might grow in the future. On the other hand the sense > buffer is only used by a small number of SCSI commands: those > that fail and those that want to return more information > other than a SCSI status of GOOD. > > Set up a small mempool called "sg_sense" that is only used as > required and released back to the mempool as soon as practical. > > Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > > - > > The scsi_lib.c file in the scsi mid-level maintains two sense > buffer caches but declares them and their access functions > static so they can't use by the sg driver. Perhaps the fastest > option would be to transfer ownership of a (non-empty) sense > buffer from the scsi_lib.c file to the sg driver. This technique > may be useful to ther ULDs. Why do you need your own storage for the sense buffer? As soon as you have allocate the request/scsi_request you can use its sense buffer. There shouldn't really be a need to keep a copy around.