mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] mm/filemap: use folio_next_index() for start
@ 2026-06-01 11:04 tanze
  2026-06-01 16:25 ` Jan Kara
  2026-06-01 17:48 ` Matthew Wilcox
  0 siblings, 2 replies; 3+ messages in thread
From: tanze @ 2026-06-01 11:04 UTC (permalink / raw)
  To: linux-mm, linux-fsdevel, linux-kernel; +Cc: willy, akpm, jack

Use folio_next_index() instead of open-coding
folio->index + folio_nr_pages(folio) when updating @start in
filemap_get_folios_contig(), filemap_get_folios_tag(), and
filemap_get_folios_dirty().

Signed-off-by: tanze <tanze@kylinos.cn>
---
 mm/filemap.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 4e636647100c..e233d4a003ce 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2283,8 +2283,7 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,
 			goto put_folio;
 
 		if (!folio_batch_add(fbatch, folio)) {
-			nr = folio_nr_pages(folio);
-			*start = folio->index + nr;
+			*start = folio_next_index(folio);
 			goto out;
 		}
 		xas_advance(&xas, folio_next_index(folio) - 1);
@@ -2344,8 +2343,7 @@ unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start,
 		if (xa_is_value(folio))
 			continue;
 		if (!folio_batch_add(fbatch, folio)) {
-			unsigned long nr = folio_nr_pages(folio);
-			*start = folio->index + nr;
+			*start = folio_next_index(folio);
 			goto out;
 		}
 	}
@@ -2403,8 +2401,7 @@ unsigned filemap_get_folios_dirty(struct address_space *mapping, pgoff_t *start,
 			}
 		}
 		if (!folio_batch_add(fbatch, folio)) {
-			unsigned long nr = folio_nr_pages(folio);
-			*start = folio->index + nr;
+			*start = folio_next_index(folio);
 			goto out;
 		}
 	}
-- 
2.43.0


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

end of thread, other threads:[~2026-06-01 17:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-01 11:04 [PATCH v1] mm/filemap: use folio_next_index() for start tanze
2026-06-01 16:25 ` Jan Kara
2026-06-01 17:48 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®