diff options
author | mckusick <mckusick@FreeBSD.org> | 2012-03-28 20:49:11 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2012-03-28 20:49:11 +0000 |
commit | 9a7982e5a0267c0421856f3a43a1ae75880058f3 (patch) | |
tree | e4296e1e7484307c80036dcfa1043b1869febf17 /sys/geom | |
parent | 4d38be64d75540ce84d18b307ffc130ac5d5f2f9 (diff) | |
download | FreeBSD-src-9a7982e5a0267c0421856f3a43a1ae75880058f3.zip FreeBSD-src-9a7982e5a0267c0421856f3a43a1ae75880058f3.tar.gz |
Keep track of the mount point associated with a special device
to enable the collection of counts of synchronous and asynchronous
reads and writes for its associated filesystem. The counts are
displayed using `mount -v'.
Ensure that buffers used for paging indicate the vnode from
which they are operating so that counts of paging I/O operations
from the filesystem are collected.
This checkin only adds the setting of the mount point for the
UFS/FFS filesystem, but it would be trivial to add the setting
and clearing of the mount point at filesystem mount/unmount
time for other filesystems too.
Reviewed by: kib
Diffstat (limited to 'sys/geom')
-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) |