Douglas Gilbert wrote: > After the comments on the RFC for this thread, here is > a patch against lk 2.6.9-rc1 to kick around. > > The patch only touches two files: scsi.h and scsi_lib.c > It adds the proposed facility and then uses it in scsi_lib > in roughly 4 locations. IMO there were 3 sense processing errors: > - block SG_IO did not get passed back deferred errors > [SG_IO is a __pass-through__ interface!!] > - MEDIUM_ERRORs _do_ get processed for deferred sense errors > in scsi_io_completion() which seems unintended > [I did not fix this one.] > - invalid command operation code handling in > __scsi_mode_sense() was just wrong > > If people think this is a reasonable approach, then the rest of > the scsi mid-level and upper level driver could be converted. > As Kai pointed we may need some general routines to pick up the > sense data "extras". > > The benefit of doing this conversion is that it may well > highlight a lot more sense data processing errors (if the > above is any guide). > > Changes: > - add structure to receive normalized sense data from either > fixed or descriptor format sense data > - add scsi_normalize_sense() function to populate that structure > - add scsi_sense_is_deferred() function so deferred errors can > be ignored in many contexts > - apply new mechanism to sense data processing within the > scsi_lib.c file Here is a second cut of the patch. If James accepts it naturally he is free to enforce the appropriate coding style. I believe that cleaning up scsi error processing is going to be a "work in progress" for a while. Doug Gilbert