From: "Luca Tettamanti" <kronos.it@gmail.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Alistair John Strachan" <s0348365@sms.ed.ac.uk>,
linux-kernel@vger.kernel.org,
"John Richard Moser" <nigelenki@comcast.net>
Subject: Re: Suspend to disk: do we HAVE to use swap?
Date: Tue, 31 Oct 2006 23:51:49 +0100 [thread overview]
Message-ID: <68676e00610311451h6b3e6684v80c471632db07c31@mail.gmail.com> (raw)
In-Reply-To: <200610312218.18175.rjw@sisk.pl>
On 10/31/06, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Tuesday, 31 October 2006 21:15, Luca Tettamanti wrote:
> > Il Tue, Oct 31, 2006 at 08:19:37PM +0100, Rafael J. Wysocki ha scritto:
> > > On Tuesday, 31 October 2006 20:05, Alistair John Strachan wrote:
> > > > On Tuesday 31 October 2006 17:40, Luca Tettamanti wrote:
> > > > > Alistair John Strachan <s0348365@sms.ed.ac.uk> ha scritto:
> > > > > > On Tuesday 31 October 2006 06:16, Rafael J. Wysocki wrote:
> > > > > > [snip]
> > > > > >
> > > > > >> However, we already have code that allows us to use swap files for the
> > > > > >> suspend and turning a regular file into a swap file is as easy as
> > > > > >> running 'mkswap' and 'swapon' on it.
> > > > > >
> > > > > > How is this feature enabled? I don't see it in 2.6.19-rc4.
> > > > >
> > > > > Swap files have been supported for ages. suspend-to-swapfile is very
> > > > > new, you need a -mm kernel and userspace suspend from CVS:
> > > > > http://suspend.sf.net
> > > >
> > > > I know, I use swap files, and not a partition. This has prevented me from
> > > > using suspend to disk "for ages". ;-)
> > > >
> > > > Is userspace suspend REQUIRED for this feature?
> > >
> > > No, but unfortunately one piece is still missing: You'll need to figure out
> > > where your swap file's header is located.
> > >
> > > However, if you apply the attached patch the kernel will tell you where it is
> > > (after you do 'swapon' grep dmesg for 'swap' and use the value in the
> > > 'offset' field).
> >
> > Of course it's also possibile to use FIBMAP ioctl:
> >
> > #include <stdio.h>
> > #include <fcntl.h>
> > #include <unistd.h>
> > #include <sys/ioctl.h>
> > #include <linux/fs.h>
> >
> > int main(int argc, char **argv) {
> > int block = 0;
> > int fd;
> >
> > if (argc < 2)
> > return 1;
> >
> > fd = open(argv[1], O_RDONLY);
> > if (fd < 0) {
> > perror("open()");
> > return 1;
> > }
> >
> > if (ioctl(fd, FIBMAP, &block)) {
> > perror("ioctl()");
> > return 1;
> > }
> >
> > close(fd);
> > printf("%d\n", block);
> >
> > return 0;
> > }
> >
> > Probably it's more script friendly (grepping dmesg? hmmm) ;)
>
> That's a bit more complicated, because you need to find a block which is
> PAGE_SIZE big and express the number in PAGE_SIZE units.
Ah, I see. Finding a cluster of contiguous blocks is easy, but I'm
having troubles converting the block number to an offset from the
start of the device :s
Luca
next prev parent reply other threads:[~2006-10-31 22:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-31 3:42 John Richard Moser
2006-10-31 6:16 ` Rafael J. Wysocki
2006-10-31 6:31 ` John Richard Moser
2006-10-31 6:39 ` Rafael J. Wysocki
2006-10-31 13:48 ` Alistair John Strachan
2006-10-31 17:40 ` Luca Tettamanti
2006-10-31 19:05 ` Alistair John Strachan
2006-10-31 19:19 ` Rafael J. Wysocki
2006-10-31 19:41 ` John Richard Moser
2006-10-31 20:04 ` Luca Tettamanti
2006-10-31 20:15 ` John Richard Moser
2006-10-31 21:20 ` Rafael J. Wysocki
2006-10-31 20:15 ` Luca Tettamanti
2006-10-31 21:18 ` Rafael J. Wysocki
2006-10-31 22:51 ` Luca Tettamanti [this message]
2006-10-31 22:31 ` Michael Lothian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68676e00610311451h6b3e6684v80c471632db07c31@mail.gmail.com \
--to=kronos.it@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nigelenki@comcast.net \
--cc=rjw@sisk.pl \
--cc=s0348365@sms.ed.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®