* [PATCH 0/1] swsusp: fix breakage with swap on LVM
@ 2006-02-16 14:58 Rafael J. Wysocki
2006-02-16 15:03 ` [PATCH 1/1] " Rafael J. Wysocki
2006-02-16 15:05 ` [PATCH -mm " Rafael J. Wysocki
0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2006-02-16 14:58 UTC (permalink / raw)
To: Andrew Morton; +Cc: Pavel Machek, Dave Jones, LKML
Hi,
In the following two replies to this message there are two versions of
the same fix, one of which applies to 2.6.16-rc3 and the second to the recent
-mm.
The fix is needed to restore the compatibility with the older code that
allowed to suspend even if the kernel command line didn't contain the
"resume=" argument. This feature is necessary so that swsusp can work
in the default Fedora setup where the swap partition is on an LVM.
I consider the first patch, against 2.6.16-rc3, as an urgent fix that should
go in 2.6.16, if possible. It has been tested by Dave and evidently fixes the
Fedora issue. Unfortunately it doesn't apply to the recent -mm, because
in -mm the code in question is split between mm/swapfile.c and
kernel/power/swap.c, so the other patch is needed.
Please apply.
Greetings,
Rafael
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] swsusp: fix breakage with swap on LVM
2006-02-16 14:58 [PATCH 0/1] swsusp: fix breakage with swap on LVM Rafael J. Wysocki
@ 2006-02-16 15:03 ` Rafael J. Wysocki
2006-02-16 15:05 ` [PATCH -mm " Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2006-02-16 15:03 UTC (permalink / raw)
To: Andrew Morton; +Cc: Pavel Machek, Dave Jones, LKML
Restore the compatibility with the older code and make it possible to
suspend if the kernel command line doesn't contain the "resume="
argument
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
kernel/power/swsusp.c | 4 +---
1 files changed, 1 insertion(+), 3 deletions(-)
Index: linux-2.6.16-rc3/kernel/power/swsusp.c
===================================================================
--- linux-2.6.16-rc3.orig/kernel/power/swsusp.c
+++ linux-2.6.16-rc3/kernel/power/swsusp.c
@@ -153,13 +153,11 @@ static int swsusp_swap_check(void) /* Th
{
int i;
- if (!swsusp_resume_device)
- return -ENODEV;
spin_lock(&swap_lock);
for (i = 0; i < MAX_SWAPFILES; i++) {
if (!(swap_info[i].flags & SWP_WRITEOK))
continue;
- if (is_resume_device(swap_info + i)) {
+ if (!swsusp_resume_device || is_resume_device(swap_info + i)) {
spin_unlock(&swap_lock);
root_swap = i;
return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH -mm 1/1] swsusp: fix breakage with swap on LVM
2006-02-16 14:58 [PATCH 0/1] swsusp: fix breakage with swap on LVM Rafael J. Wysocki
2006-02-16 15:03 ` [PATCH 1/1] " Rafael J. Wysocki
@ 2006-02-16 15:05 ` Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2006-02-16 15:05 UTC (permalink / raw)
To: Andrew Morton; +Cc: Pavel Machek, Dave Jones, LKML
Restore the compatibility with the older code and make it possible to
suspend if the kernel command line doesn't contain the "resume="
argument.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
include/linux/swap.h | 1 +
kernel/power/swap.c | 3 ++-
mm/swapfile.c | 17 +++++++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
Index: linux-2.6.16-rc3-mm1/include/linux/swap.h
===================================================================
--- linux-2.6.16-rc3-mm1.orig/include/linux/swap.h
+++ linux-2.6.16-rc3-mm1/include/linux/swap.h
@@ -246,6 +246,7 @@ extern int valid_swaphandles(swp_entry_t
extern void swap_free(swp_entry_t);
extern void free_swap_and_cache(swp_entry_t);
extern int swap_type_of(dev_t);
+extern int find_swap(void);
extern unsigned int count_swap_pages(int, int);
extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
extern struct swap_info_struct *get_swap_info_struct(unsigned);
Index: linux-2.6.16-rc3-mm1/kernel/power/swap.c
===================================================================
--- linux-2.6.16-rc3-mm1.orig/kernel/power/swap.c
+++ linux-2.6.16-rc3-mm1/kernel/power/swap.c
@@ -75,8 +75,9 @@ static int mark_swapfiles(swp_entry_t st
static int swsusp_swap_check(void) /* This is called before saving image */
{
- int res = swap_type_of(swsusp_resume_device);
+ int res;
+ res = swsusp_resume_device ? swap_type_of(swsusp_resume_device) : find_swap();
if (res >= 0) {
root_swap = res;
return 0;
Index: linux-2.6.16-rc3-mm1/mm/swapfile.c
===================================================================
--- linux-2.6.16-rc3-mm1.orig/mm/swapfile.c
+++ linux-2.6.16-rc3-mm1/mm/swapfile.c
@@ -448,6 +448,23 @@ int swap_type_of(dev_t device)
}
/*
+ * Find first writeable swap.
+ *
+ * This is needed for software suspend in case the resume device is not
+ * specified in the kernel command line
+ */
+int find_swap(void)
+{
+ int i = 0;
+
+ spin_lock(&swap_lock);
+ while (i < nr_swapfiles && !(swap_info[i].flags & SWP_WRITEOK))
+ i++;
+ spin_unlock(&swap_lock);
+ return i < nr_swapfiles ? i : -ENODEV;
+}
+
+/*
* Return either the total number of swap pages of given type, or the number
* of free pages of that type (depending on @free)
*
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-16 15:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-16 14:58 [PATCH 0/1] swsusp: fix breakage with swap on LVM Rafael J. Wysocki
2006-02-16 15:03 ` [PATCH 1/1] " Rafael J. Wysocki
2006-02-16 15:05 ` [PATCH -mm " Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®