Linux Device Mapper development
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: dm-devel@redhat.com
Cc: ejt@redhat.com
Subject: [for-3.19 PATCH v2 21/17] dm thin: refactor requeue_io to eliminate spinlock bouncing
Date: Sun, 19 Oct 2014 19:02:37 -0400	[thread overview]
Message-ID: <1413759757-7935-4-git-send-email-snitzer@redhat.com> (raw)
In-Reply-To: <1413759757-7935-1-git-send-email-snitzer@redhat.com>
In-Reply-To: <20141017183119.GA31854@redhat.com>

Also refactor some other bio_list erroring helpers.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/md/dm-thin.c | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 917ade5..5fb5df1 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -457,21 +457,32 @@ struct dm_thin_endio_hook {
 	struct rb_node rb_node;
 };
 
-static void requeue_bio_list(struct thin_c *tc, struct bio_list *master)
+static void __merge_bio_list(struct bio_list *bios, struct bio_list *master)
+{
+	bio_list_merge(bios, master);
+	bio_list_init(master);
+}
+
+static void error_bio_list(struct bio_list *bios, int error)
 {
 	struct bio *bio;
+
+	while ((bio = bio_list_pop(bios)))
+		bio_endio(bio, error);
+}
+
+static void error_thin_bio_list(struct thin_c *tc, struct bio_list *master, int error)
+{
 	struct bio_list bios;
 	unsigned long flags;
 
 	bio_list_init(&bios);
 
 	spin_lock_irqsave(&tc->lock, flags);
-	bio_list_merge(&bios, master);
-	bio_list_init(master);
+	__merge_bio_list(&bios, master);
 	spin_unlock_irqrestore(&tc->lock, flags);
 
-	while ((bio = bio_list_pop(&bios)))
-		bio_endio(bio, DM_ENDIO_REQUEUE);
+	error_bio_list(&bios, error);
 }
 
 static void requeue_deferred_cells(struct thin_c *tc)
@@ -493,26 +504,18 @@ static void requeue_deferred_cells(struct thin_c *tc)
 
 static void requeue_io(struct thin_c *tc)
 {
-	requeue_bio_list(tc, &tc->deferred_bio_list);
-	requeue_bio_list(tc, &tc->retry_on_resume_list);
-	requeue_deferred_cells(tc);
-}
-
-static void error_thin_retry_list(struct thin_c *tc)
-{
-	struct bio *bio;
-	unsigned long flags;
 	struct bio_list bios;
+	unsigned long flags;
 
 	bio_list_init(&bios);
 
 	spin_lock_irqsave(&tc->lock, flags);
-	bio_list_merge(&bios, &tc->retry_on_resume_list);
-	bio_list_init(&tc->retry_on_resume_list);
+	__merge_bio_list(&bios, &tc->deferred_bio_list);
+	__merge_bio_list(&bios, &tc->retry_on_resume_list);
 	spin_unlock_irqrestore(&tc->lock, flags);
 
-	while ((bio = bio_list_pop(&bios)))
-		bio_io_error(bio);
+	error_bio_list(&bios, DM_ENDIO_REQUEUE);
+	requeue_deferred_cells(tc);
 }
 
 static void error_retry_list(struct pool *pool)
@@ -521,7 +524,7 @@ static void error_retry_list(struct pool *pool)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(tc, &pool->active_thins, list)
-		error_thin_retry_list(tc);
+		error_thin_bio_list(tc, &tc->retry_on_resume_list, -EIO);
 	rcu_read_unlock();
 }
 
@@ -1752,7 +1755,7 @@ static void process_thin_deferred_bios(struct thin_c *tc)
 	unsigned count = 0;
 
 	if (tc->requeue_mode) {
-		requeue_bio_list(tc, &tc->deferred_bio_list);
+		error_thin_bio_list(tc, &tc->deferred_bio_list, DM_ENDIO_REQUEUE);
 		return;
 	}
 
-- 
1.8.3.1

      parent reply	other threads:[~2014-10-19 23:02 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  6:06 [for-3.19 PATCH 00/17] dm thin: performance improvements Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 01/17] dm bufio: switch from a huge hash table to an rbtree Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 02/17] dm bufio: evict buffers that are past the max age but retain some buffers Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 03/17] dm bio prison: switch to using a red black tree Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 04/17] dm thin metadata: change dm_thin_find_block to allow blocking, but not issuing, IO Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 05/17] dm transaction manager: add support for prefetching blocks of metadata Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 06/17] dm thin: prefetch missing metadata pages Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 07/17] dm thin: throttle incoming IO Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 08/17] dm thin: adjust max_sectors_kb based on thinp blocksize Mike Snitzer
2014-10-17  6:06 ` [for-3.19 PATCH 09/17] dm: improve documentation and code clarity in dm_merge_bvec Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 10/17] dm thin: implement thin_merge Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 11/17] dm thin: grab a virtual cell before looking up the mapping Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 12/17] dm thin: performance improvement to discard processing Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 13/17] dm thin: factor out remap_and_issue_overwrite Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 14/17] dm thin: defer whole cells rather than individual bios Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 15/17] dm thin: remap the bios in a cell immediately Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 16/17] dm thin: direct dispatch when breaking sharing Mike Snitzer
2014-10-17  6:07 ` [for-3.19 PATCH 17/17] dm thin: sort the deferred cells Mike Snitzer
2014-10-17 18:31 ` [for-3.19 PATCH 00/17] dm thin: performance improvements Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 01/17] dm bufio: switch from a huge hash table to an rbtree Mike Snitzer
2014-10-21 22:48     ` Mikulas Patocka
2014-10-22  9:41       ` Joe Thornber
2014-10-17 18:37   ` [for-3.19 PATCH v2 02/17] dm bufio: evict buffers that are past the max age but retain some buffers Mike Snitzer
2014-10-31 16:37     ` Mikulas Patocka
2014-10-17 18:37   ` [for-3.19 PATCH v2 03/17] dm bio prison: switch to using a red black tree Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 04/17] dm thin metadata: change dm_thin_find_block to allow blocking, but not issuing, IO Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 05/17] dm transaction manager: add support for prefetching blocks of metadata Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 06/17] dm thin: prefetch missing metadata pages Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 07/17] dm thin: throttle incoming IO Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 08/17] dm thin: adjust max_sectors_kb based on thinp blocksize Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 09/17] dm: improve documentation and code clarity in dm_merge_bvec Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 10/17] dm thin: implement thin_merge Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 11/17] dm thin: grab a virtual cell before looking up the mapping Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 12/17] dm thin: performance improvement to discard processing Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 13/17] dm thin: factor out remap_and_issue_overwrite Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 14/17] dm thin: defer whole cells rather than individual bios Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 15/17] dm thin: remap the bios in a cell immediately Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 16/17] dm thin: direct dispatch when breaking sharing Mike Snitzer
2014-10-17 18:37   ` [for-3.19 PATCH v2 17/17] dm thin: sort the deferred cells Mike Snitzer
2014-10-19 23:02   ` [for-3.19 PATCH v2 fix 18/17] dm thin: fix process_shared_bio (fixes SnapshotTests) Mike Snitzer
2014-10-19 23:02   ` [for-3.19 PATCH v2 fix 19/17] dm thin: requeue deferred_cells when in requeue_mode Mike Snitzer
2014-10-19 23:02   ` [for-3.19 PATCH v2 20/17] dm thin: optimize retry_bios_on_resume Mike Snitzer
2014-10-19 23:02   ` Mike Snitzer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413759757-7935-4-git-send-email-snitzer@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox