Merge branch 'for-linus' of git://git.kernel.dk/linux-block
* 'for-linus' of git://git.kernel.dk/linux-block: floppy: use del_timer_sync() in init cleanup blk-cgroup: be able to remove the record of unplugged device block: Don't check QUEUE_FLAG_SAME_COMP in __blk_complete_request mm: Add comment explaining task state setting in bdi_forker_thread() mm: Cleanup clearing of BDI_pending bit in bdi_forker_thread() block: simplify force plug flush code a little bit block: change force plug flush call order block: Fix queue_flag update when rq_affinity goes from 2 to 1 block: separate priority boosting from REQ_META block: remove READ_META and WRITE_META xen-blkback: fixed indentation and comments xen-blkback: Don't disconnect backend until state switched to XenbusStateClosed.
This commit is contained in:
@@ -359,6 +359,17 @@ static unsigned long bdi_longest_inactive(void)
|
||||
return max(5UL * 60 * HZ, interval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear pending bit and wakeup anybody waiting for flusher thread creation or
|
||||
* shutdown
|
||||
*/
|
||||
static void bdi_clear_pending(struct backing_dev_info *bdi)
|
||||
{
|
||||
clear_bit(BDI_pending, &bdi->state);
|
||||
smp_mb__after_clear_bit();
|
||||
wake_up_bit(&bdi->state, BDI_pending);
|
||||
}
|
||||
|
||||
static int bdi_forker_thread(void *ptr)
|
||||
{
|
||||
struct bdi_writeback *me = ptr;
|
||||
@@ -390,6 +401,13 @@ static int bdi_forker_thread(void *ptr)
|
||||
}
|
||||
|
||||
spin_lock_bh(&bdi_lock);
|
||||
/*
|
||||
* In the following loop we are going to check whether we have
|
||||
* some work to do without any synchronization with tasks
|
||||
* waking us up to do work for them. So we have to set task
|
||||
* state already here so that we don't miss wakeups coming
|
||||
* after we verify some condition.
|
||||
*/
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
|
||||
list_for_each_entry(bdi, &bdi_list, bdi_list) {
|
||||
@@ -469,11 +487,13 @@ static int bdi_forker_thread(void *ptr)
|
||||
spin_unlock_bh(&bdi->wb_lock);
|
||||
wake_up_process(task);
|
||||
}
|
||||
bdi_clear_pending(bdi);
|
||||
break;
|
||||
|
||||
case KILL_THREAD:
|
||||
__set_current_state(TASK_RUNNING);
|
||||
kthread_stop(task);
|
||||
bdi_clear_pending(bdi);
|
||||
break;
|
||||
|
||||
case NO_ACTION:
|
||||
@@ -489,16 +509,8 @@ static int bdi_forker_thread(void *ptr)
|
||||
else
|
||||
schedule_timeout(msecs_to_jiffies(dirty_writeback_interval * 10));
|
||||
try_to_freeze();
|
||||
/* Back to the main loop */
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear pending bit and wakeup anybody waiting to tear us down.
|
||||
*/
|
||||
clear_bit(BDI_pending, &bdi->state);
|
||||
smp_mb__after_clear_bit();
|
||||
wake_up_bit(&bdi->state, BDI_pending);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user