summaryrefslogtreecommitdiff
path: root/mm/swapfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 8b5bd34b1a00..30a90fd140b7 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -34,6 +34,7 @@
#include <linux/frontswap.h>
#include <linux/swapfile.h>
#include <linux/export.h>
+#include <linux/swap_slots.h>
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
@@ -854,14 +855,6 @@ noswap:
return n_ret;
}
-swp_entry_t get_swap_page(void)
-{
- swp_entry_t entry;
-
- get_swap_pages(1, &entry);
- return entry;
-}
-
/* The only caller of this function is now suspend routine */
swp_entry_t get_swap_page_of_type(int type)
{
@@ -1052,7 +1045,7 @@ void swap_free(swp_entry_t entry)
p = _swap_info_get(entry);
if (p) {
if (!__swap_entry_free(p, entry, 1))
- swapcache_free_entries(&entry, 1);
+ free_swap_slot(entry);
}
}
@@ -1066,7 +1059,7 @@ void swapcache_free(swp_entry_t entry)
p = _swap_info_get(entry);
if (p) {
if (!__swap_entry_free(p, entry, SWAP_HAS_CACHE))
- swapcache_free_entries(&entry, 1);
+ free_swap_slot(entry);
}
}
@@ -1288,7 +1281,7 @@ int free_swap_and_cache(swp_entry_t entry)
page = NULL;
}
} else if (!count)
- swapcache_free_entries(&entry, 1);
+ free_swap_slot(entry);
}
if (page) {
/*
@@ -2116,6 +2109,17 @@ static void reinsert_swap_info(struct swap_info_struct *p)
spin_unlock(&swap_lock);
}
+bool has_usable_swap(void)
+{
+ bool ret = true;
+
+ spin_lock(&swap_lock);
+ if (plist_head_empty(&swap_active_head))
+ ret = false;
+ spin_unlock(&swap_lock);
+ return ret;
+}
+
SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
{
struct swap_info_struct *p = NULL;