Fold into "dm thin: defer whole cells rather than individual bios" Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> --- 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 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel