[PATCH 13/13] update swsusp use of swap_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---

 kernel/power/swsusp.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

--- swap12/kernel/power/swsusp.c	2005-07-07 12:33:21.000000000 +0100
+++ swap13/kernel/power/swsusp.c	2005-07-08 19:15:59.000000000 +0100
@@ -178,9 +178,9 @@ static int swsusp_swap_check(void) /* Th
 	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) {
@@ -201,7 +201,7 @@ static int swsusp_swap_check(void) /* Th
 			}
 		}
 	}
-	swap_list_unlock();
+	spin_unlock(&swap_lock);
 	return (root_swap != 0xffff) ? 0 : -ENODEV;
 }
 
@@ -215,12 +215,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);
 }
 
 /**
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux