INTRODUCTION:
-------------
You can find in this directory a patch to enhance Linux kernel disk
accounting in order to get a true iostat command working.
Please note that it is NOT compulsory to apply the patch to the kernel for
iostat to work, but if you do so you will be able to monitor real I/O
transfer rate on a per-device basis. 

This is the fourth version of my patch. It gives you the real I/O transfer
rate in kilobytes per second, even if the filesystem is mounted.
It has been tested successfully on IDE and SCSI systems.
Ok, I have been using my patch for quite a while now and have never experienced
problems with it. The patch is very simple by nature and is quite unlikely to
induce problems in the kernel. Please tell me if you get weird things anyway...
I would also be really happy if this patch could go into the mainstream kernel
one day...


HOW DOES THE PATCH WORK?
------------------------
Just look in the diff file provided ;-)
Basically it adds two new fields in /proc/stat: 'disk_pgin' and 'disk_pgout'.
These fields contain the number of pages the system brought in and out for
the first four devices.
This is just like the 'page' field but this one gives the total number of
pages brought in and out without any distinction between the block devices.


HOW TO APPLY THE PATCH?
-----------------------
Suppose you have the 2.2.16 kernel sources installed in the /usr/src/linux
directory. So you want to apply the patch named "iopatch-2.2.16-v4.gz".

Log in as root and copy the patch file into the /usr/src directory.
Then enter:

# cd /usr/src
# zcat iopatch-2.2.16-v4.gz | patch -p1 -s -N -E -d /usr/src/linux

Recompile the kernel (see the README file in the kernel tree), reboot,
et voila!

Then you have to compile iostat with disk accounting support: go into the
sysstat source tree, enter "make config" and answer "y" (in lower case
and without the quotes) to the question:

Support for improved disk accounting? [EXPERIMENTAL]

Then compile with "make; make install" as usual.


PATCHES SUPPLIED WITH SYSSTAT:
------------------------------
The only supplied patch is iopatch-2.2.16-v4.gz, which is the patch
against the "official" 2.2.16 kernel (latest one at this time). 

If you are a bit of a hacker, you can _easily_ make it
suitable for another linux kernel...
Patches against other kernels can be found on sysstat web page, at
http://perso.wanadoo.fr/sebastien.godard/

Here is how I made the patch file:
/usr/src/linux-x.y.z contains the original kernel source tree, and
/usr/src/linux the modified one.

# cd /usr/src
# diff -u --recursive --new-file linux-x.y.z linux > iopatch-x.y.z
# gzip -v9 iopatch-x.y.z

The patch currently touches the following kernel files:

linux/drivers/block/ll_rw_blk.c
linux/drivers/block/md.c
linux/drivers/block/raid1.c
linux/drivers/block/raid5.c
linux/fs/proc/array.c
linux/include/linux/kernel_stat.h
linux/include/linux/blkdev.h

--
Sebastien Godard <sebastien.godard@wanadoo.fr>
