dm log writes: don't use all the cpu while waiting to log blocks

The check to see if the logging kthread needs to go to sleep is wrong,
it checks lc->pending_blocks, which will be non-0 if there are any
blocks that are pending, whether they are ready to be logged or not.
What we really want is to go to sleep until it's time to log blocks, so
change this check so we do actually go to sleep in between flushes.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Josef Bacik and committed by
Mike Snitzer
0c79c620 cf0dec66

+1 -1
+1 -1
drivers/md/dm-log-writes.c
··· 399 399 if (!try_to_freeze()) { 400 400 set_current_state(TASK_INTERRUPTIBLE); 401 401 if (!kthread_should_stop() && 402 - !atomic_read(&lc->pending_blocks)) 402 + list_empty(&lc->logging_blocks)) 403 403 schedule(); 404 404 __set_current_state(TASK_RUNNING); 405 405 }