Simple device mapper that propagate io operations to mapped device and count requests and averarge block size (both for write and read operations).
Results are available through sysfs.
To build module just use make:
$ makeTo clean artifacts:
$ make cleanInsert a module into a kernel:
# insmod dmp.koCreate test block device:
# dmsetup create $test1 --table "0 512 zero"Create proxy device (provided by this module):
# dmsetup create dmp1 --table "0 512 dmp /dev/mapper/$test1"Some read/write operations:
# dd if=/dev/random of=/dev/mapper/dmp1 bs=4k count=1
# dd of=/dev/null if=/dev/mapper/dmp1 bs=4k count=1To see statistics, use
$ cat /sys/module/dmp/$test1/statnote: since we are interested in underlying device and creating more than one proxy for device is forbidden, sysfs folder named by underlying device.
Run init script with root privileges which create one device (zero1) with proxy device (dmp0) and one device (zero2) with one proxy device (dmp2) and one proxy device to itself (dmp3 -> dmp2).
Now you can do different read/write operations and check results using
$ cat /sys/module/dmp/$dev/statTo remove test devices and remove module run end script.
Also test script provided. It covers some simple test cases.
Tested on Artix Linux (with OpenRC) with kernel release 6.7.4-artix1-1.