socsvn commit: r224270 - soc2011/oleksandr/oleksandr-head/head/sys/kern

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Fri Jul 15 11:35:29 UTC 2011


Author: oleksandr
Date: Fri Jul 15 11:35:26 2011
New Revision: 224270
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224270

Log:
  Add new type of error: read and write, in devstat

Modified:
  soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c

Modified: soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c
==============================================================================
--- soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c	Fri Jul 15 11:25:58 2011	(r224269)
+++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c	Fri Jul 15 11:35:26 2011	(r224270)
@@ -103,7 +103,7 @@
 		  devstat_support_flags flags,
 		  devstat_type_flags device_type,
 		  devstat_priority priority)
-{
+{       
 	struct devstatlist *devstat_head;
 	struct devstat *ds_tmp;
 
@@ -207,24 +207,29 @@
 struct devstat *
 devstat_search(const char *dev_name, u_int32_t unit_number)
 {
-   struct devstatlist *devstat_head;
-   struct devstat *dv_error; 
-   mtx_assert(&devstat_mutex, MA_NOTOWNED);
-   int status_match = 0;
-   devstat_head = &device_statq;
-   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;
-         break;
-        }  
-      }
-   }
-   if (status_match) {
-      return (dv_error);
-   } else 
-   return NULL; 
+        struct devstatlist *devstat_head;
+        struct devstat *dv_error; 
+        mtx_assert(&devstat_mutex, MA_NOTOWNED);
+        int status_match = 0;
+        devstat_head = &device_statq;
+        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;
+                                break;
+                        }  
+                }
+        }
+        if (status_match) {
+                return (dv_error);
+        } else { 
+	          printf("devstat_search: HELP! "
+                         "no appropriate device "
+                         "for name %p unit %d\n",
+                         dev_name, unit_number);
+                  return NULL; 
+        }
 }
 /*
  * Record a transaction start.
@@ -365,15 +370,19 @@
 				DEVSTAT_TAG_SIMPLE, flg, NULL, &bp->bio_t0);
 }
 /*
- * Increase indications counter by unit.
+ * Increase corresponding counter by unit.
  */
 void 
 devstat_add_error(struct devstat *ds, devstat_error_flags error_flag)
 {
- if (error_flag==DEVSTAT_ERROR_RETRIABLE) 
-    ds->dev_error.retriable++;
- if (error_flag==DEVSTAT_ERROR_NON_RETRIABLE) 
-    ds->dev_error.non_retriable++;
+        if (error_flag==DEVSTAT_ERROR_RETRIABLE) 
+                ds->dev_error.retriable++; 
+        if (error_flag==DEVSTAT_ERROR_NON_RETRIABLE) 
+                ds->dev_error.non_retriable++; 
+        if (error_flag==DEVSTAT_ERROR_WRITE_ERROR) 
+                ds->dev_error.write_error++;  
+        if (error_flag==DEVSTAT_ERROR_READ_ERROR) 
+                ds->dev_error.read_error++;
 }
 /*
  * This is the sysctl handler for the devstat package.  The data pushed out


More information about the svn-soc-all mailing list