top io mode

Kostik Belousov kostikbel at gmail.com
Thu Nov 25 12:08:33 UTC 2010


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 device
> like so:
> 
> dd if=/dev/ada0 of=/dev/null
> 
> However if dd runs on a regular file eg
> 
> dd if=test.file of=/dev/null
> 
> then stats are reported in top.
> 
> 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 = 0; i < uio->uio_iovcnt; i++) {
 		while (uio->uio_iov[i].iov_len) {
 			bp->b_flags = 0;
-			if (uio->uio_rw == UIO_READ)
+			if (uio->uio_rw == UIO_READ) {
 				bp->b_iocmd = BIO_READ;
-			else 
+				curthread->td_ru.ru_inblock++;
+			} else {
 				bp->b_iocmd = BIO_WRITE;
+				curthread->td_ru.ru_oublock++;
+			}
 			bp->b_iodone = bdone;
 			bp->b_data = uio->uio_iov[i].iov_base;
 			bp->b_bcount = uio->uio_iov[i].iov_len;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20101125/3d78823f/attachment.pgp


More information about the freebsd-fs mailing list