mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
mm/swap: fold __swap_info_get() into its sole caller
Fold __swap_info_get() into its sole caller to make code more clear. Minor readability improvement. Link: https://lkml.kernel.org/r/20220509131416.17553-4-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Cc: Alistair Popple <apopple@nvidia.com> Cc: David Howells <dhowells@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Naoya Horiguchi <naoya.horiguchi@nec.com> Cc: NeilBrown <neilb@suse.de> Cc: Peter Xu <peterx@redhat.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
6106b93efa
commit
afba72b171
1 changed files with 6 additions and 18 deletions
|
@ -1122,7 +1122,7 @@ int get_swap_pages(int n_goal, swp_entry_t swp_entries[], int entry_size)
|
||||||
return n_ret;
|
return n_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct swap_info_struct *__swap_info_get(swp_entry_t entry)
|
static struct swap_info_struct *_swap_info_get(swp_entry_t entry)
|
||||||
{
|
{
|
||||||
struct swap_info_struct *p;
|
struct swap_info_struct *p;
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
|
@ -1137,8 +1137,13 @@ static struct swap_info_struct *__swap_info_get(swp_entry_t entry)
|
||||||
offset = swp_offset(entry);
|
offset = swp_offset(entry);
|
||||||
if (offset >= p->max)
|
if (offset >= p->max)
|
||||||
goto bad_offset;
|
goto bad_offset;
|
||||||
|
if (data_race(!p->swap_map[swp_offset(entry)]))
|
||||||
|
goto bad_free;
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
|
bad_free:
|
||||||
|
pr_err("%s: %s%08lx\n", __func__, Unused_offset, entry.val);
|
||||||
|
goto out;
|
||||||
bad_offset:
|
bad_offset:
|
||||||
pr_err("%s: %s%08lx\n", __func__, Bad_offset, entry.val);
|
pr_err("%s: %s%08lx\n", __func__, Bad_offset, entry.val);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1151,23 +1156,6 @@ static struct swap_info_struct *__swap_info_get(swp_entry_t entry)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct swap_info_struct *_swap_info_get(swp_entry_t entry)
|
|
||||||
{
|
|
||||||
struct swap_info_struct *p;
|
|
||||||
|
|
||||||
p = __swap_info_get(entry);
|
|
||||||
if (!p)
|
|
||||||
goto out;
|
|
||||||
if (data_race(!p->swap_map[swp_offset(entry)]))
|
|
||||||
goto bad_free;
|
|
||||||
return p;
|
|
||||||
|
|
||||||
bad_free:
|
|
||||||
pr_err("%s: %s%08lx\n", __func__, Unused_offset, entry.val);
|
|
||||||
out:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct swap_info_struct *swap_info_get_cont(swp_entry_t entry,
|
static struct swap_info_struct *swap_info_get_cont(swp_entry_t entry,
|
||||||
struct swap_info_struct *q)
|
struct swap_info_struct *q)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue