Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Nov 2010 14:08:28 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Adam Vande More <amvandemore@gmail.com>
Cc:        freebsd-stable@freebsd.org, fs@freebsd.org
Subject:   Re: top io mode
Message-ID:  <20101125120828.GN2392@deviant.kiev.zoral.com.ua>
In-Reply-To: <AANLkTikrKevf3x4nyi6=8Yz0BW=yZzf0W_Xa3XGQXy8N@mail.gmail.com>
References:  <AANLkTikrKevf3x4nyi6=8Yz0BW=yZzf0W_Xa3XGQXy8N@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--EwkcXxk9GypvHnsl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 25, 2010 at 05:28:30AM -0600, Adam Vande More wrote:
> top io doesn't seem to display stats when dealing direct with a block dev=
ice
> like so:
>=20
> dd if=3D/dev/ada0 of=3D/dev/null
>=20
> However if dd runs on a regular file eg
>=20
> dd if=3Dtest.file of=3D/dev/null
>=20
> then stats are reported in top.
>=20
> Is this the expected behavior?

I do not think so, and the patch at the end of the message worked for me.

I cannot explain the
	if (!TD_IS_IDLETHREAD(curthread))
		curthread->td_ru.ru_inblock++;
checks that are done in vfs_bio.c.

diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index d6be6e7..34072f3 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -57,10 +57,13 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
 	for (i =3D 0; i < uio->uio_iovcnt; i++) {
 		while (uio->uio_iov[i].iov_len) {
 			bp->b_flags =3D 0;
-			if (uio->uio_rw =3D=3D UIO_READ)
+			if (uio->uio_rw =3D=3D UIO_READ) {
 				bp->b_iocmd =3D BIO_READ;
-			else=20
+				curthread->td_ru.ru_inblock++;
+			} else {
 				bp->b_iocmd =3D BIO_WRITE;
+				curthread->td_ru.ru_oublock++;
+			}
 			bp->b_iodone =3D bdone;
 			bp->b_data =3D uio->uio_iov[i].iov_base;
 			bp->b_bcount =3D uio->uio_iov[i].iov_len;


--EwkcXxk9GypvHnsl
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAkzuUbwACgkQC3+MBN1Mb4hR2gCeJPD4EX57RwABvMHlOVFQH9R7
kxgAoLT+Hl6uKW+Ku51AfM37cPRxcEUE
=WP+7
-----END PGP SIGNATURE-----

--EwkcXxk9GypvHnsl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101125120828.GN2392>