From: Joe Thornber Date: Fri, 21 Dec 2012 20:23:31 +0000 (+0000) Subject: dm thin: wake worker when discard is prepared X-Git-Tag: v3.8-rc1~3^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=563af186df08002d2600c4e718ad8f3bde109f53;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 41c9e81..aeb9e20 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, if (h->all_io_entry) { INIT_LIST_HEAD(&work); dm_deferred_entry_dec(h->all_io_entry, &work); - spin_lock_irqsave(&pool->lock, flags); - list_for_each_entry_safe(m, tmp, &work, list) - list_add(&m->list, &pool->prepared_discards); - spin_unlock_irqrestore(&pool->lock, flags); + if (!list_empty(&work)) { + spin_lock_irqsave(&pool->lock, flags); + list_for_each_entry_safe(m, tmp, &work, list) + list_add(&m->list, &pool->prepared_discards); + spin_unlock_irqrestore(&pool->lock, flags); + wake_worker(pool); + } } mempool_free(h, pool->endio_hook_pool);