Messages in this thread | | | Date | Mon, 24 Aug 2009 12:10:20 +0530 | Subject | Re: [PATCH 3/4] compcache: send callback when swap slot is freed | From | Nitin Gupta <> |
| |
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/
| |