On 7/27/19 5:37 AM, Douglas Gilbert wrote: > Since the version 2 driver, the state of the driver can be found > with 'cat /proc/scsi/sg/debug'. As the driver becomes more > threaded and IO faster (e.g. scsi_debug with a command timer > of 5 microseconds), the existing state dump can become > misleading as the state can change during the "snapshot". The > new approach in this patch is to allocate a buffer of > SG_PROC_DEBUG_SZ bytes and use scnprintf() to populate it. Only > when the whole state is captured (or the buffer fills) is the > output to the caller's terminal performed. The previous > approach was line based: assemble a line of information and > then output it. > > Locks are taken as required for short periods and should not > interfere with a disk IO intensive program. Operations > such as closing a sg file descriptor or removing a sg device > may be held up for a short while (microseconds). > > Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > --- > drivers/scsi/sg.c | 238 +++++++++++++++++++++++++++++++--------------- > 1 file changed, 160 insertions(+), 78 deletions(-) > As we're reworking everything, can't we move this particular information to debugfs? I really would love to deprecate /proc/scsi in the near future, so we shouldn't be adding more stuff to it. Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@xxxxxxx +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnberg)