diff options
author | mckusick <mckusick@FreeBSD.org> | 1999-12-01 02:09:30 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 1999-12-01 02:09:30 +0000 |
commit | a7a8ed1423843607656950db4061ebb31fd1e7d0 (patch) | |
tree | b0c34665672f470d0c72f6ed5f9d861120597e4a /sys/fs/specfs | |
parent | 4a057a051637196347444904a661495efcdbb941 (diff) | |
download | FreeBSD-src-a7a8ed1423843607656950db4061ebb31fd1e7d0.zip FreeBSD-src-a7a8ed1423843607656950db4061ebb31fd1e7d0.tar.gz |
Collect read and write counts for filesystems. This new code
drops the counting in bwrite and puts it all in spec_strategy.
I did some tests and verified that the counts collected for writes
in spec_strategy is identical to the counts that we previously
collected in bwrite. We now also get read counts (async reads
come from requests for read-ahead blocks). Note that you need
to compile a new version of mount to get the read counts printed
out. The old mount binary is completely compatible, the only
reason to install a new mount is to get the read counts printed.
Submitted by: Craig A Soules <soules+@andrew.cmu.edu>
Reviewed by: Kirk McKusick <mckusick@mckusick.com>
Diffstat (limited to 'sys/fs/specfs')
-rw-r--r-- | sys/fs/specfs/spec_vnops.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index a66597d..9a8ad45 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -406,11 +406,32 @@ spec_strategy(ap) } */ *ap; { struct buf *bp; + struct vnode *vp; + struct mount *mp; bp = ap->a_bp; if (((bp->b_flags & B_READ) == 0) && (LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start) (*bioops.io_start)(bp); + + /* + * Collect statistics on synchronous and asynchronous read + * and write counts for disks that have associated filesystems. + */ + vp = ap->a_vp; + if (vn_isdisk(vp) && (mp = vp->v_specmountpoint) != NULL) { + if ((bp->b_flags & B_READ) == 0) { + if (bp->b_lock.lk_lockholder == LK_KERNPROC) + mp->mnt_stat.f_asyncwrites++; + else + mp->mnt_stat.f_syncwrites++; + } else { + if (bp->b_lock.lk_lockholder == LK_KERNPROC) + mp->mnt_stat.f_asyncreads++; + else + mp->mnt_stat.f_syncreads++; + } + } KASSERT(devsw(bp->b_dev) != NULL, ("No devsw on dev %s responsible for buffer %p\n", devtoname(bp->b_dev), bp)); |