Message ID | 5549AFD4.5020803@kernel.org (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Mike Snitzer |
Headers | show |
On Tue, May 05, 2015 at 11:08:20PM -0700, Ming Lin wrote: > How about below incremental patch? > - > - /* > - * If the queue doesn't support SG gaps and adding this > - * offset would create a gap, disallow it. > - */ > - if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && > - bvec_gap_to_prev(prev, offset)) > - return 0; You need to keep the explicit checks for the BLOCK_PC case, as we can't split those. Otherwise it looks fine. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
On Tue, May 5, 2015 at 11:48 PM, Christoph Hellwig <hch@infradead.org> wrote: > On Tue, May 05, 2015 at 11:08:20PM -0700, Ming Lin wrote: >> How about below incremental patch? > >> - >> - /* >> - * If the queue doesn't support SG gaps and adding this >> - * offset would create a gap, disallow it. >> - */ >> - if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && >> - bvec_gap_to_prev(prev, offset)) >> - return 0; > > You need to keep the explicit checks for the BLOCK_PC case, as we can't > split those. I'll keep it. Thanks. > > Otherwise it looks fine. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
diff --git a/block/bio.c b/block/bio.c index ae31cdb..3f6bd9a 100644 --- a/block/bio.c +++ b/block/bio.c @@ -743,14 +743,6 @@ int bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page bio->bi_iter.bi_size += len; goto done; } - - /* - * If the queue doesn't support SG gaps and adding this - * offset would create a gap, disallow it. - */ - if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && - bvec_gap_to_prev(prev, offset)) - return 0; } if (bio->bi_vcnt >= bio->bi_max_vecs) diff --git a/block/blk-merge.c b/block/blk-merge.c index 9d565a0..32f6d6c 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -78,6 +78,14 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, if (sectors > queue_max_sectors(q)) goto split; + /* + * If the queue doesn't support SG gaps and adding this + * offset would create a gap, disallow it. + */ + if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && + prev && bvec_gap_to_prev(&bvprv, bv.bv_offset)) + goto split; + if (prev && blk_queue_cluster(q)) { if (seg_size + bv.bv_len > queue_max_segment_size(q)) goto new_segment;