Ultra slow write speed with custom linux "stacking" block device drive
I'm developing a simple "stacking" linux block device driver. In it's simplest form, this driver will only pass all requests to the "target" device by changing the bi_bdev on the bio.
The driver uses the "make_request" to process incoming requests as opposed with having a standard request queue set up.
The problem is that write performance using this setup makes it unusable; performance is about 10% of the target device. Read performance seem mostly unaffected.
In concept, this is pretty much the same as the MD or DM drivers in linux, but with a "noop" personality; all requests are simply passed to one single target device, always. Of course MD/DM don't suffer from the write performance problem I'm describing, so I want to find out what I'm doing wrong.
Here's the simplest driver I could write that exposes the problem:
It's been tested against 2.6.38. To try it, make sure you define TARGET_NAME to an existing device. Once loaded, /dev/passthrough will appear. To quickly test write speed, I do:
WARNING: the following will effectively write zeroes to your target device, destroying it's MBR and partitions. Don't use a target device on which you have actual data!!
Please let me know if you have any idea what I'm doing wrong, or if you have a suggestion on where to post my question to get a better chance to have it answered. Thanks!
sudo dd if=/dev/zero of=/dev/passthrough bs=1024 count=10000