Date: Thu, 10 Mar 2016 06:25:32 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296605 - head/sys/geom Message-ID: <201603100625.u2A6PWCU034281@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Mar 10 06:25:31 2016 New Revision: 296605 URL: https://svnweb.freebsd.org/changeset/base/296605 Log: Don't assume that bio_cmd is bit mask. Differential Revision: https://reviews.freebsd.org/D5593 Modified: head/sys/geom/geom_disk.c head/sys/geom/geom_io.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Thu Mar 10 06:25:05 2016 (r296604) +++ head/sys/geom/geom_disk.c Thu Mar 10 06:25:31 2016 (r296605) @@ -225,8 +225,16 @@ 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|BIO_FLUSH)) != 0) + switch (bp->bio_cmd) { + case BIO_READ: + case BIO_WRITE: + case BIO_DELETE: + case BIO_FLUSH: devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); + break; + default: + break; + } bp2->bio_inbed++; if (bp2->bio_children == bp2->bio_inbed) { mtx_unlock(&sc->done_mtx); Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Thu Mar 10 06:25:05 2016 (r296604) +++ head/sys/geom/geom_io.c Thu Mar 10 06:25:31 2016 (r296605) @@ -479,6 +479,7 @@ g_io_request(struct bio *bp, struct g_co struct g_provider *pp; struct mtx *mtxp; int direct, error, first; + uint8_t cmd; KASSERT(cp != NULL, ("NULL cp in g_io_request")); KASSERT(bp != NULL, ("NULL bp in g_io_request")); @@ -500,16 +501,17 @@ g_io_request(struct bio *bp, struct g_co bp->_bio_cflags = bp->bio_cflags; #endif - if (bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_GETATTR)) { + cmd = bp->bio_cmd; + if (cmd == BIO_READ || cmd == BIO_WRITE || cmd == BIO_GETATTR) { KASSERT(bp->bio_data != NULL, ("NULL bp->data in g_io_request(cmd=%hhu)", bp->bio_cmd)); } - if (bp->bio_cmd & (BIO_DELETE|BIO_FLUSH)) { + if (cmd == BIO_DELETE || cmd == BIO_FLUSH) { KASSERT(bp->bio_data == NULL, ("non-NULL bp->data in g_io_request(cmd=%hhu)", bp->bio_cmd)); } - if (bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) { + if (cmd == BIO_READ || cmd == BIO_WRITE || cmd == BIO_DELETE) { KASSERT(bp->bio_offset % cp->provider->sectorsize == 0, ("wrong offset %jd for sectorsize %u", bp->bio_offset, cp->provider->sectorsize));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603100625.u2A6PWCU034281>