From nobody@FreeBSD.org  Fri Mar  8 08:20:17 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id C41C0851
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  8 Mar 2013 08:20:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id B577EFF2
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  8 Mar 2013 08:20:17 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r288KGMG031303
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 8 Mar 2013 08:20:16 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r288KGog031302;
	Fri, 8 Mar 2013 08:20:16 GMT
	(envelope-from nobody)
Message-Id: <201303080820.r288KGog031302@red.freebsd.org>
Date: Fri, 8 Mar 2013 08:20:16 GMT
From: Matt Burke <mattblists@icritical.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: BIO_FLUSH not recorded by devstats
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         176744
>Category:       kern
>Synopsis:       [geom] [patch] BIO_FLUSH not recorded by devstats
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-geom
>State:          patched
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 08 08:30:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Sun May 18 14:42:47 CEST 2014
>Originator:     Matt Burke
>Release:        10.0-CURRENT
>Organization:
Critical Software
>Environment:
>Description:
BIO_FLUSH operations are not recorded by devstats
>How-To-Repeat:

>Fix:
Apply attached patch

Patch attached with submission follows:

diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index 72e9162..0fb14c9 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -252,7 +252,7 @@ g_disk_done(struct bio *bp)
 	if (bp2->bio_error == 0)
 		bp2->bio_error = bp->bio_error;
 	bp2->bio_completed += bp->bio_completed;
-	if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0 &&
+	if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE|BIO_FLUSH)) != 0 &&
 	    (sc = bp2->bio_to->geom->softc) != NULL &&
 	    (dp = sc->dp) != NULL) {
 		devstat_end_transaction_bio(dp->d_devstat, bp);
@@ -403,6 +403,7 @@ g_disk_start(struct bio *bp)
 		}
 		bp2->bio_done = g_disk_done;
 		bp2->bio_disk = dp;
+		devstat_start_transaction_bio(dp->d_devstat, bp2);
 		g_disk_lock_giant(dp);
 		dp->d_strategy(bp2);
 		g_disk_unlock_giant(dp);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Mar 10 04:43:46 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=176744 
State-Changed-From-To: open->feedback 
State-Changed-By: brueffer 
State-Changed-When: Wed Feb 5 18:11:49 CET 2014 
State-Changed-Why:  
Hi Matt, I debated this change with mav@ and we were wondering what your specific 
use for this change is. 

While an adapted version (https://people.freebsd.org/~brueffer/geom_devstat.diff) 
of this patch works, the upstream userland tools have no special handling for BIO_FLUSH 
events.  They end up in the _OTHER categories of libdevstat(3), which e.g. gstat does not 
show at all. 

Could you elaborate? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=176744 
State-Changed-From-To: feedback->patched 
State-Changed-By: brueffer 
State-Changed-When: Sun May 18 14:41:19 CEST 2014 
State-Changed-Why:  
mav@ committed the necessary changes to HEAD in r266319. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=176744 
>Unformatted:
