[RFC PATCH 68/79] mm/vma_address: convert page's index lookup to be against specific mapping

From: jglisse
Date: Wed Apr 04 2018 - 15:19:37 EST


From: JÃrÃme Glisse <jglisse@xxxxxxxxxx>

Pass down the mapping ...

Signed-off-by: JÃrÃme Glisse <jglisse@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
---
mm/internal.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/internal.h b/mm/internal.h
index e6bd35182dae..43e9ed27362f 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -336,7 +336,9 @@ extern pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma);
static inline unsigned long
__vma_address(struct page *page, struct vm_area_struct *vma)
{
- pgoff_t pgoff = page_to_pgoff(page);
+ struct address_space *mapping = vma->vm_file ? vma->vm_file->f_mapping : NULL;
+
+ pgoff_t pgoff = _page_to_pgoff(page, mapping);
return vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
}

--
2.14.3