lkml.org 
[lkml]   [2009]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 3/4] compcache: send callback when swap slot is freed
From
On Mon, Aug 24, 2009 at 10:07 AM, Nitin Gupta<ngupta@vflare.org> wrote:

<snip>

> +/*
> + * Sets callback for event when swap_map[offset] == 0
> + * i.e. page at this swap offset is no longer used.
> + */
> +void set_swap_free_notify(struct block_device *bdev,
> +                       swap_free_notify_fn *notify_fn)
> +{
> +       unsigned int i;
> +       struct swap_info_struct *sis;
> +
> +       spin_lock(&swap_lock);
> +       for (i = 0; i <= nr_swapfiles; i++) {
> +               sis = &swap_info[i];
> +               if (!(sis->flags & SWP_USED))
> +                       continue;
> +               if (sis->bdev == bdev)
> +                       break;
> +       }
> +

> +       /* swap device not found */
> +       if (i > nr_swapfiles)
> +               return;

How could I miss this! We need to unlock before this return. I will
send revised diffs once I get additional reviews.


> +
> +       BUG_ON(!sis || sis->swap_free_notify_fn);
> +       sis->swap_free_notify_fn = notify_fn;
> +       spin_unlock(&swap_lock);
> +
> +       return;
> +}
> +EXPORT_SYMBOL_GPL(set_swap_free_notify);
> +


Nitin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-08-24 08:43    [W:0.039 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site