From: Christoph Lameter Use page_cache_xxx in mm/fadvise.c Reviewed-by: Dave Chinner Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton --- mm/fadvise.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff -puN mm/fadvise.c~use-page_cache_xxx-in-mm-fadvisec mm/fadvise.c --- a/mm/fadvise.c~use-page_cache_xxx-in-mm-fadvisec +++ a/mm/fadvise.c @@ -91,8 +91,8 @@ asmlinkage long sys_fadvise64_64(int fd, } /* First and last PARTIAL page! */ - start_index = offset >> PAGE_CACHE_SHIFT; - end_index = endbyte >> PAGE_CACHE_SHIFT; + start_index = page_cache_index(mapping, offset); + end_index = page_cache_index(mapping, endbyte); /* Careful about overflow on the "+1" */ nrpages = end_index - start_index + 1; @@ -112,8 +112,8 @@ asmlinkage long sys_fadvise64_64(int fd, filemap_flush(mapping); /* First and last FULL page! */ - start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT; - end_index = (endbyte >> PAGE_CACHE_SHIFT); + start_index = page_cache_next(mapping, offset); + end_index = page_cache_index(mapping, endbyte); if (end_index >= start_index) invalidate_mapping_pages(mapping, start_index, _