This becomes prety unreadable with all the long lines. Can you do a little refactoring, with: 1) a prep patch that splits out a helper to write the bitmap to one device (i.e. the main loop body) 2) add a helper that returns the optimal I/O sizse in your new patch. Please also use unsigned int instead of plain int for the I/O size everywhere as it can't be signed. > /* DATA BITMAP METADATA */ > + loff_t off = offset + (long)(page->index * (PAGE_SIZE/512)); And all the arithmetics here look ott to say nicely. page->index is a pgoff_t, and multiplying it could cause overflows on 32-bit architetures, so you need to cast it to a 64-bit type before multiplying it. It also will be unsigned, and I'm not quite sure if loff_t is the right type for something that is in Linux block number uints, that would usually be a sector_t. Last but not least it should be using SECTOR_SIZe and have whitespaces around the operators. I know at least some of this is pre-existing in the coe, but I think this is a good time to get it right.