2023-09-16 07:12:40

by Pankaj Raghav (Samsung)

[permalink] [raw]
Subject: [RFC 08/23] filemap: align the index to mapping_min_order in filemap_get_folios_tag()

From: Luis Chamberlain <[email protected]>

Align the index to the mapping_min_order number of pages while setting
the XA_STATE in filemap_get_folios_tag().

Signed-off-by: Luis Chamberlain <[email protected]>
---
mm/filemap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 15bc810bfc89..21e1341526ab 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2280,7 +2280,9 @@ EXPORT_SYMBOL(filemap_get_folios_contig);
unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start,
pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch)
{
- XA_STATE(xas, &mapping->i_pages, *start);
+ unsigned int min_order = mapping_min_folio_order(mapping);
+ unsigned int nrpages = 1UL << min_order;
+ XA_STATE(xas, &mapping->i_pages, round_down(*start, nrpages));
struct folio *folio;

rcu_read_lock();
--
2.40.1