From: Matthew Wilcox Date: Tue, 8 Sep 2015 21:59:39 +0000 (-0700) Subject: dax: use linear_page_index() X-Git-Tag: firefly_0821_release~176^2~1103^2~113 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3fdd1b479dbc03347e98f904f54133a9cef5521f;p=firefly-linux-kernel-4.4.55.git dax: use linear_page_index() I was basically open-coding it (thanks to copying code from do_fault() which probably also needs to be fixed). Signed-off-by: Matthew Wilcox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/dax.c b/fs/dax.c index 74838c43be91..9ef9b80cc132 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -529,7 +529,7 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, if ((pmd_addr + PMD_SIZE) > vma->vm_end) return VM_FAULT_FALLBACK; - pgoff = ((pmd_addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; + pgoff = linear_page_index(vma, pmd_addr); size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; if (pgoff >= size) return VM_FAULT_SIGBUS;