I'm writing a device-mapper which has to edit incoming writes, for example: Incoming bio request contains a biovec with a page full of 0s, and I want to change it to all 1s.
I tried using bvec_kmap_local()
to get the page address, and then I can read the data and if needed adjust it using memcpy
or similar. Initial tests seemed to work, but if I execute things like mkfs
on the created dm, I get a lot of segmentation faults. I narrowed down the problem that this only happens if I actually write something to the mapped page. However, I see no reason why it should cause this fault as I (after checking probably 100 times) don't access invalid memory. I'm wondering if my method of editing the write is actually correct?
Thanks! I can provide way more information if needed