diff options
Diffstat (limited to 'sys/geom/geom_vfs.c')
-rw-r--r-- | sys/geom/geom_vfs.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index 9be0000..499445f 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -95,6 +95,36 @@ g_vfs_done(struct bio *bip) struct g_vfs_softc *sc; struct buf *bp; int vfslocked, destroy; + struct mount *mp; + struct vnode *vp; + + /* + * Collect statistics on synchronous and asynchronous read + * and write counts for disks that have associated filesystems. + * Since this run by the g_up thread it is single threaded and + * we do not need to use atomic increments on the counters. + */ + bp = bip->bio_caller2; + vp = bp->b_vp; + if (vp == NULL) + mp = NULL; + else if (vn_isdisk(vp, NULL)) + mp = vp->v_rdev->si_mountpt; + else + mp = vp->v_mount; + if (mp != NULL) { + if (bp->b_iocmd == BIO_WRITE) { + if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC) + mp->mnt_stat.f_asyncwrites++; + else + mp->mnt_stat.f_syncwrites++; + } else { + if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC) + mp->mnt_stat.f_asyncreads++; + else + mp->mnt_stat.f_syncreads++; + } + } cp = bip->bio_from; sc = cp->geom->softc; @@ -103,7 +133,6 @@ g_vfs_done(struct bio *bip) g_print_bio(bip); printf("error = %d\n", bip->bio_error); } - bp = bip->bio_caller2; bp->b_error = bip->bio_error; bp->b_ioflags = bip->bio_flags; if (bip->bio_error) |