Skip to contentSkip to conversation

block: Split bios on chunk boundaries

PATCH New Keith Busch 2 participants 2 messages Dec 22, 2015 – Dec 23, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Split bios on chunk boundaries

For h/w that advertise their block storage's underlying chunk size, it's a big performance win to not submit commands that cross them. This patch uses that criteria if it is provided. If it is not provided, this patch uses the max sectors as before.

Signed-off-by Keith Busch <keith.busch at intel.com>
---
 block/blk-merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-merge.c +1 -1
index 0e5643a..d05fdd2 100644
@@ -83,7 +83,7 @@ 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) > queue_max_sectors(q))
+		if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))
 			goto split;
 
 		/*
Signature · 1 line
2.6.2.307.g37023ba
#1 lore raw

PATCH 1/1 block: Split bios on chunk boundaries

Quoted 15 lines · Keith Busch

For h/w that advertise their block storage's underlying chunk size, it's a big performance win to not submit commands that cross them. This patch uses that criteria if it is provided. If it is not provided, this patch uses the max sectors as before.

Signed-off-by Keith Busch <keith.busch at intel.com>
---
  block/blk-merge.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-merge.c +0 -0
index 0e5643a..d05fdd2 100644

block/blk-merge.c static struct bio *blk_bio_segment_split(struct request_queue *q, · line 89

Quoted 8 lines
block/blk-merge.c +1 -1
@@ -83,7 +83,7 @@ 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) > queue_max_sectors(q))
+		if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))
  			goto split;
 
  		/*

Looks good, will apply. Thanks Keith!

Signature · 1 line
Jens Axboe