From owner-svn-soc-all@FreeBSD.ORG Fri Jul 15 11:35:29 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 08BA9106566B for ; Fri, 15 Jul 2011 11:35:27 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 15 Jul 2011 11:35:27 +0000 Date: Fri, 15 Jul 2011 11:35:27 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110715113527.08BA9106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r224270 - soc2011/oleksandr/oleksandr-head/head/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2011 11:35:29 -0000 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