Commit ce922a4c authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] swsusp fixes

This kills unneccessary include from ide-disk.c, kills #ifdef from
reiserfs/journal.c, makes suspend_device local as it should be,
abstains from suspending devices two times in a row (typo), and makes
sure we do not run_task_queue() while we hold spinlock.
parent 542f96a5
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/suspend.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/irq.h> #include <asm/irq.h>
......
...@@ -1901,12 +1901,9 @@ static int reiserfs_journal_commit_thread(void *nullp) { ...@@ -1901,12 +1901,9 @@ static int reiserfs_journal_commit_thread(void *nullp) {
break ; break ;
} }
wake_up(&reiserfs_commit_thread_done) ; wake_up(&reiserfs_commit_thread_done) ;
#ifdef CONFIG_SOFTWARE_SUSPEND if (current->flags & PF_FREEZE)
if (current->flags & PF_FREEZE) { refrigerator(PF_IOTHREAD);
refrigerator(PF_IOTHREAD); interruptible_sleep_on_timeout(&reiserfs_commit_thread_wait, 5 * HZ) ;
} else
#endif
interruptible_sleep_on_timeout(&reiserfs_commit_thread_wait, 5 * HZ) ;
} }
unlock_kernel() ; unlock_kernel() ;
wake_up(&reiserfs_commit_thread_done) ; wake_up(&reiserfs_commit_thread_done) ;
......
...@@ -409,15 +409,12 @@ static void lock_swapdevices(void) /* This is called after saving image so modif ...@@ -409,15 +409,12 @@ static void lock_swapdevices(void) /* This is called after saving image so modif
swap_list_lock(); swap_list_lock();
for(i = 0; i< MAX_SWAPFILES; i++) for(i = 0; i< MAX_SWAPFILES; i++)
if(swapfile_used[i] == SWAPFILE_IGNORED) { if(swapfile_used[i] == SWAPFILE_IGNORED) {
// PRINTS( "device %s locked\n", swap_info[i].swap_file->d_name.name );
swap_info[i].flags ^= 0xFF; /* we make the device unusable. A new call to swap_info[i].flags ^= 0xFF; /* we make the device unusable. A new call to
lock_swapdevices can unlock the devices. */ lock_swapdevices can unlock the devices. */
} }
swap_list_unlock(); swap_list_unlock();
} }
kdev_t suspend_device;
static int write_suspend_image(void) static int write_suspend_image(void)
{ {
int i; int i;
...@@ -425,6 +422,7 @@ static int write_suspend_image(void) ...@@ -425,6 +422,7 @@ static int write_suspend_image(void)
int nr_pgdir_pages = SUSPEND_PD_PAGES(nr_copy_pages); int nr_pgdir_pages = SUSPEND_PD_PAGES(nr_copy_pages);
union diskpage *cur, *buffer = (union diskpage *)get_free_page(GFP_ATOMIC); union diskpage *cur, *buffer = (union diskpage *)get_free_page(GFP_ATOMIC);
unsigned long address; unsigned long address;
kdev_t suspend_device;
PRINTS( "Writing data to swap (%d pages): ", nr_copy_pages ); PRINTS( "Writing data to swap (%d pages): ", nr_copy_pages );
for (i=0; i<nr_copy_pages; i++) { for (i=0; i<nr_copy_pages; i++) {
...@@ -809,7 +807,6 @@ static int suspend_save_image(void) ...@@ -809,7 +807,6 @@ static int suspend_save_image(void)
* *
* Following line enforces not writing to disk until we choose. * Following line enforces not writing to disk until we choose.
*/ */
suspend_device = NODEV; /* We do not want any writes, thanx */
drivers_unsuspend(); drivers_unsuspend();
spin_unlock_irq(&suspend_pagedir_lock); spin_unlock_irq(&suspend_pagedir_lock);
PRINTS( "critical section/: done (%d pages copied)\n", nr_copy_pages ); PRINTS( "critical section/: done (%d pages copied)\n", nr_copy_pages );
...@@ -899,13 +896,9 @@ static void do_magic_suspend_1(void) ...@@ -899,13 +896,9 @@ static void do_magic_suspend_1(void)
static void do_magic_suspend_2(void) static void do_magic_suspend_2(void)
{ {
read_swapfiles(); read_swapfiles();
if (!suspend_save_image()) { if (!suspend_save_image())
#if 1 suspend_power_down(); /* FIXME: if suspend_power_down is commented out, console is lost after few suspends ?! */
suspend_power_down (); /* FIXME: if suspend_power_down is commented out, console is lost after few suspends ?! */
#endif
}
suspend_device = NODEV;
printk(KERN_WARNING "%sSuspend failed, trying to recover...\n", name_suspend); printk(KERN_WARNING "%sSuspend failed, trying to recover...\n", name_suspend);
MDELAY(1000); /* So user can wait and report us messages if armageddon comes :-) */ MDELAY(1000); /* So user can wait and report us messages if armageddon comes :-) */
...@@ -944,9 +937,8 @@ void do_software_suspend(void) ...@@ -944,9 +937,8 @@ void do_software_suspend(void)
* We sync here -- so you have consistent filesystem state when things go wrong. * We sync here -- so you have consistent filesystem state when things go wrong.
* -- so that noone writes to disk after we do atomic copy of data. * -- so that noone writes to disk after we do atomic copy of data.
*/ */
PRINTS( "Syncing disks before copy\n" ); PRINTS("Syncing disks before copy\n");
do_suspend_sync(); do_suspend_sync();
drivers_suspend();
if(drivers_suspend()==0) if(drivers_suspend()==0)
do_magic(0); /* This function returns after machine woken up from resume */ do_magic(0); /* This function returns after machine woken up from resume */
PRINTR("Restarting processes...\n"); PRINTR("Restarting processes...\n");
......
...@@ -108,16 +108,16 @@ static int __pdflush(struct pdflush_work *my_work) ...@@ -108,16 +108,16 @@ static int __pdflush(struct pdflush_work *my_work)
for ( ; ; ) { for ( ; ; ) {
struct pdflush_work *pdf; struct pdflush_work *pdf;
#ifdef CONFIG_SOFTWARE_SUSPEND
run_task_queue(&tq_bdflush);
#endif
list_add(&my_work->list, &pdflush_list); list_add(&my_work->list, &pdflush_list);
my_work->when_i_went_to_sleep = jiffies; my_work->when_i_went_to_sleep = jiffies;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&pdflush_lock); spin_unlock_irq(&pdflush_lock);
#ifdef CONFIG_SOFTWARE_SUSPEND
run_task_queue(&tq_bdflush);
if (current->flags & PF_FREEZE) if (current->flags & PF_FREEZE)
refrigerator(PF_IOTHREAD); refrigerator(PF_IOTHREAD);
#endif
schedule(); schedule();
preempt_enable(); preempt_enable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment