Welcome to the Linux Foundation Forum!

Split BIO for filter device mapping module on 3.10


Hi Guy, Dose somebody has expirences about developing linux module to filter the BIO request on block device and split the BIO to two and send half to original one and send another half to another block device?

There is a function call split_bio, but for 3.10 version it has some limitation, so I have to work out my own.

I tried 

1.Alloc two new and send down.

2.Clone two new and send down

All failed.

Any suggestion? Thanks.


  • saqman2060
    saqman2060 Posts: 777

    This sounds similar to a raid 2 function. These requests are they requests to read, copy or write to a block device?

  • saqman2060
    saqman2060 Posts: 777
    edited August 2016

    If you had to explain this to someone who is just beginning Linux. how would you explain filter bios?


    I am not much of a developer, so a Looked online for resources and there are a few. 

    1. there is a function called "bios_kmalloc" that lets you put each sector page from from a requesting bios with multiple pages to a new bios. This new bios will contain on page from the original bios and will store data to that block that that you tell it to store it to, provided that the page size is the same as the sector size. One new bios for each page. http://stackoverflow.com/questions/10596317/how-to-split-bio-into-multiple-bios
    2. How big is the bios request? In kernel version 4.3 there is a kernel function called "blk_qeued_split" which splits the bios into multiple parts if the request size is bigger than normal. 
    3. Try modifying this kernel function, "blkio.throttle.read_bps_device" to the size you want and remove "blk_queue_split()" if it is there so it want reject the reqeust. "blk_queue_split()" is available in kernel version 4.3, not sure if it is in kernel version 3.10, https://groups.google.com/forum/#!topic/linux.kernel/KwyAQrWO0hI


Upcoming Training