[3/4] memory-failure: Convert truncate_error_page() to use folio

Message ID 20221116021011.54164-4-vishal.moola@gmail.com
State New
Headers
Series Removing the try_to_release_page() wrapper |

Commit Message

Vishal Moola Nov. 16, 2022, 2:10 a.m. UTC
  Replaces try_to_release_page() with filemap_release_folio(). This change
is in preparation for the removal of the try_to_release_page() wrapper.

Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
 mm/memory-failure.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

HORIGUCHI NAOYA(堀口 直也) Nov. 17, 2022, 5:49 a.m. UTC | #1
On Tue, Nov 15, 2022 at 06:10:10PM -0800, Vishal Moola (Oracle) wrote:
> Replaces try_to_release_page() with filemap_release_folio(). This change
> is in preparation for the removal of the try_to_release_page() wrapper.
> 
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>

Looks good to me, thank you.

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

> ---
>  mm/memory-failure.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 145bb561ddb3..92ec9b0e58a3 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -827,12 +827,13 @@ static int truncate_error_page(struct page *p, unsigned long pfn,
>  	int ret = MF_FAILED;
>  
>  	if (mapping->a_ops->error_remove_page) {
> +		struct folio *folio = page_folio(p);
>  		int err = mapping->a_ops->error_remove_page(mapping, p);
>  
>  		if (err != 0) {
>  			pr_info("%#lx: Failed to punch page: %d\n", pfn, err);
> -		} else if (page_has_private(p) &&
> -			   !try_to_release_page(p, GFP_NOIO)) {
> +		} else if (folio_has_private(folio) &&
> +			   !filemap_release_folio(folio, GFP_NOIO)) {
>  			pr_info("%#lx: failed to release buffers\n", pfn);
>  		} else {
>  			ret = MF_RECOVERED;
> -- 
> 2.38.1
  

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 145bb561ddb3..92ec9b0e58a3 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -827,12 +827,13 @@  static int truncate_error_page(struct page *p, unsigned long pfn,
 	int ret = MF_FAILED;
 
 	if (mapping->a_ops->error_remove_page) {
+		struct folio *folio = page_folio(p);
 		int err = mapping->a_ops->error_remove_page(mapping, p);
 
 		if (err != 0) {
 			pr_info("%#lx: Failed to punch page: %d\n", pfn, err);
-		} else if (page_has_private(p) &&
-			   !try_to_release_page(p, GFP_NOIO)) {
+		} else if (folio_has_private(folio) &&
+			   !filemap_release_folio(folio, GFP_NOIO)) {
 			pr_info("%#lx: failed to release buffers\n", pfn);
 		} else {
 			ret = MF_RECOVERED;