diff mbox series

[2/6] block: don't merge adjacent bvecs to one segment in bio blk_queue_split

Message ID 20190309013737.27741-3-ming.lei@redhat.com (mailing list archive)
State New, archived
Headers show
Series block: enable multi-page bvec for passthrough IO | expand

Commit Message

Ming Lei March 9, 2019, 1:37 a.m. UTC
For normal filesystem IO, each page is added via blk_add_page(),
in which bvec(page) merge has been handled already, and basically
not possible to merge two adjacent bvecs in one bio.

So not try to merge two adjacent bvecs in blk_queue_split(), also add
check if one page is mergeable to current bvec in bio_add_page() for
avoiding to break XEN.

Cc: ris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org
Cc: Omar Sandoval <osandov@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/bio.c       |  2 ++
 block/blk-merge.c | 17 -----------------
 2 files changed, 2 insertions(+), 17 deletions(-)

Comments

Christoph Hellwig March 11, 2019, 2:21 p.m. UTC | #1
On Sat, Mar 09, 2019 at 09:37:33AM +0800, Ming Lei wrote:
> For normal filesystem IO, each page is added via blk_add_page(),
> in which bvec(page) merge has been handled already, and basically
> not possible to merge two adjacent bvecs in one bio.
> 
> So not try to merge two adjacent bvecs in blk_queue_split(), also add
> check if one page is mergeable to current bvec in bio_add_page() for
> avoiding to break XEN.

Isn't this two entirely different things?  Both look good to me,
but I don't understand why this is one patch vs two.
Boris Ostrovsky March 11, 2019, 7:58 p.m. UTC | #2
On Sat, Mar 09, 2019 at 09:37:33AM +0800, Ming Lei wrote:
> For normal filesystem IO, each page is added via blk_add_page(),
> in which bvec(page) merge has been handled already, and basically
> not possible to merge two adjacent bvecs in one bio.
> 
> So not try to merge two adjacent bvecs in blk_queue_split(), also add
> check if one page is mergeable to current bvec in bio_add_page() for
> avoiding to break XEN.
> 
> Cc: ris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: xen-devel@lists.xenproject.org
> Cc: Omar Sandoval <osandov@fb.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>  block/bio.c       |  2 ++
>  block/blk-merge.c | 17 -----------------
>  2 files changed, 2 insertions(+), 17 deletions(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index 71a78d9fb8b7..d8f48188937c 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -776,6 +776,8 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
>  
>  		if (vec_end_addr + 1 != page_addr + off)
>  			return false;
> +		if (xen_domain() && !xen_biovec_phys_mergeable(bv, page))
> +			return false;
>  		if (same_page && (vec_end_addr & PAGE_MASK) != page_addr)
>  			return false;
>  

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Ming Lei March 12, 2019, 1:22 a.m. UTC | #3
On Mon, Mar 11, 2019 at 03:21:06PM +0100, Christoph Hellwig wrote:
> On Sat, Mar 09, 2019 at 09:37:33AM +0800, Ming Lei wrote:
> > For normal filesystem IO, each page is added via blk_add_page(),
> > in which bvec(page) merge has been handled already, and basically
> > not possible to merge two adjacent bvecs in one bio.
> > 
> > So not try to merge two adjacent bvecs in blk_queue_split(), also add
> > check if one page is mergeable to current bvec in bio_add_page() for
> > avoiding to break XEN.
> 
> Isn't this two entirely different things?  Both look good to me,
> but I don't understand why this is one patch vs two.

You are right, it should have been two things logically.

Thanks,
Ming
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 71a78d9fb8b7..d8f48188937c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -776,6 +776,8 @@  bool __bio_try_merge_page(struct bio *bio, struct page *page,
 
 		if (vec_end_addr + 1 != page_addr + off)
 			return false;
+		if (xen_domain() && !xen_biovec_phys_mergeable(bv, page))
+			return false;
 		if (same_page && (vec_end_addr & PAGE_MASK) != page_addr)
 			return false;
 
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 1c9d4f0f96ea..aa9164eb7187 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -267,23 +267,6 @@  static struct bio *blk_bio_segment_split(struct request_queue *q,
 			goto split;
 		}
 
-		if (bvprvp) {
-			if (seg_size + bv.bv_len > queue_max_segment_size(q))
-				goto new_segment;
-			if (!biovec_phys_mergeable(q, bvprvp, &bv))
-				goto new_segment;
-
-			seg_size += bv.bv_len;
-			bvprv = bv;
-			bvprvp = &bvprv;
-			sectors += bv.bv_len >> 9;
-
-			if (nsegs == 1 && seg_size > front_seg_size)
-				front_seg_size = seg_size;
-
-			continue;
-		}
-new_segment:
 		if (nsegs == max_segs)
 			goto split;