The actual recaculation of segments in __blk_recalc_rq_segments will
do this check, so there is no point in forcing it if we know it won't
succeed.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
}
/* If we may be able to merge these biovecs, force a recount */
- if (bio->bi_vcnt > 1 && biovec_phys_mergeable(bvec-1, bvec))
+ if (bio->bi_vcnt > 1 &&
+ biovec_phys_mergeable(bvec - 1, bvec) &&
+ BIOVEC_SEG_BOUNDARY(q, bvec - 1, bvec))
bio_clear_flag(bio, BIO_SEG_VALID);
done: