From owner-svn-src-projects@FreeBSD.ORG Mon Oct 21 21:32:25 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 10189138; Mon, 21 Oct 2013 21:32:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D80EA281A; Mon, 21 Oct 2013 21:32:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LLWOaq070390; Mon, 21 Oct 2013 21:32:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LLWO3x070388; Mon, 21 Oct 2013 21:32:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310212132.r9LLWO3x070388@svn.freebsd.org> From: Alexander Motin Date: Mon, 21 Oct 2013 21:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256863 - projects/camlock/sys/geom X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2013 21:32:25 -0000 Author: mav Date: Mon Oct 21 21:32:24 2013 New Revision: 256863 URL: http://svnweb.freebsd.org/changeset/base/256863 Log: Add and use constants for g_collectstats bits. Modified: projects/camlock/sys/geom/geom_int.h projects/camlock/sys/geom/geom_io.c Modified: projects/camlock/sys/geom/geom_int.h ============================================================================== --- projects/camlock/sys/geom/geom_int.h Mon Oct 21 21:16:50 2013 (r256862) +++ projects/camlock/sys/geom/geom_int.h Mon Oct 21 21:32:24 2013 (r256863) @@ -39,6 +39,9 @@ LIST_HEAD(class_list_head, g_class); TAILQ_HEAD(g_tailq_head, g_geom); extern int g_collectstats; +#define G_STATS_PROVIDERS 1 /* Collect I/O stats for providers */ +#define G_STATS_CONSUMERS 2 /* Collect I/O stats for consumers */ + extern int g_debugflags; /* * 1 G_T_TOPOLOGY Modified: projects/camlock/sys/geom/geom_io.c ============================================================================== --- projects/camlock/sys/geom/geom_io.c Mon Oct 21 21:16:50 2013 (r256862) +++ projects/camlock/sys/geom/geom_io.c Mon Oct 21 21:32:24 2013 (r256863) @@ -510,7 +510,8 @@ g_io_request(struct bio *bp, struct g_co KASSERT(!(bp->bio_flags & BIO_ONQUEUE), ("Bio already on queue bp=%p", bp)); - if ((g_collectstats & ~(pp->stat ? 0 : 1)) != 0) + if ((g_collectstats & G_STATS_CONSUMERS) != 0 || + ((g_collectstats & G_STATS_PROVIDERS) != 0 && pp->stat != NULL)) binuptime(&bp->bio_t0); else getbinuptime(&bp->bio_t0); @@ -545,9 +546,9 @@ g_io_request(struct bio *bp, struct g_co */ mtxp = mtx_pool_find(mtxpool_sleep, pp); mtx_lock(mtxp); - if (g_collectstats & 1) + if (g_collectstats & G_STATS_PROVIDERS) devstat_start_transaction(pp->stat, &bp->bio_t0); - if (g_collectstats & 2) + if (g_collectstats & G_STATS_CONSUMERS) devstat_start_transaction(cp->stat, &bp->bio_t0); pp->nstart++; cp->nstart++; @@ -649,13 +650,14 @@ g_io_deliver(struct bio *bp, int error) * can not update one instance of the statistics from more * than one thread at a time, so grab the lock first. */ - if ((g_collectstats & ~(pp->stat ? 0 : 1)) != 0) + if ((g_collectstats & G_STATS_CONSUMERS) != 0 || + ((g_collectstats & G_STATS_PROVIDERS) != 0 && pp->stat != NULL)) binuptime(&now); mtxp = mtx_pool_find(mtxpool_sleep, cp); mtx_lock(mtxp); - if (g_collectstats & 1) + if (g_collectstats & G_STATS_PROVIDERS) devstat_end_transaction_bio_bt(pp->stat, bp, &now); - if (g_collectstats & 2) + if (g_collectstats & G_STATS_CONSUMERS) devstat_end_transaction_bio_bt(cp->stat, bp, &now); cp->nend++; pp->nend++;