aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-09-03 18:54:42 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:05:42 -0400
commitdae06ac43d56d23e50a2300d511b32a9e38cd657 (patch)
tree62bfa95e769ec5c731f02435b49025a15c45faf4 /kernel/power/swsusp.c
parent5d337b9194b1ce3b6fd5f3cb2799455ed2f9a3d1 (diff)
[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 'kernel/power/swsusp.c')
-rw-r--r--kernel/power/swsusp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index f2bc71b9fe8..975b1648a80 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 */
179 len=strlen(resume_file); 179 len=strlen(resume_file);
180 root_swap = 0xFFFF; 180 root_swap = 0xFFFF;
181 181
182 swap_list_lock(); 182 spin_lock(&swap_lock);
183 for (i=0; i<MAX_SWAPFILES; i++) { 183 for (i=0; i<MAX_SWAPFILES; i++) {
184 if (swap_info[i].flags == 0) { 184 if (!(swap_info[i].flags & SWP_WRITEOK)) {
185 swapfile_used[i]=SWAPFILE_UNUSED; 185 swapfile_used[i]=SWAPFILE_UNUSED;
186 } else { 186 } else {
187 if (!len) { 187 if (!len) {
@@ -202,7 +202,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */
202 } 202 }
203 } 203 }
204 } 204 }
205 swap_list_unlock(); 205 spin_unlock(&swap_lock);
206 return (root_swap != 0xffff) ? 0 : -ENODEV; 206 return (root_swap != 0xffff) ? 0 : -ENODEV;
207} 207}
208 208
@@ -216,12 +216,12 @@ static void lock_swapdevices(void)
216{ 216{
217 int i; 217 int i;
218 218
219 swap_list_lock(); 219 spin_lock(&swap_lock);
220 for (i = 0; i< MAX_SWAPFILES; i++) 220 for (i = 0; i< MAX_SWAPFILES; i++)
221 if (swapfile_used[i] == SWAPFILE_IGNORED) { 221 if (swapfile_used[i] == SWAPFILE_IGNORED) {
222 swap_info[i].flags ^= 0xFF; 222 swap_info[i].flags ^= SWP_WRITEOK;
223 } 223 }
224 swap_list_unlock(); 224 spin_unlock(&swap_lock);
225} 225}
226 226
227/** 227/**