Re: [PATCH for-4.4] block: split bios to max possible length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 6 Jan 2016 05:51:34 +0000
Keith Busch <keith.busch@xxxxxxxxx> wrote:

> On Wed, Jan 06, 2016 at 10:17:51AM +0800, Ming Lei wrote:
> 
> But this patch was to split on stripe boundaries, which is an even worse
> penalty if we get the split wrong.
> 
> > +	bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
> >  
> >  	bio_for_each_segment(bv, bio, iter) {
> > -		if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))
> > +		if (no_sg_merge)
> > +			goto new_segment;
> 
> Bad idea for NVMe. We need to split on SG gaps, which you've skipped,
> or you will BUG_ON in the NVMe driver.

Given it is close to v4.4 release, I propose the following fix instead
of the bvec splitting approach, which is not ready in current block stack.

-----
 block/blk-merge.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index e73846a..9ffe431 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -81,8 +81,16 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
 	struct bio *new = NULL;
 
 	bio_for_each_segment(bv, bio, iter) {
-		if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))
+		if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q,
+					bio->bi_iter.bi_sector)) {
+			/*
+			 * avoid to split out zero length bio if size to
+			 * chunk boundary is too small
+			 */
+			if (!sectors)
+				goto new_segment;
 			goto split;
+		}
 
 		/*
 		 * If the queue doesn't support SG gaps and adding this
-- 
1.9.1








--
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



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux