aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2016-03-10 06:25:31 +0000
committerWarner Losh <imp@FreeBSD.org>2016-03-10 06:25:31 +0000
commit8076d204dab4226e9322663f2e5038a25dc0d120 (patch)
tree2388214b587ade12d5856c1f80809b17c7b2021e /sys
parenta2531862b8d2cda7ddcc7528905a7e637c8ee2e4 (diff)
downloadsrc-8076d204dab4226e9322663f2e5038a25dc0d120.tar.gz
src-8076d204dab4226e9322663f2e5038a25dc0d120.zip
Don't assume that bio_cmd is bit mask.
Differential Revision: https://reviews.freebsd.org/D5593
Notes
Notes: svn path=/head/; revision=296605
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/geom_disk.c10
-rw-r--r--sys/geom/geom_io.c8
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index afd1fdef7a81..d503f6762d5d 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -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);
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index c233c33b3679..61f70c1c27fd 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -479,6 +479,7 @@ g_io_request(struct bio *bp, struct g_consumer *cp)
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_consumer *cp)
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));