Commit 33e16272 authored by Wei Yang's avatar Wei Yang Committed by Linus Torvalds

mm/swapfile.c: __swap_entry_free() always free 1 entry

__swap_entry_free() always frees 1 entry.  Let's remove the usage.
Signed-off-by: default avatarWei Yang <richard.weiyang@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20200501015259.32237-2-richard.weiyang@gmail.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4b4bb6bb
...@@ -1273,13 +1273,14 @@ struct swap_info_struct *get_swap_device(swp_entry_t entry) ...@@ -1273,13 +1273,14 @@ struct swap_info_struct *get_swap_device(swp_entry_t entry)
} }
static unsigned char __swap_entry_free(struct swap_info_struct *p, static unsigned char __swap_entry_free(struct swap_info_struct *p,
swp_entry_t entry, unsigned char usage) swp_entry_t entry)
{ {
struct swap_cluster_info *ci; struct swap_cluster_info *ci;
unsigned long offset = swp_offset(entry); unsigned long offset = swp_offset(entry);
unsigned char usage;
ci = lock_cluster_or_swap_info(p, offset); ci = lock_cluster_or_swap_info(p, offset);
usage = __swap_entry_free_locked(p, offset, usage); usage = __swap_entry_free_locked(p, offset, 1);
unlock_cluster_or_swap_info(p, ci); unlock_cluster_or_swap_info(p, ci);
if (!usage) if (!usage)
free_swap_slot(entry); free_swap_slot(entry);
...@@ -1314,7 +1315,7 @@ void swap_free(swp_entry_t entry) ...@@ -1314,7 +1315,7 @@ void swap_free(swp_entry_t entry)
p = _swap_info_get(entry); p = _swap_info_get(entry);
if (p) if (p)
__swap_entry_free(p, entry, 1); __swap_entry_free(p, entry);
} }
/* /*
...@@ -1737,7 +1738,7 @@ int free_swap_and_cache(swp_entry_t entry) ...@@ -1737,7 +1738,7 @@ int free_swap_and_cache(swp_entry_t entry)
p = _swap_info_get(entry); p = _swap_info_get(entry);
if (p) { if (p) {
count = __swap_entry_free(p, entry, 1); count = __swap_entry_free(p, entry);
if (count == SWAP_HAS_CACHE && if (count == SWAP_HAS_CACHE &&
!swap_page_trans_huge_swapped(p, entry)) !swap_page_trans_huge_swapped(p, entry))
__try_to_reclaim_swap(p, swp_offset(entry), __try_to_reclaim_swap(p, swp_offset(entry),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment