aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2012-12-21 15:23:31 -0500
committerAlasdair G Kergon <agk@redhat.com>2012-12-21 15:23:31 -0500
commit563af186df08002d2600c4e718ad8f3bde109f53 (patch)
treee8ba7cf56e84a1aacb77d41499387c89bf58cce6
parente8088073c9610af017fd47fddd104a2c3afb32e8 (diff)
dm thin: wake worker when discard is prepared
When discards are prepared it is best to directly wake the worker that will process them. The worker will be woken anyway, via periodic commit, but there is no reason to not wake_worker here. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm-thin.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 41c9e81ba74a..aeb9e20f5978 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2676,10 +2676,13 @@ static int thin_endio(struct dm_target *ti,
2676 if (h->all_io_entry) { 2676 if (h->all_io_entry) {
2677 INIT_LIST_HEAD(&work); 2677 INIT_LIST_HEAD(&work);
2678 dm_deferred_entry_dec(h->all_io_entry, &work); 2678 dm_deferred_entry_dec(h->all_io_entry, &work);
2679 spin_lock_irqsave(&pool->lock, flags); 2679 if (!list_empty(&work)) {
2680 list_for_each_entry_safe(m, tmp, &work, list) 2680 spin_lock_irqsave(&pool->lock, flags);
2681 list_add(&m->list, &pool->prepared_discards); 2681 list_for_each_entry_safe(m, tmp, &work, list)
2682 spin_unlock_irqrestore(&pool->lock, flags); 2682 list_add(&m->list, &pool->prepared_discards);
2683 spin_unlock_irqrestore(&pool->lock, flags);
2684 wake_worker(pool);
2685 }
2683 } 2686 }
2684 2687
2685 mempool_free(h, pool->endio_hook_pool); 2688 mempool_free(h, pool->endio_hook_pool);