Date: Mon, 21 Oct 2013 21:32:24 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256863 - projects/camlock/sys/geom Message-ID: <201310212132.r9LLWO3x070388@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310212132.r9LLWO3x070388>