Signed-off-by: Christoph Lameter --- mm/filemap_xip.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) Index: vps/mm/filemap_xip.c =================================================================== --- vps.orig/mm/filemap_xip.c 2007-06-09 21:52:40.000000000 -0700 +++ vps/mm/filemap_xip.c 2007-06-09 21:58:11.000000000 -0700 @@ -60,24 +60,24 @@ do_xip_mapping_read(struct address_space BUG_ON(!mapping->a_ops->get_xip_page); - index = *ppos >> PAGE_CACHE_SHIFT; - offset = *ppos & ~PAGE_CACHE_MASK; + index = page_cache_index(mapping, *ppos); + offset = page_cache_offset(mapping, *ppos); isize = i_size_read(inode); if (!isize) goto out; - end_index = (isize - 1) >> PAGE_CACHE_SHIFT; + end_index = page_cache_index(mapping, isize - 1); for (;;) { struct page *page; unsigned long nr, ret; /* nr is the maximum number of bytes to copy from this page */ - nr = PAGE_CACHE_SIZE; + nr = page_cache_size(mapping); if (index >= end_index) { if (index > end_index) goto out; - nr = ((isize - 1) & ~PAGE_CACHE_MASK) + 1; + nr = page_cache_next(mapping, size - 1) + 1; if (nr <= offset) { goto out; } @@ -116,8 +116,8 @@ do_xip_mapping_read(struct address_space */ ret = actor(desc, page, offset, nr); offset += ret; - index += offset >> PAGE_CACHE_SHIFT; - offset &= ~PAGE_CACHE_MASK; + index += page_cache_index(mapping, offset); + offset = page_cache_offset(mapping, offset); if (ret == nr && desc->count) continue; @@ -130,7 +130,7 @@ no_xip_page: } out: - *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset; + *ppos = page_cache_pos(mapping, index, offset); if (filp) file_accessed(filp); } @@ -242,7 +242,7 @@ static struct page *xip_file_fault(struc /* XXX: are VM_FAULT_ codes OK? */ - size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; + size = page_cache_next(mapping, i_size_read(inode)); if (fdata->pgoff >= size) { fdata->type = VM_FAULT_SIGBUS; return NULL; @@ -320,9 +320,9 @@ __xip_file_write(struct file *filp, cons size_t copied; char *kaddr; - offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */ - index = pos >> PAGE_CACHE_SHIFT; - bytes = PAGE_CACHE_SIZE - offset; + offset = page_cache_offset(mapping, pos); /* Within page */ + index = page_cache_index(mapping, pos); + bytes = page_cache_size(mapping) - offset; if (bytes > count) bytes = count; @@ -433,8 +433,8 @@ EXPORT_SYMBOL_GPL(xip_file_write); int xip_truncate_page(struct address_space *mapping, loff_t from) { - pgoff_t index = from >> PAGE_CACHE_SHIFT; - unsigned offset = from & (PAGE_CACHE_SIZE-1); + pgoff_t index = page_cache_index(mapping, from); + unsigned offset = page_cache_offset(mapping, from); unsigned blocksize; unsigned length; struct page *page; -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/