Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1627017 > unrolled thread

[PATCH 08/11] xen-blkfront: remove bio splitting.

Started byNeilBrown <neilb@suse.com>
First post2017-04-20 08:30 +0200
Last post2017-04-21 13:50 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 08/11] xen-blkfront: remove bio splitting. NeilBrown <neilb@suse.com> - 2017-04-20 08:30 +0200
    Re: [PATCH 08/11] xen-blkfront: remove bio splitting. Roger Pau Monné <roger.pau@citrix.com> - 2017-04-20 12:10 +0200
    Re: [PATCH 08/11] xen-blkfront: remove bio splitting. Christoph Hellwig <hch@infradead.org> - 2017-04-21 13:40 +0200
      Re: [PATCH 08/11] xen-blkfront: remove bio splitting. Roger Pau Monne <roger.pau@citrix.com> - 2017-04-21 13:50 +0200

#1627017 — [PATCH 08/11] xen-blkfront: remove bio splitting.

FromNeilBrown <neilb@suse.com>
Date2017-04-20 08:30 +0200
Subject[PATCH 08/11] xen-blkfront: remove bio splitting.
Message-ID<tydLj-5pI-3@gated-at.bofh.it>
bios that are re-submitted will pass through blk_queue_split() when
blk_queue_bio() is called, and this will split the bio if necessary.
There is no longer any need to do this splitting in xen-blkfront.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/block/xen-blkfront.c |   54 ++----------------------------------------
 1 file changed, 3 insertions(+), 51 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index abed296ce605..b8930d9b7102 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -110,11 +110,6 @@ struct blk_shadow {
 	unsigned long associated_id;
 };
 
-struct split_bio {
-	struct bio *bio;
-	atomic_t pending;
-};
-
 static DEFINE_MUTEX(blkfront_mutex);
 static const struct block_device_operations xlvbd_block_fops;
 
@@ -1982,28 +1977,13 @@ static int blkfront_probe(struct xenbus_device *dev,
 	return 0;
 }
 
-static void split_bio_end(struct bio *bio)
-{
-	struct split_bio *split_bio = bio->bi_private;
-
-	if (atomic_dec_and_test(&split_bio->pending)) {
-		split_bio->bio->bi_phys_segments = 0;
-		split_bio->bio->bi_error = bio->bi_error;
-		bio_endio(split_bio->bio);
-		kfree(split_bio);
-	}
-	bio_put(bio);
-}
-
 static int blkif_recover(struct blkfront_info *info)
 {
-	unsigned int i, r_index;
+	unsigned int r_index;
 	struct request *req, *n;
 	int rc;
-	struct bio *bio, *cloned_bio;
-	unsigned int segs, offset;
-	int pending, size;
-	struct split_bio *split_bio;
+	struct bio *bio;
+	unsigned int segs;
 
 	blkfront_gather_backend_features(info);
 	/* Reset limits changed by blk_mq_update_nr_hw_queues(). */
@@ -2042,34 +2022,6 @@ static int blkif_recover(struct blkfront_info *info)
 
 	while ((bio = bio_list_pop(&info->bio_list)) != NULL) {
 		/* Traverse the list of pending bios and re-queue them */
-		if (bio_segments(bio) > segs) {
-			/*
-			 * This bio has more segments than what we can
-			 * handle, we have to split it.
-			 */
-			pending = (bio_segments(bio) + segs - 1) / segs;
-			split_bio = kzalloc(sizeof(*split_bio), GFP_NOIO);
-			BUG_ON(split_bio == NULL);
-			atomic_set(&split_bio->pending, pending);
-			split_bio->bio = bio;
-			for (i = 0; i < pending; i++) {
-				offset = (i * segs * XEN_PAGE_SIZE) >> 9;
-				size = min((unsigned int)(segs * XEN_PAGE_SIZE) >> 9,
-					   (unsigned int)bio_sectors(bio) - offset);
-				cloned_bio = bio_clone(bio, GFP_NOIO);
-				BUG_ON(cloned_bio == NULL);
-				bio_trim(cloned_bio, offset, size);
-				cloned_bio->bi_private = split_bio;
-				cloned_bio->bi_end_io = split_bio_end;
-				submit_bio(cloned_bio);
-			}
-			/*
-			 * Now we have to wait for all those smaller bios to
-			 * end, so we can also end the "parent" bio.
-			 */
-			continue;
-		}
-		/* We don't need to split this bio */
 		submit_bio(bio);
 	}
 

[toc] | [next] | [standalone]


#1627264

FromRoger Pau Monné <roger.pau@citrix.com>
Date2017-04-20 12:10 +0200
Message-ID<tyhce-7D4-5@gated-at.bofh.it>
In reply to#1627017
On Thu, Apr 20, 2017 at 03:38:50PM +1000, NeilBrown wrote:
> bios that are re-submitted will pass through blk_queue_split() when
> blk_queue_bio() is called, and this will split the bio if necessary.
> There is no longer any need to do this splitting in xen-blkfront.
> 
> Signed-off-by: NeilBrown <neilb@suse.com>

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

> ---
>  drivers/block/xen-blkfront.c |   54 ++----------------------------------------
>  1 file changed, 3 insertions(+), 51 deletions(-)

Nice!

[toc] | [prev] | [next] | [standalone]


#1628170

FromChristoph Hellwig <hch@infradead.org>
Date2017-04-21 13:40 +0200
Message-ID<tyF4T-5fu-33@gated-at.bofh.it>
In reply to#1627017
Btw, I really don't understand why this code even looks at bios over
just requeueing the request.  Can someone explain that bit to me?

[toc] | [prev] | [next] | [standalone]


#1628176

FromRoger Pau Monne <roger.pau@citrix.com>
Date2017-04-21 13:50 +0200
Message-ID<tyFey-5iI-19@gated-at.bofh.it>
In reply to#1628170
On Fri, Apr 21, 2017 at 04:36:20AM -0700, Christoph Hellwig wrote:
> Btw, I really don't understand why this code even looks at bios over
> just requeueing the request.  Can someone explain that bit to me?

This was done because Linux could migrate from a host supporting indirect
descriptors to a host not supporting them, and so the maximum number of
segments per request could change, and the requests already on the queue might
need to be split.

Roger.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web