linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] mm/filemap: increase usage of folio_next_index() helper
@ 2023-09-21  8:15 Minjie Du
  2023-09-22  3:01 ` Yin, Fengwei
  2023-09-22  7:27 ` Matthew Wilcox
  0 siblings, 2 replies; 4+ messages in thread
From: Minjie Du @ 2023-09-21  8:15 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle), Andrew Morton, open list:PAGE CACHE,
	open list:MEMORY MANAGEMENT, open list
  Cc: opensource.kernel, Minjie Du

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] mm/filemap: increase usage of folio_next_index() helper
  2023-09-21  8:15 [PATCH v1] mm/filemap: increase usage of folio_next_index() helper Minjie Du
@ 2023-09-22  3:01 ` Yin, Fengwei
  2023-09-22  7:27 ` Matthew Wilcox
  1 sibling, 0 replies; 4+ messages in thread
From: Yin, Fengwei @ 2023-09-22  3:01 UTC (permalink / raw)
  To: Minjie Du, Matthew Wilcox (Oracle), Andrew Morton,
	open list:PAGE CACHE, open list:MEMORY MANAGEMENT, open list
  Cc: opensource.kernel



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))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] mm/filemap: increase usage of folio_next_index() helper
  2023-09-21  8:15 [PATCH v1] mm/filemap: increase usage of folio_next_index() helper Minjie Du
  2023-09-22  3:01 ` Yin, Fengwei
@ 2023-09-22  7:27 ` Matthew Wilcox
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2023-09-22  7:27 UTC (permalink / raw)
  To: Minjie Du
  Cc: Andrew Morton, open list:PAGE CACHE, open list:MEMORY MANAGEMENT,
	open list, opensource.kernel

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1] mm/filemap: increase usage of folio_next_index() helper
@ 2023-11-07  2:46 Minjie Du
  0 siblings, 0 replies; 4+ messages in thread
From: Minjie Du @ 2023-11-07  2:46 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle), Andrew Morton, open list:PAGE CACHE,
	open list:MEMORY MANAGEMENT, open list
  Cc: opensource.kernel, Minjie Du

Simplify code pattern of 'folio->index + folio_nr_pages(folio)' by using
the existing helper folio_next_index() in filemap_get_folios_contig().

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 9710f43a89ac..ec8a3bbddab4 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2173,7 +2173,7 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,
 
 	if (nr) {
 		folio = fbatch->folios[nr - 1];
-		*start = folio->index + folio_nr_pages(folio);
+		*start = folio_next_index(folio);
 	}
 out:
 	rcu_read_unlock();
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-07  2:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-21  8:15 [PATCH v1] mm/filemap: increase usage of folio_next_index() helper Minjie Du
2023-09-22  3:01 ` Yin, Fengwei
2023-09-22  7:27 ` Matthew Wilcox
  -- strict thread matches above, loose matches on Subject: below --
2023-11-07  2:46 Minjie Du

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).