Neil Brown wrote:
On Tuesday June 13, liudows2@xxxxxxxxx wrote:
hello,everyone.
I am studying the code of raid0.But I find that the logic of
raid0_make_request is a little difficult to understand.
Who can tell me what the function of raid0_make_request will do eventually?
One of two possibilities.
Most often it will update bio->bi_dev and bio->bi_sector to refer to
the correct location on the correct underlying devices, and then
will return '1'.
The fact that it returns '1' is noticed by generic_make_request in
block/ll_rw_block.c and generic_make_request will loop around and
retry the request on the new device at the new offset.
However in the unusual case that the request cross a chunk boundary
and so needs to be sent to two different devices, raidi_make_request
will split the bio into to (using bio_split) will submit each of the
two bios directly down to the appropriate devices - and will then
return '0', so that generic make request doesn't loop around.
I hope that helps.
Helps me, anyway, thanks! Wish the comments on stuff like that in
general were clear, you can see what the code *does*, but you have to
hope that it's what the coder *intended*. And if you're looking for a
bug it may not be, so this is not an idle complaint.
Some of the kernel coders think "if it was hard to write it should be
hard to understand."
--
bill davidsen <davidsen@xxxxxxx>
CTO TMR Associates, Inc
Doing interesting things with small computers since 1979
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html