On Tuesday, 24 April 2007 21:50, Tim Dijkstra wrote: > On Tue, 24 Apr 2007 21:24:28 +0200 > Tim Dijkstra <[EMAIL PROTECTED]> wrote: > > > On Mon, 23 Apr 2007 23:34:58 +0200 > > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote: > > > > > On Monday, 23 April 2007 21:30, Tim Dijkstra wrote: > > > > On Sun, 22 Apr 2007 23:22:30 +0200 > > > > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote: > > > > > > > > > On Sunday, 22 April 2007 22:06, Tim Dijkstra wrote: > > > > > > On Sun, 22 Apr 2007 21:18:46 +0200 > > > > > > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > > > I think we have to debug the swap-file-on-LVM case more > > > > > > > thoroughly. > > > > > > > > > > > > OK, I've tried printing out /dev/resume_device + offset in > > > > > > mark_swap. > > > > > > Does the following seem reasonable? > > > > > > > > > > > > > > > > > > char ff[100]; > > > > > > lseek(fd, shift, SEEK_SET); > > > > > > read(fd,ff,80); > > > > > > printf("The header (shift %u): %80s\n", shift, ff); > > > > > > > > > > Yes, it does. > > > > > > > > > > > It prints nothing ... > > > > > > > > > > I thought it would. > > > > > > > > > > Still, swap-offset doesn't fail, so it evidently is able to find the > > > > > swap > > > > > signature in your file. > > > > > > > > > Can you hack swap-offset.c so that it prints stat.st_rdev after > > > > > calling fstat() > > > > > and run it on your swap file, then hack suspend.c so that it prints > > > > > blkdev > > > > > in set_swap_file() and compare these two things? > > > > > > > > stat.st_rdev == 0, but I think that's logical, because the swap _file_ > > > > is not a > > > > device file. > > > > stat.st_dev == 64773 > > > > > > > > Which is also the value of blkdev in suspend. > > > > > > And which is strange, because s2disk uses stat.st_rdev . > > > > > > Something fishy is going on here ... > > I'm looking a bit closer into writing the image. I'm a bit confused. In > the case of a swap file we also need the offset. Indeed the function > set_swap_file uses that information. BTW the ioctl seem a bit > counterintuitive > you set a swap-file with ioctl(dev, SNAPSHOT_SET_SWAP_AREA, &swap); > and a swap partition with ioctl(dev, SNAPSHOT_SET_SWAP_FILE, blkdev);
That is a leftover. We'd defined SNAPSHOT_SET_SWAP_FILE first and then introduced SNAPSHOT_SET_SWAP_AREA, but the previous one had to stay for compatibility reasons. > But then that information is not used in init_swap_writer. The only > thing we pass to that function is a file-descriptor pointing to the > device that contains the swap-file... We don't need that, because the kernel returns the offsets for us. get_swap_page() returns an offset with respect to the resume device, and the offset passed to SNAPSHOT_SET_SWAP_AREA is needed so that the kernel can identify the swap properly (if that's a file, it's not sufficient to provide the device by itself, because the file can be located anywhere on the device). IOW, we give the pair (device, offset) to the kernel and expect it to find the right swap on the basis of this information. Then, we rely on the kernel to give us the right offsets with respect to the device. In your test case this mechanism doesn't work and I think the problem is within the kernel, but for now I don't know what it is. Greetings, Rafael ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel