diff mbox series

[3/6] memory-failure: Remove calls to page_mapping()

Message ID 20240423225552.4113447-4-willy@infradead.org (mailing list archive)
State Not Applicable
Headers show
Series Remove page_mapping() | expand

Commit Message

Matthew Wilcox April 23, 2024, 10:55 p.m. UTC
This is mostly just inlining page_mapping() into the two callers.

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

Comments

Sidhartha Kumar April 23, 2024, 11:52 p.m. UTC | #1
On 4/23/24 3:55 PM, Matthew Wilcox (Oracle) wrote:
> This is mostly just inlining page_mapping() into the two callers.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/memory-failure.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index e065dd9be21e..62aa3db17854 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(hwpoison_filter_flags_value);
>   
>   static int hwpoison_filter_dev(struct page *p)
>   {
> +	struct folio *folio = page_folio(p);
>   	struct address_space *mapping;
>   	dev_t dev;
>   
> @@ -223,7 +224,7 @@ static int hwpoison_filter_dev(struct page *p)
>   	    hwpoison_filter_dev_minor == ~0U)
>   		return 0;
>   
> -	mapping = page_mapping(p);
> +	mapping = folio_mapping(folio);
>   	if (mapping == NULL || mapping->host == NULL)
>   		return -EINVAL;
>   
> @@ -1090,7 +1091,8 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
>    */
>   static int me_pagecache_dirty(struct page_state *ps, struct page *p)
>   {
> -	struct address_space *mapping = page_mapping(p);
> +	struct folio *folio = page_folio(p);
> +	struct address_space *mapping = folio_mapping(folio);
>   
>   	/* TBD: print more information about the file. */
>   	if (mapping) {
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
David Hildenbrand April 24, 2024, 11:54 a.m. UTC | #2
On 24.04.24 00:55, Matthew Wilcox (Oracle) wrote:
> This is mostly just inlining page_mapping() into the two callers.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---

Reviewed-by: David Hildenbrand <david@redhat.com>
Miaohe Lin April 25, 2024, 6:21 a.m. UTC | #3
On 2024/4/24 6:55, Matthew Wilcox (Oracle) wrote:
> This is mostly just inlining page_mapping() into the two callers.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Thanks.
.

> ---
>  mm/memory-failure.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index e065dd9be21e..62aa3db17854 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(hwpoison_filter_flags_value);
>  
>  static int hwpoison_filter_dev(struct page *p)
>  {
> +	struct folio *folio = page_folio(p);
>  	struct address_space *mapping;
>  	dev_t dev;
>  
> @@ -223,7 +224,7 @@ static int hwpoison_filter_dev(struct page *p)
>  	    hwpoison_filter_dev_minor == ~0U)
>  		return 0;
>  
> -	mapping = page_mapping(p);
> +	mapping = folio_mapping(folio);
>  	if (mapping == NULL || mapping->host == NULL)
>  		return -EINVAL;
>  
> @@ -1090,7 +1091,8 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
>   */
>  static int me_pagecache_dirty(struct page_state *ps, struct page *p)
>  {
> -	struct address_space *mapping = page_mapping(p);
> +	struct folio *folio = page_folio(p);
> +	struct address_space *mapping = folio_mapping(folio);
>  
>  	/* TBD: print more information about the file. */
>  	if (mapping) {
>
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e065dd9be21e..62aa3db17854 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -216,6 +216,7 @@  EXPORT_SYMBOL_GPL(hwpoison_filter_flags_value);
 
 static int hwpoison_filter_dev(struct page *p)
 {
+	struct folio *folio = page_folio(p);
 	struct address_space *mapping;
 	dev_t dev;
 
@@ -223,7 +224,7 @@  static int hwpoison_filter_dev(struct page *p)
 	    hwpoison_filter_dev_minor == ~0U)
 		return 0;
 
-	mapping = page_mapping(p);
+	mapping = folio_mapping(folio);
 	if (mapping == NULL || mapping->host == NULL)
 		return -EINVAL;
 
@@ -1090,7 +1091,8 @@  static int me_pagecache_clean(struct page_state *ps, struct page *p)
  */
 static int me_pagecache_dirty(struct page_state *ps, struct page *p)
 {
-	struct address_space *mapping = page_mapping(p);
+	struct folio *folio = page_folio(p);
+	struct address_space *mapping = folio_mapping(folio);
 
 	/* TBD: print more information about the file. */
 	if (mapping) {