Hi,

On Saturday, 11 November 2006 22:04, Pavel Machek wrote:
> Hi!
> 
> > > Yeah :)
> > 
> > Looks good, one small comment below.
> > 
> > _However_,
> > 
> > I think we can do one more thing.  Namely, if the header is not continuous,
> > the kernel will leave the first continuous PAGE_SIZE "block" of the swap 
> > file
> > untouched.  So, why don't we copy the swap signature into that "block",
> > to the place in which it would be if the the header was there, and return
> > its offset as the offset of the header?  Then, swsusp and s2disk should work
> > normally as well as the swap.
> > 
> > I don't think the program should do this automatically, but there may be a
> > flag allowing the user to modify a swap file with non-continuous header so
> > that it can be used for suspending.
> 
> I'm pretty sure we do not want *that* hack.
> 
> ...don't we check header at offset ~4090, while writing some data to
> offset 0? If the file is not contiguous, this will kill data, no?

Files may be non-continuous, but the swap-handling code finds continuous
PAGE_SIZE-sized blocks in them and maps these blocks using extents.  The first
PAGE_SIZE continuous block of a swap files is _never_ used for saving
any swap data, because it _may_ contain the swap header, but it _won't_
contain it if the header is not continuous (in such a case it may contain some
part of the header, though).

Now if the swap header is not continuous (which _is_ possible, as the Luca's
example clearly shows), swsusp (and s2disk) won't be able to use that file
for suspending, because the swap signature is not where they expect it to be
(they expect the signature to be at the offset 4090 of the first _continuous_
PAGE_SIZE.block of the swap file).  However, in that case there are no swap
data at the offset 4090 of the first continuous PAGE_SIZE.block of the swap
file (this block is never used for saving data), so we can _safely_ copy the
swap signature into this place.

There only is danger that we could damage the real swap signature (ie. the
one that is used by the swap-handling code) if we modified the swap header
carelessly, but this is not the case.

> Even if I'm wrong: If header is fragmented, it is likely that rest
> will also be fragmented and unusable, no?

Not necessarily.

Still, I'm not going to argue for using this hack, although I'm pretty sure
it would be 100% safe.

In fact, I'd like to include the Luca's program in its current form into the
release, but it's missing a license notice ...

Greetings,
Rafael


-- 
You never change things by fighting the existing reality.
                R. Buckminster Fuller

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to