Hi, On Fri, Jan 20, 2017 at 9:41 PM, Suraj Choudhari <surajschoudhari@xxxxxxxxx> wrote: > Hello, > > I've some queries related to accessing the 'bio_vec' and 'bi_vcnt' > members in the BIO structure after the kernel changes implemented for > the 'immutable biovecs' - > > Background - > - From the changes done for the immutable biovecs, I understand that > the driver code now no longer needs to reference the 'bi_vcnt' and > 'bi_io_vec' fields directly. Instead we can use the 'bvec_iter' > iterator in order to to access the bio_vec. > - We've iterator functions bio_iter_iovec() and bio_advance_iter() as > well, which return us literal 'struct biovecs' taking into account the > bi_bvec_done and bi_size values. > > Doubts - > 1) Few functions in the block layer and some drivers still directly > refer to the 'bi_vcnt' and 'bio_vec' members of the BIO structure > [instead of accessing bio_vecs using the bvec_iter iterator]. > Would there be some changes in the functions to compulsorily use the > 'bvec_iter' in order to access bio_vecs? If yes, are such changes Generally speaking, yes, it is always better to use iterator helpers. > related to the 'multipage biovec' feature ? Yes, it is a must for supporting multipage bvec. > > 2) Can there be some problem if a driver directly accesses the > bi_io_vec [bio_vec] in the bio structure based on the values of bi_idx > and bi_vcnt ? [instead of using the bvec_iter iterator]. The direct access can't work any more once switching to multipage bvec, and you can find some hint in the following link: https://lkml.org/lkml/2017/1/15/266 Also .bi_vcnt can't be used for BIO_CLONED bio, and it is very easy to make mistakes to access the table directly if someone don't understand the iterator details enough. Thanks, Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html