aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/file.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2016-04-01 08:29:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-04 13:41:08 -0400
commit09cbfeaf1a5a67bfb3201e0c83c810cecb2efa5a (patch)
tree6cdf210c9c0f981cd22544feeba701892ec19464 /fs/ocfs2/file.c
parentc05c2ec96bb8b7310da1055c7b9d786a3ec6dc0c (diff)
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time ago with promise that one day it will be possible to implement page cache with bigger chunks than PAGE_SIZE. This promise never materialized. And unlikely will. We have many places where PAGE_CACHE_SIZE assumed to be equal to PAGE_SIZE. And it's constant source of confusion on whether PAGE_CACHE_* or PAGE_* constant should be used in a particular case, especially on the border between fs and mm. Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much breakage to be doable. Let's stop pretending that pages in page cache are special. They are not. The changes are pretty straight-forward: - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>; - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>; - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN}; - page_cache_get() -> get_page(); - page_cache_release() -> put_page(); This patch contains automated changes generated with coccinelle using script below. For some reason, coccinelle doesn't patch header files. I've called spatch for them manually. The only adjustment after coccinelle is revert of changes to PAGE_CAHCE_ALIGN definition: we are going to drop it later. There are few places in the code where coccinelle didn't reach. I'll fix them manually in a separate patch. Comments and documentation also will be addressed with the separate patch. virtual patch @@ expression E; @@ - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT) + E @@ expression E; @@ - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) + E @@ @@ - PAGE_CACHE_SHIFT + PAGE_SHIFT @@ @@ - PAGE_CACHE_SIZE + PAGE_SIZE @@ @@ - PAGE_CACHE_MASK + PAGE_MASK @@ expression E; @@ - PAGE_CACHE_ALIGN(E) + PAGE_ALIGN(E) @@ expression E; @@ - page_cache_get(E) + get_page(E) @@ expression E; @@ - page_cache_release(E) + put_page(E) Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r--fs/ocfs2/file.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index c18ab45f8d21..5308841756be 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -770,14 +770,14 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
770{ 770{
771 struct address_space *mapping = inode->i_mapping; 771 struct address_space *mapping = inode->i_mapping;
772 struct page *page; 772 struct page *page;
773 unsigned long index = abs_from >> PAGE_CACHE_SHIFT; 773 unsigned long index = abs_from >> PAGE_SHIFT;
774 handle_t *handle; 774 handle_t *handle;
775 int ret = 0; 775 int ret = 0;
776 unsigned zero_from, zero_to, block_start, block_end; 776 unsigned zero_from, zero_to, block_start, block_end;
777 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 777 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
778 778
779 BUG_ON(abs_from >= abs_to); 779 BUG_ON(abs_from >= abs_to);
780 BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT)); 780 BUG_ON(abs_to > (((u64)index + 1) << PAGE_SHIFT));
781 BUG_ON(abs_from & (inode->i_blkbits - 1)); 781 BUG_ON(abs_from & (inode->i_blkbits - 1));
782 782
783 handle = ocfs2_zero_start_ordered_transaction(inode, di_bh); 783 handle = ocfs2_zero_start_ordered_transaction(inode, di_bh);
@@ -794,10 +794,10 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
794 } 794 }
795 795
796 /* Get the offsets within the page that we want to zero */ 796 /* Get the offsets within the page that we want to zero */
797 zero_from = abs_from & (PAGE_CACHE_SIZE - 1); 797 zero_from = abs_from & (PAGE_SIZE - 1);
798 zero_to = abs_to & (PAGE_CACHE_SIZE - 1); 798 zero_to = abs_to & (PAGE_SIZE - 1);
799 if (!zero_to) 799 if (!zero_to)
800 zero_to = PAGE_CACHE_SIZE; 800 zero_to = PAGE_SIZE;
801 801
802 trace_ocfs2_write_zero_page( 802 trace_ocfs2_write_zero_page(
803 (unsigned long long)OCFS2_I(inode)->ip_blkno, 803 (unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -851,7 +851,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
851 851
852out_unlock: 852out_unlock:
853 unlock_page(page); 853 unlock_page(page);
854 page_cache_release(page); 854 put_page(page);
855out_commit_trans: 855out_commit_trans:
856 if (handle) 856 if (handle)
857 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); 857 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
@@ -959,7 +959,7 @@ static int ocfs2_zero_extend_range(struct inode *inode, u64 range_start,
959 BUG_ON(range_start >= range_end); 959 BUG_ON(range_start >= range_end);
960 960
961 while (zero_pos < range_end) { 961 while (zero_pos < range_end) {
962 next_pos = (zero_pos & PAGE_CACHE_MASK) + PAGE_CACHE_SIZE; 962 next_pos = (zero_pos & PAGE_MASK) + PAGE_SIZE;
963 if (next_pos > range_end) 963 if (next_pos > range_end)
964 next_pos = range_end; 964 next_pos = range_end;
965 rc = ocfs2_write_zero_page(inode, zero_pos, next_pos, di_bh); 965 rc = ocfs2_write_zero_page(inode, zero_pos, next_pos, di_bh);