Re: [6/25] Merge pmdisk and swsusp
From: Pavel Machek
Date: Sun Jul 18 2004 - 17:14:58 EST
Hi!
> - Move helpers calc_order(), alloc_pagedir(), alloc_image_pages(),
> enough_free_mem(), and enough_swap() into swsusp.
> +/**
> + * enough_free_mem - Make sure we enough free memory to snapshot.
> + *
> + * Returns TRUE or FALSE after checking the number of available
> + * free pages.
> + */
> +
> +static int enough_free_mem(void)
> +{
> + if(nr_free_pages() < (nr_copy_pages + PAGES_FOR_IO)) {
> + pr_debug("pmdisk: Not enough free pages: Have %d\n",
> + nr_free_pages());
> + return 0;
> + }
> + return 1;
> +}
> + if (!enough_free_mem())
> + return -ENOMEM;
> +
> + if (!enough_swap())
> + return -ENOSPC;
> +
> + if ((error = alloc_pagedir())) {
> + pr_debug("suspend: Allocating pagedir failed.\n");
> + return error;
> + }
Perhaps enough_free_* should return 0 / -ERROR to keep it consistent
with rest of code, no need to explain TRUE/FALSE etc?
--
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/