diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 21:59:59 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 21:59:59 +0100 |
commit | ccf18968b1bbc2fb117190a1984ac2a826dac228 (patch) | |
tree | 7bc8fbf5722aecf1e84fa50c31c657864cba1daa /mm/swapfile.c | |
parent | [PATCH] i2c: i2c-mv64xxx fix transaction abortion (diff) | |
parent | Merge branch 'post-2.6.15' of git://brick.kernel.dk/data/git/linux-2.6-block (diff) | |
download | linux-ccf18968b1bbc2fb117190a1984ac2a826dac228.tar.xz linux-ccf18968b1bbc2fb117190a1984ac2a826dac228.zip |
Merge ../torvalds-2.6/
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index edafeace301f..6da4b28b896b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -211,6 +211,26 @@ noswap: 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}; +} + static struct swap_info_struct * swap_info_get(swp_entry_t entry) { struct swap_info_struct * p; |