lkml.org 
[lkml]   [2004]   [May]   [10]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 10 May 2004 19:09:36 +0200
FromPavel Machek <>
SubjectRe: [PATCH] 2.6.6 swsusp.c: allow device aliasing
Hi!

> I'm  using  devfs.   (I'm   using  /dev/hda7  for  swsusp.)   So,  cat
> /proc/swaps shows my swap device as:
> 
>     Filename                                Type      Size  Used Priority
>     /dev/ide/host0/bus0/target0/lun0/part7  partition 498920  0   -1
> 
> whereas  I  specify  "resume=/dev/hda7"  as a  boot  parameter.   Upon
> suspend, swsusp can't find a swap device exactly named "/dev/hda7" and
> hence thinks there is no swapspace.
> 
> 
> The problem is that:
> 
> 1) Upon suspend, kernel/power/swsusp.c compares the devices names
>    "/dev/hda7" and "/dev/ide/.../part7" and they don't match.  So
>    swsusp refuses to suspend to the swap partition.  Changing the
>    boot parameter to "resume=/dev/ide/host0/bus0/target0/lun0/part7"
>    solves this problem, BUT:
> 
> 2) Upon resume, kernel/power/swsusp.c doesn't understand what a device
>    "/dev/ide/host0/bus0/target0/lun0/part7" is.  It only knows what
>    "/dev/hda7".  So, I have to set "resume=/dev/hda7" for resume to
>    work.  But this would create problem (1).
> 
> So, I can't get both suspend and resume to work!  :(
> 
> Why did it  work in pre-2.6.6?  Because that check  in swsusp.c in pre
> 2.6.6 didn't really check if  the device is correct upon suspend.  The
> suspend code  only writes  the suspend/resume data  to the  FIRST swap
> device.  2.6.6 has corrected this bug, but can't equate "/dev/hda7" to
> "/dev/ide/host0/bus0/target0/lun0/part7",  although the  two  refer to
> the same device.
> 
> 
> The following patch (against 2.6.6)  fixes this problem in the suspend
> code.  It  will check whether both  the swap device  and the "resume="
> parameter refer to a block  device with the same (major,minor) number.
> If so, the swap device is taken  to be the one specified for swsusp to
> use.   So, aliasing  of devices  is support.   This means  I  must say
> "resume=/dev/hda7"                       and                       not
> "resume=/dev/ide/host0/bus0/target0/lun0/part7".    If,  however,  the
> specified swap devices are (swap)  files rather block devices, it only
> does a filename comparison.  (Does  swsusp support swap files?  If so,
> should we also support file aliasing?  How?)

No, swsusp only supports swap devices. That means that you probably
should kill d_path and name handling; that will slean the code up as
well.

Oh and please 

> 
> --- linux-2.6.6-official/kernel/power/swsusp.c	2004/05/10 14:11:17	1.1
> +++ linux-2.6.6-swsusp-dev-aliasing/kernel/power/swsusp.c	2004/05/10 16:11:41	1.3
> @@ -215,47 +215,67 @@
>  		else if ((!memcmp("SWAPSPACE2",cur->swh.magic.magic,10)))
>  			memcpy(cur->swh.magic.magic,"S2SUSP....",10);
>  		else panic("\nSwapspace is not swapspace (%.10s)\n", cur->swh.magic.magic);
>  		cur->link.next = prev; /* prev is the first/last swap page of the resume area */
>  		/* link.next lies *no more* in last 4/8 bytes of magic */
>  	}
>  	rw_swap_page_sync(WRITE, entry, page);
>  	__free_page(page);
>  }
> 
> +static int is_resume_file(const struct swap_info_struct *swap_info) {

Newline needed before {.
Otherwise it looks good. Can you submit fixed patch? Thanks,
									Pavel
-- 
Horseback riding is like software...
...vgf orggre jura vgf serr.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [from the cache]
©2003-2008