dm thin: wake worker when discard is prepared
[deliverable/linux.git] / drivers / md / dm-thin.c
index 41c9e81ba74a1d3a4764f4896ea61ef1e4713501..aeb9e20f59782ed1dca39d6dc5c9c32ef4acd258 100644 (file)
@@ -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);
This page took 0.038866 seconds and 5 git commands to generate.