diff mbox series

mm: Remove struct page from get_shadow_from_swap_cache

Message ID 20240402201659.918308-1-willy@infradead.org (mailing list archive)
State New
Headers show
Series mm: Remove struct page from get_shadow_from_swap_cache | expand

Commit Message

Matthew Wilcox April 2, 2024, 8:16 p.m. UTC
We don't actually use any parts of struct page; all we do is check the
value of the pointer.  So give the pointer the appropriate name & type.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/swap_state.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

David Hildenbrand April 4, 2024, 6:40 p.m. UTC | #1
On 02.04.24 22:16, Matthew Wilcox (Oracle) wrote:
> We don't actually use any parts of struct page; all we do is check the
> value of the pointer.  So give the pointer the appropriate name & type.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/swap_state.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index f3c379e93bc6..c00ef2f18f2b 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -73,11 +73,11 @@ void *get_shadow_from_swap_cache(swp_entry_t entry)
>   {
>   	struct address_space *address_space = swap_address_space(entry);
>   	pgoff_t idx = swp_offset(entry);
> -	struct page *page;
> +	void *shadow;
>   
> -	page = xa_load(&address_space->i_pages, idx);
> -	if (xa_is_value(page))
> -		return page;
> +	shadow = xa_load(&address_space->i_pages, idx);
> +	if (xa_is_value(shadow))
> +		return shadow;
>   	return NULL;
>   }
>   

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/swap_state.c b/mm/swap_state.c
index f3c379e93bc6..c00ef2f18f2b 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -73,11 +73,11 @@  void *get_shadow_from_swap_cache(swp_entry_t entry)
 {
 	struct address_space *address_space = swap_address_space(entry);
 	pgoff_t idx = swp_offset(entry);
-	struct page *page;
+	void *shadow;
 
-	page = xa_load(&address_space->i_pages, idx);
-	if (xa_is_value(page))
-		return page;
+	shadow = xa_load(&address_space->i_pages, idx);
+	if (xa_is_value(shadow))
+		return shadow;
 	return NULL;
 }