Skip to content

Commit

Permalink
[PATCH] swap: update swsusp use of swap_info
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Sep 5, 2005
1 parent 5d337b9 commit dae06ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/power/swsusp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand All @@ -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);
}

/**
Expand Down

0 comments on commit dae06ac

Please sign in to comment.