Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: remove page_file_index

After using the offset of the swap entry as the key of the swap cache,
the page_index() becomes exactly same as page_file_index(). So the
page_file_index() is removed and the callers are changed to use
page_index() instead.

Link: http://lkml.kernel.org/r/1473270649-27229-2-git-send-email-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Huang Ying and committed by
Linus Torvalds
8cd79788 f6ab1f7f

+8 -20
+3 -3
fs/nfs/internal.h
··· 681 681 loff_t i_size = i_size_read(page_file_mapping(page)->host); 682 682 683 683 if (i_size > 0) { 684 - pgoff_t page_index = page_file_index(page); 684 + pgoff_t index = page_index(page); 685 685 pgoff_t end_index = (i_size - 1) >> PAGE_SHIFT; 686 - if (page_index < end_index) 686 + if (index < end_index) 687 687 return PAGE_SIZE; 688 - if (page_index == end_index) 688 + if (index == end_index) 689 689 return ((i_size - 1) & ~PAGE_MASK) + 1; 690 690 } 691 691 return 0;
+1 -1
fs/nfs/pagelist.c
··· 342 342 * update_nfs_request below if the region is not locked. */ 343 343 req->wb_page = page; 344 344 if (page) { 345 - req->wb_index = page_file_index(page); 345 + req->wb_index = page_index(page); 346 346 get_page(page); 347 347 } 348 348 req->wb_offset = offset;
+1 -1
fs/nfs/read.c
··· 295 295 int error; 296 296 297 297 dprintk("NFS: nfs_readpage (%p %ld@%lu)\n", 298 - page, PAGE_SIZE, page_file_index(page)); 298 + page, PAGE_SIZE, page_index(page)); 299 299 nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); 300 300 nfs_add_stats(inode, NFSIOS_READPAGES, 1); 301 301
+2 -2
fs/nfs/write.c
··· 151 151 spin_lock(&inode->i_lock); 152 152 i_size = i_size_read(inode); 153 153 end_index = (i_size - 1) >> PAGE_SHIFT; 154 - if (i_size > 0 && page_file_index(page) < end_index) 154 + if (i_size > 0 && page_index(page) < end_index) 155 155 goto out; 156 156 end = page_file_offset(page) + ((loff_t)offset+count); 157 157 if (i_size >= end) ··· 603 603 { 604 604 int ret; 605 605 606 - nfs_pageio_cond_complete(pgio, page_file_index(page)); 606 + nfs_pageio_cond_complete(pgio, page_index(page)); 607 607 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE, 608 608 launder); 609 609 if (ret == -EAGAIN) {
-12
include/linux/mm.h
··· 1061 1061 return page->index; 1062 1062 } 1063 1063 1064 - /* 1065 - * Return the file index of the page. Regular pagecache pages use ->index 1066 - * whereas swapcache pages use swp_offset(->private) 1067 - */ 1068 - static inline pgoff_t page_file_index(struct page *page) 1069 - { 1070 - if (unlikely(PageSwapCache(page))) 1071 - return __page_file_index(page); 1072 - 1073 - return page->index; 1074 - } 1075 - 1076 1064 bool page_mapped(struct page *page); 1077 1065 struct address_space *page_mapping(struct page *page); 1078 1066
+1 -1
include/linux/pagemap.h
··· 408 408 409 409 static inline loff_t page_file_offset(struct page *page) 410 410 { 411 - return ((loff_t)page_file_index(page)) << PAGE_SHIFT; 411 + return ((loff_t)page_index(page)) << PAGE_SHIFT; 412 412 } 413 413 414 414 extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma,