• Mike Snitzer's avatar
    dm: improve documentation and code clarity in dm_merge_bvec · 148e51ba
    Mike Snitzer authored
    These code changes do not introduce a functional change.
    
    But bio_add_page() will never attempt to build up a bio larger than
    queue_max_sectors().  Similarly, bio_get_nr_vecs() is also bound by
    queue_max_sectors().  Therefore, there is no point in allowing
    dm_merge_bvec() to answer "how many sectors can a bio have at this
    offset?" with anything larger than queue_max_sectors().  Using
    queue_max_sectors() rather than BIO_MAX_SECTORS serves to more
    accurately convey the limits that are being imposed.
    
    Also, use unlikely() to clarify the fact that the defensive code in
    dm_merge_bvec() relative to max_size going negative shouldn't ever
    happen -- if it does happen there is a bug in the block layer for
    requesting larger than dm_merge_bvec()'s initial response for a given
    offset.  Also, update a comment in dm_merge_bvec() relative to
    max_hw_sectors_kb.  And fix empty newline whitespace.
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    148e51ba
dm.c 69.5 KB