Re: [PATCH -mm 1/3] mm: add a new function (needed for swapsuspend)

From: Andrew Morton
Date: Wed Jan 04 2006 - 02:30:39 EST


"Rafael J. Wysocki" <rjw@xxxxxxx> wrote:
>
> @@ -211,6 +211,26 @@
> return (swp_entry_t) {0};
> }
>
> +swp_entry_t get_swap_page_of_type(int type)
> +{
> + struct swap_info_struct *si;
> + pgoff_t offset;
> +
> + spin_lock(&swap_lock);
> + si = swap_info + type;
> + if (si->flags & SWP_WRITEOK) {
> + nr_swap_pages--;
> + offset = scan_swap_map(si);
> + if (offset) {
> + spin_unlock(&swap_lock);
> + return swp_entry(type, offset);
> + }
> + nr_swap_pages++;
> + }
> + spin_unlock(&swap_lock);
> + return (swp_entry_t) {0};
> +}

A little introductory comment would have been nice..

Would it be appropriate to put this under CONFIG_SOMETHING to save a little
space?

-
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/