That fixed it!  Because the documentation didn't exactly specify, does 
s2disk/resume need its own 
swapfile, or can it use ~1/2*RAM of a swapfile currently mounted and in use?
Thanks,
Brandon

[EMAIL PROTECTED] wrote:
> Il Thu, Jan 18, 2007 at 12:26:12PM -0700, Brandon Beck ha scritto: 
>> [EMAIL PROTECTED] wrote:
>>> Hi,
>>>
>>> (added Cc to suspend-devel and the author of swap-offset)
>>>
>>> On Thursday, 18 January 2007 08:32, you wrote:
>>>> Hello Rafael,
>>>>   Is the resume offset ever supposed to be a negative number?  I run 
>>>> swap-offset /var/swap on a 2.6.20-rc5 kernel and get -270968.  I don't 
>>>> really want to mess up my system here.
>>> No, it should be positive.
>>>
>>> What is the size of blocks on your /var?
>> For good or for ill, I have a single partition (sda1) and I recently 
>> created the swapfile for use with uswsusp, so it is presumably towards the 
>> end of the disk.  On /dev/sda1 I have 76920416 1K blocks with 1299176 
>> available (99% use :-)
> 
> Internally address_space_operation (->bmap) uses a sector_t (u64), but
> the ioctl truncates it to a 32bit signed integer. With 1K blocks it
> gives a limit of 2TB (or 4TB casting back to unsigned int).
> 
> What may overflow is this (swap-offset.c:110):
>         
>         first_block * blk_size
> 
> The following patch should fix it:
> 
> - Kernel uses unsigned quantify for block number, pass an unsigned int
>   to the ioctl.
> - Use 64bit math to avoid overflow.
> 
> ---
> 
>  swap-offset.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Index: swap-offset.c
> ===================================================================
> RCS file: /cvsroot/suspend/suspend/swap-offset.c,v
> retrieving revision 1.3
> diff -u -r1.3 swap-offset.c
> --- swap-offset.c   12 Nov 2006 21:32:09 -0000  1.3
> +++ swap-offset.c   18 Jan 2007 20:44:06 -0000
> @@ -23,7 +23,8 @@
>  #define SWAP_SIG_SIZE  10
>  
>  int main(int argc, char **argv) {
> -   int block, last_block, first_block, blocks_per_page;
> +   unsigned int block, last_block, first_block, blocks_per_page;
> +   unsigned int offset;
>     int size, blk_size;
>     int fd;
>     int i;
> @@ -107,7 +108,8 @@
>                 "be used for suspension.\n");
>         err = EINVAL;
>     } else {
> -       printf("resume offset = %d\n", first_block * blk_size / page_size);
> +       offset = (unsigned long long)first_block * blk_size / page_size;
> +       printf("resume offset = %u\n", offset);
>     }
>  
>  out:
> 
> Luca

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to