reqlog - Linux kernel patch to monitor disk reads/writes Copyright (c) 1999, Malcolm Beattie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This is reqlog version 0.3. reqlog is a small patch to the Linux 2.2.12 kernel which writes brief details of each physical disk read/write to a ring buffer from where a userland program can make use of the information. Example uses of this information are for hot migration of live in-use block devices, as by the bmigrate suite available at ftp://ftp.ox.ac.uk/pub/linux/bmigrate-0.3.tar.gz or detailed disk I/O monitoring utilities (I'm going to write one Real Soon Now). INSTALLATION This patch relies on one other patch to applied: the bufflink patch which allows fast, lightweight communications between kernel and userland. You can get the bufflink patch from ftp://ftp.ox.ac.uk/pub/linux/bufflink-0.3.tar.gz Once the bufflink patch is applied (if you've only just applied it, you can apply this reqlog patch now before compiling your kernel), apply the reqlog patch with cd /usr/src/linux patch -p1 < reqlog-2.2.12.patch Run your favourite kernel configuration tool (e.g. make config, make menuconfig, make xconfig, make oldconfig) and say Y to the options CONFIG_EXPERIMENTAL and CONFIG_REQUEST_LOG (and if you've only just applied the bufflink patch then ensure you also remember to turn on CONFIG_BUFFLINK_KERNEL and CONFIG_BUFFLINK as described in the bufflink documentation). Once you've built your new kernel, ensure you create a device node for reqlog: mknod -m 0600 /dev/reqlog c 120 0 Note there the "-m 0600" which is equivalent to "chmod 0600 /dev/reqlog". The semantics of the permissions on /dev/reqlog are that anyone with read permission can read which sectors on disk have been read/written (interfering with any other process doing the same since the data can only be read once) and anyone with write access to /dev/reqlog can enable/disable logging. Compiling and running the utility program "reqlog" in this distribution shows: Usage: reqlog enable|disable|read device Doing "reqlog enable /dev/reqlog" turns on kernel logging of disk I/O requests and "reqlog disables /dev/reqlog" it. You can use reqlog read /dev/reqlog as a simplistic way of displaying the information that reqlog records: for each physical disk I/O you will see a line such as device 3/1 sector 107936 write 2 which means that a disk write has just been issued for 2 sectors (2 * 512 bytes = 1KB) at sector 107936 on the block device with major 3 and minor 1 (/dev/hda1). Malcolm Beattie mbeattie@sable.ox.ac.uk 1 November 1999