Date: Fri, 22 Jul 2011 11:19:53 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r224488 - in soc2011/oleksandr/oleksandr-head/head/sys: cam kern sys Message-ID: <20110722111953.7805E106566C@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oleksandr Date: Fri Jul 22 11:19:53 2011 New Revision: 224488 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224488 Log: Add new type of disk error:other that including errors associated with requests for control Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c Fri Jul 22 09:39:49 2011 (r224487) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_xpt.c Fri Jul 22 11:19:53 2011 (r224488) @@ -4142,58 +4142,66 @@ { struct cam_sim *sim; int first; - int i,num_error=0; + int i, num_error = 0; struct devstat *device_error; devstat_error_flags error_flag[NUMBER_TYPE_ERRORS]; /* * 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[num_error]=DEVSTAT_ERROR_NON_RETRIABLE; + 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[num_error] = DEVSTAT_ERROR_NON_RETRIABLE; num_error++; } /* * 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[num_error]=DEVSTAT_ERROR_RETRIABLE; + 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[num_error] = DEVSTAT_ERROR_RETRIABLE; num_error++; } /* - * If the error is write error refer it to the type of write error + * If the error is write error refer it to the type of write error. */ - if ((done_ccb->ccb_h.flags==CAM_DIR_OUT)&& - (done_ccb->ccb_h.status_test!=CAM_REQ_CMP)) { - error_flag[num_error]=DEVSTAT_ERROR_WRITE_ERROR; + if (done_ccb->ccb_h.flags == CAM_DIR_OUT && + done_ccb->ccb_h.status_test != CAM_REQ_CMP) { + error_flag[num_error] = DEVSTAT_ERROR_WRITE_ERROR; num_error++; } /* * If the error is read error refer it to the type of read error */ - if ((done_ccb->ccb_h.flags==CAM_DIR_IN)&& - (done_ccb->ccb_h.status_test!=CAM_REQ_CMP)) { - error_flag[num_error]=DEVSTAT_ERROR_READ_ERROR; + if (done_ccb->ccb_h.flags == CAM_DIR_IN && + done_ccb->ccb_h.status_test != CAM_REQ_CMP) { + error_flag[num_error] = DEVSTAT_ERROR_READ_ERROR; + num_error++; + } + /* + * If the request is countrol and there is no action with data * refer it to the type of other error. + */ + if (((done_ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) && + done_ccb->ccb_h.status_test != CAM_REQ_CMP) { + error_flag[num_error]=DEVSTAT_ERROR_OTHER_ERROR; num_error++; } /* * If an error is present, search for an appropriate structure * in devstat and increase the corresponding counter of errors. */ - for (i=0;i<num_error;i++) { + for (i = 0 ;i < num_error; i++) { if (error_flag[i]) { - device_error= devstat_search( - done_ccb->ccb_h.path->periph->periph_name, - done_ccb->ccb_h.path->periph->unit_number); - if (device_error!=NULL) + 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_add_error(device_error, error_flag[i]); } } Modified: soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Fri Jul 22 09:39:49 2011 (r224487) +++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Fri Jul 22 11:19:53 2011 (r224488) @@ -212,11 +212,11 @@ mtx_assert(&devstat_mutex, MA_NOTOWNED); int status_match = 0; devstat_head = &device_statq; - if (STAILQ_EMPTY(&device_statq)==0) { + if (STAILQ_EMPTY(&device_statq) == 0) { STAILQ_FOREACH(dv_error, devstat_head, dev_links) { - if ((strcmp(dev_name,dv_error->device_name)==0)&& - (unit_number==dv_error->unit_number)) { - status_match=1; + if (strcmp(dev_name,dv_error->device_name) == 0 && + unit_number == dv_error->unit_number) { + status_match = 1; break; } } @@ -227,7 +227,7 @@ printf("devstat_search: HELP! " "no appropriate device " "for name %p unit %d\n", - dev_name, unit_number); + dev_name, unit_number); return NULL; } } @@ -375,14 +375,16 @@ void devstat_add_error(struct devstat *ds, devstat_error_flags error_flag) { - if (error_flag==DEVSTAT_ERROR_RETRIABLE) + if (error_flag == DEVSTAT_ERROR_RETRIABLE) ds->dev_error.retriable++; - if (error_flag==DEVSTAT_ERROR_NON_RETRIABLE) + if (error_flag == DEVSTAT_ERROR_NON_RETRIABLE) ds->dev_error.non_retriable++; - if (error_flag==DEVSTAT_ERROR_WRITE_ERROR) + if (error_flag == DEVSTAT_ERROR_WRITE_ERROR) ds->dev_error.write_error++; - if (error_flag==DEVSTAT_ERROR_READ_ERROR) + if (error_flag == DEVSTAT_ERROR_READ_ERROR) ds->dev_error.read_error++; + if (error_flag == DEVSTAT_ERROR_OTHER_ERROR) + ds->dev_error.other_error++; } /* * This is the sysctl handler for the devstat package. The data pushed out Modified: soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Fri Jul 22 09:39:49 2011 (r224487) +++ soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Fri Jul 22 11:19:53 2011 (r224488) @@ -102,7 +102,8 @@ DEVSTAT_ERROR_RETRIABLE = 0x01, DEVSTAT_ERROR_NON_RETRIABLE = 0x02, DEVSTAT_ERROR_READ_ERROR = 0x03, - DEVSTAT_ERROR_WRITE_ERROR = 0x04 + DEVSTAT_ERROR_WRITE_ERROR = 0x04, + DEVSTAT_ERROR_OTHER_ERROR = 0x05 } devstat_error_flags; /* * These types are intended to aid statistics gathering/display programs. @@ -145,6 +146,7 @@ int non_retriable; int read_error; int write_error; + int other_error; } devstat_device_error; /* * XXX: Next revision should add
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110722111953.7805E106566C>