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 fix 19/17] dm thin: requeue deferred_cells when in requeue_mode
Date: Sun, 19 Oct 2014 19:02:35 -0400	[thread overview]
Message-ID: <1413759757-7935-2-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>

Fold into "dm thin: defer whole cells rather than individual bios"

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

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index f5c59cf..1351df0 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -382,6 +382,11 @@ static void cell_success(struct pool *pool, struct dm_bio_prison_cell *cell)
 	cell_error_with_code(pool, cell, 0);
 }
 
+static void cell_requeue(struct pool *pool, struct dm_bio_prison_cell *cell)
+{
+	cell_error_with_code(pool, cell, DM_ENDIO_REQUEUE);
+}
+
 /*----------------------------------------------------------------*/
 
 /*
@@ -469,10 +474,28 @@ static void requeue_bio_list(struct thin_c *tc, struct bio_list *master)
 		bio_endio(bio, DM_ENDIO_REQUEUE);
 }
 
+static void requeue_deferred_cells(struct thin_c *tc)
+{
+	struct pool *pool = tc->pool;
+	unsigned long flags;
+	struct list_head cells;
+	struct dm_bio_prison_cell *cell, *tmp;
+
+	INIT_LIST_HEAD(&cells);
+
+	spin_lock_irqsave(&tc->lock, flags);
+	list_splice_init(&tc->deferred_cells, &cells);
+	spin_unlock_irqrestore(&tc->lock, flags);
+
+	list_for_each_entry_safe(cell, tmp, &cells, user_list)
+		cell_requeue(pool, cell);
+}
+
 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)
@@ -1260,6 +1283,11 @@ static void process_discard_cell(struct thin_c *tc, struct dm_bio_prison_cell *c
 	struct dm_thin_lookup_result lookup_result;
 	struct dm_thin_new_mapping *m;
 
+	if (tc->requeue_mode) {
+		cell_requeue(pool, cell);
+		return;
+	}
+
 	r = dm_thin_find_block(tc->td, block, 1, &lookup_result);
 	switch (r) {
 	case 0:
@@ -1499,6 +1527,11 @@ static void process_cell(struct thin_c *tc, struct dm_bio_prison_cell *cell)
 	dm_block_t block = get_bio_block(tc, bio);
 	struct dm_thin_lookup_result lookup_result;
 
+	if (tc->requeue_mode) {
+		cell_requeue(pool, cell);
+		return;
+	}
+
 	r = dm_thin_find_block(tc->td, block, 1, &lookup_result);
 	switch (r) {
 	case 0:
@@ -1815,12 +1848,6 @@ static void process_thin_deferred_cells(struct thin_c *tc)
 	struct dm_bio_prison_cell *cell;
 	unsigned i, j, count;
 
-	// FIXME: push down into per cell processing
-	if (tc->requeue_mode) {
-		requeue_bio_list(tc, &tc->deferred_bio_list);
-		return;
-	}
-
 	INIT_LIST_HEAD(&cells);
 
 	spin_lock_irqsave(&tc->lock, flags);
-- 
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   ` Mike Snitzer [this message]
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   ` [for-3.19 PATCH v2 21/17] dm thin: refactor requeue_io to eliminate spinlock bouncing Mike Snitzer

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