Skip to content

Latest commit

 

History

History
70 lines (45 loc) · 1.53 KB

File metadata and controls

70 lines (45 loc) · 1.53 KB

device mapper proxy

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.

Build

To build module just use make:

$ make

To clean artifacts:

$ make clean

Usage

Insert a module into a kernel:

# insmod dmp.ko

Create 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=1

To see statistics, use

$ cat /sys/module/dmp/$test1/stat

note: since we are interested in underlying device and creating more than one proxy for device is forbidden, sysfs folder named by underlying device.

Testing

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/stat

To 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.