diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2009-01-25 17:15:16 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-03-12 12:58:09 -0500 |
commit | 98f3aea2bd4b4f9cd7a6a6479ed9410787f756fd (patch) | |
tree | 6b5eeab307ab09372c62e7aac4516548d763b030 /include/scsi/osd_initiator.h | |
parent | 1b9dce94c8a24a3f1a01fcdf688f2d903b32acdf (diff) | |
download | kernel_goldelico_gta04-98f3aea2bd4b4f9cd7a6a6479ed9410787f756fd.zip kernel_goldelico_gta04-98f3aea2bd4b4f9cd7a6a6479ed9410787f756fd.tar.gz kernel_goldelico_gta04-98f3aea2bd4b4f9cd7a6a6479ed9410787f756fd.tar.bz2 |
[SCSI] libosd: SCSI/OSD Sense decoding support
Implementation of the osd_req_decode_sense() API. Can be called by
library users to decode what failed in command executions.
Add SCSI_OSD_DPRINT_SENSE Kconfig variable. Possible values are:
0 - Do not print any errors to messages file <KERN_ERR>
1 - (Default) Print only decoded errors that are not recoverable.
Recoverable errors are those that the target has complied with
the request but with a warning. For example read passed end of
object will return zeros after the last valid byte.
2- Print all errors.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi/osd_initiator.h')
-rw-r--r-- | include/scsi/osd_initiator.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h index 24edeae..b24d961 100644 --- a/include/scsi/osd_initiator.h +++ b/include/scsi/osd_initiator.h @@ -217,6 +217,55 @@ int osd_execute_request_async(struct osd_request *or, osd_req_done_fn *done, void *private); /** + * osd_req_decode_sense_full - Decode sense information after execution. + * + * @or: - osd_request to examine + * @osi - Recievs a more detailed error report information (optional). + * @silent - Do not print to dmsg (Even if enabled) + * @bad_obj_list - Some commands act on multiple objects. Failed objects will + * be recieved here (optional) + * @max_obj - Size of @bad_obj_list. + * @bad_attr_list - List of failing attributes (optional) + * @max_attr - Size of @bad_attr_list. + * + * After execution, sense + return code can be analyzed using this function. The + * return code is the final disposition on the error. So it is possible that a + * CHECK_CONDITION was returned from target but this will return NO_ERROR, for + * example on recovered errors. All parameters are optional if caller does + * not need any returned information. + * Note: This function will also dump the error to dmsg according to settings + * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the + * command would routinely fail, to not spam the dmsg file. + */ +struct osd_sense_info { + int key; /* one of enum scsi_sense_keys */ + int additional_code ; /* enum osd_additional_sense_codes */ + union { /* Sense specific information */ + u16 sense_info; + u16 cdb_field_offset; /* scsi_invalid_field_in_cdb */ + }; + union { /* Command specific information */ + u64 command_info; + }; + + u32 not_initiated_command_functions; /* osd_command_functions_bits */ + u32 completed_command_functions; /* osd_command_functions_bits */ + struct osd_obj_id obj; + struct osd_attr attr; +}; + +int osd_req_decode_sense_full(struct osd_request *or, + struct osd_sense_info *osi, bool silent, + struct osd_obj_id *bad_obj_list, int max_obj, + struct osd_attr *bad_attr_list, int max_attr); + +static inline int osd_req_decode_sense(struct osd_request *or, + struct osd_sense_info *osi) +{ + return osd_req_decode_sense_full(or, osi, false, NULL, 0, NULL, 0); +} + +/** * osd_end_request - return osd_request to free store * * @or: osd_request to free |