From: Johannes Weiner vma_page_offset() has no callees: drop it. Hugh adds: vma_pagecache_offset() has a dangerously misleading name, since it's using hugepage units: rename it to vma_hugecache_offset(). Signed-off-by: Johannes Weiner Signed-off-by: Hugh Dickins Cc: Adam Litke Cc: Nishanth Aravamudan Cc: Andi Kleen Cc: Nick Piggin Signed-off-by: Andrew Morton --- mm/hugetlb.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff -puN mm/hugetlb.c~hugetlb-modular-state-for-hugetlb-page-size-cleanup mm/hugetlb.c --- a/mm/hugetlb.c~hugetlb-modular-state-for-hugetlb-page-size-cleanup +++ a/mm/hugetlb.c @@ -36,20 +36,9 @@ static DEFINE_SPINLOCK(hugetlb_lock); /* * Convert the address within this vma to the page offset within - * the mapping, in base page units. - */ -static pgoff_t vma_page_offset(struct vm_area_struct *vma, - unsigned long address) -{ - return ((address - vma->vm_start) >> PAGE_SHIFT) + - (vma->vm_pgoff >> PAGE_SHIFT); -} - -/* - * Convert the address within this vma to the page offset within * the mapping, in pagecache page units; huge pages here. */ -static pgoff_t vma_pagecache_offset(struct hstate *h, +static pgoff_t vma_hugecache_offset(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { return ((address - vma->vm_start) >> huge_page_shift(h)) + @@ -746,7 +735,7 @@ static int vma_needs_reservation(struct struct inode *inode = mapping->host; if (vma->vm_flags & VM_SHARED) { - pgoff_t idx = vma_pagecache_offset(h, vma, addr); + pgoff_t idx = vma_hugecache_offset(h, vma, addr); return region_chg(&inode->i_mapping->private_list, idx, idx + 1); @@ -764,7 +753,7 @@ static void vma_commit_reservation(struc struct inode *inode = mapping->host; if (vma->vm_flags & VM_SHARED) { - pgoff_t idx = vma_pagecache_offset(h, vma, addr); + pgoff_t idx = vma_hugecache_offset(h, vma, addr); region_add(&inode->i_mapping->private_list, idx, idx + 1); } } @@ -1387,7 +1376,7 @@ static struct page *hugetlbfs_pagecache_ pgoff_t idx; mapping = vma->vm_file->f_mapping; - idx = vma_pagecache_offset(h, vma, address); + idx = vma_hugecache_offset(h, vma, address); return find_lock_page(mapping, idx); } @@ -1416,7 +1405,7 @@ static int hugetlb_no_page(struct mm_str } mapping = vma->vm_file->f_mapping; - idx = vma_pagecache_offset(h, vma, address); + idx = vma_hugecache_offset(h, vma, address); /* * Use page lock to guard against racing truncation _