diff options
author | Hugh Dickins <hugh@veritas.com> | 2005-09-04 00:54:42 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 09:05:42 +0200 |
commit | dae06ac43d56d23e50a2300d511b32a9e38cd657 (patch) | |
tree | 62bfa95e769ec5c731f02435b49025a15c45faf4 /kernel/power/swsusp.c | |
parent | [PATCH] swap: swap_lock replace list+device (diff) | |
download | linux-dae06ac43d56d23e50a2300d511b32a9e38cd657.tar.xz linux-dae06ac43d56d23e50a2300d511b32a9e38cd657.zip |
[PATCH] swap: update swsusp use of swap_info
Aha, swsusp dips into swap_info[], better update it to swap_lock. It's
bitflipping flags with 0xFF, so get_swap_page will allocate from only the one
chosen device: let's change that to flip SWP_WRITEOK.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to '')
-rw-r--r-- | kernel/power/swsusp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index f2bc71b9fe8b..975b1648a806 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -179,9 +179,9 @@ static int swsusp_swap_check(void) /* This is called before saving image */ len=strlen(resume_file); root_swap = 0xFFFF; - swap_list_lock(); + spin_lock(&swap_lock); for (i=0; i<MAX_SWAPFILES; i++) { - if (swap_info[i].flags == 0) { + if (!(swap_info[i].flags & SWP_WRITEOK)) { swapfile_used[i]=SWAPFILE_UNUSED; } else { if (!len) { @@ -202,7 +202,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */ } } } - swap_list_unlock(); + spin_unlock(&swap_lock); return (root_swap != 0xffff) ? 0 : -ENODEV; } @@ -216,12 +216,12 @@ static void lock_swapdevices(void) { int i; - swap_list_lock(); + spin_lock(&swap_lock); for (i = 0; i< MAX_SWAPFILES; i++) if (swapfile_used[i] == SWAPFILE_IGNORED) { - swap_info[i].flags ^= 0xFF; + swap_info[i].flags ^= SWP_WRITEOK; } - swap_list_unlock(); + spin_unlock(&swap_lock); } /** |