bio_for_each_segment() and bio_cur_sectors()
Posted Jan 8, 2005 1:27 UTC (Sat) by roman
Parent article: Driver porting: the BIO structure
Contrary to the article, it's not reliable to use bio_cur_sectors() within a bio_for_each_segment(bvec, bio, segno) loop. The problem is that bio_cur_sectors() uses bio->bi_idx to index into bio->bi_io_vec, but bio_for_each_segment() uses segno as an index and (rightfully) leaves bio->bi_idx unchanged.
This also applies to bio_page(), bio_offset(), and bio_data().
to post comments)