Date: Fri, 08 Jul 2011 21:49:15 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r224062 - soc2011/oleksandr/oleksandr-head/head/sys/cam Message-ID: <20110708214915.A78461065670@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oleksandr Date: Fri Jul 8 21:49:15 2011 New Revision: 224062 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224062 Log: Identification type of errors and increased the counter in devstat Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_ccb.h soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_ccb.h ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_ccb.h Fri Jul 8 21:44:21 2011 (r224061) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_ccb.h Fri Jul 8 21:49:15 2011 (r224062) @@ -304,6 +304,7 @@ /* Callback on completion function */ xpt_opcode func_code; /* XPT function code */ u_int32_t status; /* Status returned by CAM subsystem */ + u_int32_t status_test; /* CAM status for test disk error */ struct cam_path *path; /* Compiled path for this ccb */ path_id_t path_id; /* Path ID for the request */ target_id_t target_id; /* Target device ID */ Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c Fri Jul 8 21:44:21 2011 (r224061) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c Fri Jul 8 21:49:15 2011 (r224062) @@ -38,6 +38,7 @@ #include <sys/kernel.h> #include <sys/time.h> #include <sys/conf.h> +#include <sys/devicestat.h> #include <sys/fcntl.h> #include <sys/interrupt.h> #include <sys/sbuf.h> @@ -4140,8 +4141,45 @@ xpt_done(union ccb *done_ccb) { struct cam_sim *sim; - int first; - + int first; + struct devstat *device_error; + devstat_error_flags error_flag=0; + /* + * If the error is fatal refer it to the type of non retry able. + */ + if ((done_ccb->ccb_h.status_test==CAM_REQ_CMP_ERR)|| + (done_ccb->ccb_h.status_test==CAM_TID_INVALID)|| + (done_ccb->ccb_h.status_test==CAM_SCSI_STATUS_ERROR)|| + (done_ccb->ccb_h.status_test==CAM_AUTOSENSE_FAIL)|| + (done_ccb->ccb_h.status_test==CAM_LUN_INVALID)) { + error_flag=DEVSTAT_ERROR_NON_RETRIABLE; + } + /* + * If the error is not fatal refer it to the type of retry able. + */ + if ((done_ccb->ccb_h.status_test==CAM_SEL_TIMEOUT)|| + (done_ccb->ccb_h.status_test==CAM_SCSI_BUSY)|| + (done_ccb->ccb_h.status_test==CAM_SIM_QUEUED)|| + (done_ccb->ccb_h.status_test==CAM_FUNC_NOTAVAIL)|| + (done_ccb->ccb_h.status_test==CAM_REQ_INVALID)|| + (done_ccb->ccb_h.status_test==CAM_REQUEUE_REQ)) { + error_flag=DEVSTAT_ERROR_RETRIABLE; + } + /* + * If an error is present, search for an appropriate structure + * in devstat and increase the corresponding counter of errors. + */ + if (error_flag) { + device_error= devstat_search( + done_ccb->ccb_h.path->periph->periph_name, + done_ccb->ccb_h.path->periph->unit_number); + if (device_error!=NULL) { + devstat_start_transaction(device_error, NULL); + devstat_add_error(device_error, error_flag); + devstat_end_transaction(device_error,done_ccb->csio.dxfer_len, + DEVSTAT_TAG_ORDERED,DEVSTAT_WRITE, NULL, NULL); + } + } CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done\n")); if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) != 0) { /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110708214915.A78461065670>