The book ldd says for the function blk_queue_segment_boundary() like this:
Some devices cannot handle requests that cross a particular size memory bound- ary; if your device is one of those, use this function to tell the kernel about that boundary. For example, if your device has trouble with requests that cross a 4- MB boundary, pass in a mask of 0x3fffff. The default mask is 0xffffffff.
I don't quite understand what the boundary means here, for example, I have a virtual block device, which are made of indeed 4MB files, so I want a request not exceed 4MB boundary,
unsigned long sector = blk_rq_pos(req);
unsigned long offset = sector << 9;
unsigned long nbytes = blk_rq_bytes(req);
int file_offset = offset % (1 << 22);
What I want is that (file_offset + nbytes) not greater than 4M, but indeed sometimes it exceeds 4M, so, is there any misunderstanding of blk_queue_segment_boundary() ?