Skip to content

Commit a858f7b

Browse files
Johannes Weinertorvalds
authored andcommitted
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(). [apw@shadowen.org: restack onto fixed MAP_PRIVATE reservations] [akpm@linux-foundation.org: vma_split conversion] Signed-off-by: Johannes Weiner <hannes@saeurebad.de> Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Adam Litke <agl@us.ibm.com> Cc: Nishanth Aravamudan <nacc@us.ibm.com> Cc: Andi Kleen <ak@suse.de> Cc: Nick Piggin <npiggin@suse.de> Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 84afd99 commit a858f7b

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

‎mm/hugetlb.c‎

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -199,22 +199,11 @@ static long region_count(struct list_head *head, long f, long t)
199199
return chg;
200200
}
201201

202-
/*
203-
* Convert the address within this vma to the page offset within
204-
* the mapping, in base page units.
205-
*/
206-
static pgoff_t vma_page_offset(struct vm_area_struct *vma,
207-
unsigned long address)
208-
{
209-
return ((address - vma->vm_start) >> PAGE_SHIFT) +
210-
(vma->vm_pgoff >> PAGE_SHIFT);
211-
}
212-
213202
/*
214203
* Convert the address within this vma to the page offset within
215204
* the mapping, in pagecache page units; huge pages here.
216205
*/
217-
static pgoff_t vma_pagecache_offset(struct vm_area_struct *vma,
206+
static pgoff_t vma_hugecache_offset(struct vm_area_struct *vma,
218207
unsigned long address)
219208
{
220209
return ((address - vma->vm_start) >> HPAGE_SHIFT) +
@@ -806,7 +795,7 @@ static int vma_needs_reservation(struct vm_area_struct *vma, unsigned long addr)
806795
struct inode *inode = mapping->host;
807796

808797
if (vma->vm_flags & VM_SHARED) {
809-
pgoff_t idx = vma_pagecache_offset(vma, addr);
798+
pgoff_t idx = vma_hugecache_offset(vma, addr);
810799
return region_chg(&inode->i_mapping->private_list,
811800
idx, idx + 1);
812801

@@ -815,7 +804,7 @@ static int vma_needs_reservation(struct vm_area_struct *vma, unsigned long addr)
815804

816805
} else {
817806
int err;
818-
pgoff_t idx = vma_pagecache_offset(vma, addr);
807+
pgoff_t idx = vma_hugecache_offset(vma, addr);
819808
struct resv_map *reservations = vma_resv_map(vma);
820809

821810
err = region_chg(&reservations->regions, idx, idx + 1);
@@ -831,11 +820,11 @@ static void vma_commit_reservation(struct vm_area_struct *vma,
831820
struct inode *inode = mapping->host;
832821

833822
if (vma->vm_flags & VM_SHARED) {
834-
pgoff_t idx = vma_pagecache_offset(vma, addr);
823+
pgoff_t idx = vma_hugecache_offset(vma, addr);
835824
region_add(&inode->i_mapping->private_list, idx, idx + 1);
836825

837826
} else if (is_vma_resv_set(vma, HPAGE_RESV_OWNER)) {
838-
pgoff_t idx = vma_pagecache_offset(vma, addr);
827+
pgoff_t idx = vma_hugecache_offset(vma, addr);
839828
struct resv_map *reservations = vma_resv_map(vma);
840829

841830
/* Mark this page used in the map. */
@@ -1153,8 +1142,8 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma)
11531142
unsigned long end;
11541143

11551144
if (reservations) {
1156-
start = vma_pagecache_offset(vma, vma->vm_start);
1157-
end = vma_pagecache_offset(vma, vma->vm_end);
1145+
start = vma_hugecache_offset(vma, vma->vm_start);
1146+
end = vma_hugecache_offset(vma, vma->vm_end);
11581147

11591148
reserve = (end - start) -
11601149
region_count(&reservations->regions, start, end);
@@ -1471,7 +1460,7 @@ static struct page *hugetlbfs_pagecache_page(struct vm_area_struct *vma,
14711460
pgoff_t idx;
14721461

14731462
mapping = vma->vm_file->f_mapping;
1474-
idx = vma_pagecache_offset(vma, address);
1463+
idx = vma_hugecache_offset(vma, address);
14751464

14761465
return find_lock_page(mapping, idx);
14771466
}
@@ -1499,7 +1488,7 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
14991488
}
15001489

15011490
mapping = vma->vm_file->f_mapping;
1502-
idx = vma_pagecache_offset(vma, address);
1491+
idx = vma_hugecache_offset(vma, address);
15031492

15041493
/*
15051494
* Use page lock to guard against racing truncation

0 commit comments

Comments
 (0)