diff options
author | Jan Kara <jack@suse.cz> | 2011-09-02 19:04:09 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-09-02 19:17:02 -0400 |
commit | 5a042aa4b8e994a15d2c2ee750219971f0ab3905 (patch) | |
tree | d7169fad55f66551fb8e8eb845cd1807bed25c47 /mm | |
parent | 56ebdaf2fa3c5276be201c5d1aff1490b682ecf2 (diff) |
mm: Cleanup clearing of BDI_pending bit in bdi_forker_thread()
bdi_forker_thread() clears BDI_pending bit at the end of the main loop.
However clearing of this bit must not be done in some cases which is
handled by calling 'continue' from switch statement. That's kind of
unusual construct and without a good reason so change the function into
more intuitive code flow.
CC: Wu Fengguang <fengguang.wu@intel.com>
CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/backing-dev.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index d6edf8d14f9c..94a047bb6c39 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -359,6 +359,17 @@ static unsigned long bdi_longest_inactive(void) | |||
359 | return max(5UL * 60 * HZ, interval); | 359 | return max(5UL * 60 * HZ, interval); |
360 | } | 360 | } |
361 | 361 | ||
362 | /* | ||
363 | * Clear pending bit and wakeup anybody waiting for flusher thread creation or | ||
364 | * shutdown | ||
365 | */ | ||
366 | static void bdi_clear_pending(struct backing_dev_info *bdi) | ||
367 | { | ||
368 | clear_bit(BDI_pending, &bdi->state); | ||
369 | smp_mb__after_clear_bit(); | ||
370 | wake_up_bit(&bdi->state, BDI_pending); | ||
371 | } | ||
372 | |||
362 | static int bdi_forker_thread(void *ptr) | 373 | static int bdi_forker_thread(void *ptr) |
363 | { | 374 | { |
364 | struct bdi_writeback *me = ptr; | 375 | struct bdi_writeback *me = ptr; |
@@ -469,11 +480,13 @@ static int bdi_forker_thread(void *ptr) | |||
469 | spin_unlock_bh(&bdi->wb_lock); | 480 | spin_unlock_bh(&bdi->wb_lock); |
470 | wake_up_process(task); | 481 | wake_up_process(task); |
471 | } | 482 | } |
483 | bdi_clear_pending(bdi); | ||
472 | break; | 484 | break; |
473 | 485 | ||
474 | case KILL_THREAD: | 486 | case KILL_THREAD: |
475 | __set_current_state(TASK_RUNNING); | 487 | __set_current_state(TASK_RUNNING); |
476 | kthread_stop(task); | 488 | kthread_stop(task); |
489 | bdi_clear_pending(bdi); | ||
477 | break; | 490 | break; |
478 | 491 | ||
479 | case NO_ACTION: | 492 | case NO_ACTION: |
@@ -489,16 +502,8 @@ static int bdi_forker_thread(void *ptr) | |||
489 | else | 502 | else |
490 | schedule_timeout(msecs_to_jiffies(dirty_writeback_interval * 10)); | 503 | schedule_timeout(msecs_to_jiffies(dirty_writeback_interval * 10)); |
491 | try_to_freeze(); | 504 | try_to_freeze(); |
492 | /* Back to the main loop */ | 505 | break; |
493 | continue; | ||
494 | } | 506 | } |
495 | |||
496 | /* | ||
497 | * Clear pending bit and wakeup anybody waiting to tear us down. | ||
498 | */ | ||
499 | clear_bit(BDI_pending, &bdi->state); | ||
500 | smp_mb__after_clear_bit(); | ||
501 | wake_up_bit(&bdi->state, BDI_pending); | ||
502 | } | 507 | } |
503 | 508 | ||
504 | return 0; | 509 | return 0; |