diff options
author | Alexander Motin <mav@FreeBSD.org> | 2019-12-31 03:43:13 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2019-12-31 03:43:13 +0000 |
commit | 4aa1289a38c8e5252b28d75cc0cd607e65638774 (patch) | |
tree | f70b8ae7d68dc74365a5211ecdcd89683d0a653a | |
parent | 29001a810a6467961f1096fe6ef1936f6363e918 (diff) |
Notes
-rw-r--r-- | sys/geom/geom_disk.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 8242e06f3dbf..79801fd556de 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); struct g_disk_softc { struct disk *dp; + struct devstat *d_devstat; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; char led[64]; @@ -231,15 +232,13 @@ g_disk_done(struct bio *bp) struct g_disk_softc *sc; /* See "notes" for why we need a mutex here */ - /* XXX: will witness accept a mix of Giant/unGiant drivers here ? */ + sc = bp->bio_caller1; bp2 = bp->bio_parent; - sc = bp2->bio_to->private; - bp->bio_completed = bp->bio_length - bp->bio_resid; binuptime(&now); mtx_lock(&sc->done_mtx); if (bp2->bio_error == 0) bp2->bio_error = bp->bio_error; - bp2->bio_completed += bp->bio_completed; + bp2->bio_completed += bp->bio_length - bp->bio_resid; switch (bp->bio_cmd) { case BIO_ZONE: @@ -249,7 +248,7 @@ g_disk_done(struct bio *bp) case BIO_WRITE: case BIO_DELETE: case BIO_FLUSH: - devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); + devstat_end_transaction_bio_bt(sc->d_devstat, bp, &now); break; default: break; @@ -469,6 +468,7 @@ g_disk_start(struct bio *bp) bp->bio_error = ENOMEM; } bp2->bio_done = g_disk_done; + bp2->bio_caller1 = sc; bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize; bp2->bio_bcount = bp2->bio_length; bp2->bio_disk = dp; @@ -555,6 +555,7 @@ g_disk_start(struct bio *bp) return; } bp2->bio_done = g_disk_done; + bp2->bio_caller1 = sc; bp2->bio_disk = dp; devstat_start_transaction_bio(dp->d_devstat, bp2); dp->d_strategy(bp2); @@ -706,6 +707,7 @@ g_disk_create(void *arg, int flag) sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF); sc->dp = dp; + sc->d_devstat = dp->d_devstat; gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); gp->softc = sc; LIST_FOREACH(dap, &dp->d_aliases, da_next) { |