When implementing a device driver or a MD device which can receive Block I/O (struct bio in the kernel), you can receive BIO of nearly any size, with any number of segments (segments are discontinued parts of a common buffer, defined in a bio request). You may want to limit :
– The number of segments you can receive with
Where X is the number of segments per struct bio
– The maximal size of the request :
Where Y is the maximal size in sectors
For a md device, the queue can be recovered with mddev->queue
The combination of the two allows to limit ensure that all bio request have always maximum X segments for a maximal size of Y sectors.
It is used in raid0 with Y=mddev->chunk_sectors to ensure that no request is bigger than one chunk, so any request cross at most one chunk boundary. And with X=1, it allows to use the bio_split function to split a request which would span on the two sides of a chunk boundary.