[PATCH v1] mm/filemap: increase usage of folio_next_index() helper

Minjie Du posted 1 patch 2 years, 4 months ago
There is a newer version of this series
mm/filemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] mm/filemap: increase usage of folio_next_index() helper
Posted by Minjie Du 2 years, 4 months ago
Simplify code pattern of 'folio->index + folio_nr_pages(folio)' by using
the existing helper folio_next_index() in filemap_map_pages().

Signed-off-by: Minjie Du <duminjie@vivo.com>
---
 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 4ea4387053e8..f8d0b97f9e94 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3591,7 +3591,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
 		addr += (xas.xa_index - last_pgoff) << PAGE_SHIFT;
 		vmf->pte += xas.xa_index - last_pgoff;
 		last_pgoff = xas.xa_index;
-		end = folio->index + folio_nr_pages(folio) - 1;
+		end = folio_next_index(folio) - 1;
 		nr_pages = min(end, end_pgoff) - xas.xa_index + 1;
 
 		if (!folio_test_large(folio))
-- 
2.39.0
Re: [PATCH v1] mm/filemap: increase usage of folio_next_index() helper
Posted by Matthew Wilcox 2 years, 4 months ago
On Thu, Sep 21, 2023 at 04:15:35PM +0800, Minjie Du wrote:
> Simplify code pattern of 'folio->index + folio_nr_pages(folio)' by using
> the existing helper folio_next_index() in filemap_map_pages().
> 
> Signed-off-by: Minjie Du <duminjie@vivo.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Re: [PATCH v1] mm/filemap: increase usage of folio_next_index() helper
Posted by Yin, Fengwei 2 years, 4 months ago

On 9/21/2023 4:15 PM, Minjie Du wrote:
> Simplify code pattern of 'folio->index + folio_nr_pages(folio)' by using
> the existing helper folio_next_index() in filemap_map_pages().
> 
> Signed-off-by: Minjie Du <duminjie@vivo.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>


Regards
Yin, Fengwei

> ---
>  mm/filemap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 4ea4387053e8..f8d0b97f9e94 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -3591,7 +3591,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,
>  		addr += (xas.xa_index - last_pgoff) << PAGE_SHIFT;
>  		vmf->pte += xas.xa_index - last_pgoff;
>  		last_pgoff = xas.xa_index;
> -		end = folio->index + folio_nr_pages(folio) - 1;
> +		end = folio_next_index(folio) - 1;
>  		nr_pages = min(end, end_pgoff) - xas.xa_index + 1;
>  
>  		if (!folio_test_large(folio))