• Ming Lei's avatar
    block: fix segment calculation for passthrough IO · 05b700ba
    Ming Lei authored
    blk_recount_segments() can be called in bio_add_pc_page() for
    calculating how many segments this bio will has after one page is added
    to this bio. If the resulted segment number is beyond the queue limit,
    the added page will be removed.
    
    The try-and-fix policy requires blk_recount_segments(__blk_recalc_rq_segments)
    to not consider the segment number limit. Unfortunately bvec_split_segs()
    does check this limit, and causes small segment number returned to
    bio_add_pc_page(), then page still may be added to the bio even though
    segment number limit becomes broken.
    
    Fixes this issue by not considering segment number limit when calcualting
    bio's segment number.
    
    Fixes: dcebd755 ("block: use bio_for_each_bvec() to compute multi-page bvec count")
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Omar Sandoval <osandov@fb.com>
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    05b700ba
blk-merge.c 24.1 KB