return chg;
}
-/*
- * 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 vm_area_struct *vma,
+static pgoff_t vma_hugecache_offset(struct vm_area_struct *vma,
unsigned long address)
{
return ((address - vma->vm_start) >> HPAGE_SHIFT) +
struct inode *inode = mapping->host;
if (vma->vm_flags & VM_SHARED) {
- pgoff_t idx = vma_pagecache_offset(vma, addr);
+ pgoff_t idx = vma_hugecache_offset(vma, addr);
return region_chg(&inode->i_mapping->private_list,
idx, idx + 1);
} else {
int err;
- pgoff_t idx = vma_pagecache_offset(vma, addr);
+ pgoff_t idx = vma_hugecache_offset(vma, addr);
struct resv_map *reservations = vma_resv_map(vma);
err = region_chg(&reservations->regions, idx, idx + 1);
struct inode *inode = mapping->host;
if (vma->vm_flags & VM_SHARED) {
- pgoff_t idx = vma_pagecache_offset(vma, addr);
+ pgoff_t idx = vma_hugecache_offset(vma, addr);
region_add(&inode->i_mapping->private_list, idx, idx + 1);
} else if (is_vma_resv_set(vma, HPAGE_RESV_OWNER)) {
- pgoff_t idx = vma_pagecache_offset(vma, addr);
+ pgoff_t idx = vma_hugecache_offset(vma, addr);
struct resv_map *reservations = vma_resv_map(vma);
/* Mark this page used in the map. */
unsigned long end;
if (reservations) {
- start = vma_pagecache_offset(vma, vma->vm_start);
- end = vma_pagecache_offset(vma, vma->vm_end);
+ start = vma_hugecache_offset(vma, vma->vm_start);
+ end = vma_hugecache_offset(vma, vma->vm_end);
reserve = (end - start) -
region_count(&reservations->regions, start, end);
pgoff_t idx;
mapping = vma->vm_file->f_mapping;
- idx = vma_pagecache_offset(vma, address);
+ idx = vma_hugecache_offset(vma, address);
return find_lock_page(mapping, idx);
}
}
mapping = vma->vm_file->f_mapping;
- idx = vma_pagecache_offset(vma, address);
+ idx = vma_hugecache_offset(vma, address);
/*
* Use page lock to guard against racing truncation