LWN.net Logo

bio_for_each_segment() and bio_cur_sectors()

bio_for_each_segment() and bio_cur_sectors()

Posted Jan 8, 2005 1:27 UTC (Sat) by roman (subscriber, #24157)
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().


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds