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

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Fri Jul 8 21:41:14 UTC 2011


Author: oleksandr
Date: Fri Jul  8 21:41:12 2011
New Revision: 224060
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224060

Log:
  Added new function in devstat for record error

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  8 20:41:12 2011	(r224059)
+++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c	Fri Jul  8 21:41:12 2011	(r224060)
@@ -201,7 +201,31 @@
 	devstat_generation++;
 	mtx_unlock(&devstat_mutex);
 }
-
+/*
+ * Search in the devstat desired structure.
+ */
+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; 
+}
 /*
  * Record a transaction start.
  *
@@ -340,9 +364,20 @@
 	devstat_end_transaction(ds, bp->bio_bcount - bp->bio_resid,
 				DEVSTAT_TAG_SIMPLE, flg, NULL, &bp->bio_t0);
 }
-
+/*
+ * Increase indications 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++;
+}
 /*
  * This is the sysctl handler for the devstat package.  The data pushed out
+
  * on the kern.devstat.all sysctl variable consists of the current devstat
  * generation number, and then an array of devstat structures, one for each
  * device in the system.


More information about the svn-soc-all mailing list