aboutsummaryrefslogtreecommitdiffstats
path: root/fs/qnx6/dir.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/qnx6/dir.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/qnx6/dir.c')
-rw-r--r--fs/qnx6/dir.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c
index e1f37278cf97..144ceda4948e 100644
--- a/fs/qnx6/dir.c
+++ b/fs/qnx6/dir.c
@@ -35,9 +35,9 @@ static struct page *qnx6_get_page(struct inode *dir, unsigned long n)
35static unsigned last_entry(struct inode *inode, unsigned long page_nr) 35static unsigned last_entry(struct inode *inode, unsigned long page_nr)
36{ 36{
37 unsigned long last_byte = inode->i_size; 37 unsigned long last_byte = inode->i_size;
38 last_byte -= page_nr << PAGE_CACHE_SHIFT; 38 last_byte -= page_nr << PAGE_SHIFT;
39 if (last_byte > PAGE_CACHE_SIZE) 39 if (last_byte > PAGE_SIZE)
40 last_byte = PAGE_CACHE_SIZE; 40 last_byte = PAGE_SIZE;
41 return last_byte / QNX6_DIR_ENTRY_SIZE; 41 return last_byte / QNX6_DIR_ENTRY_SIZE;
42} 42}
43 43
@@ -47,9 +47,9 @@ static struct qnx6_long_filename *qnx6_longname(struct super_block *sb,
47{ 47{
48 struct qnx6_sb_info *sbi = QNX6_SB(sb); 48 struct qnx6_sb_info *sbi = QNX6_SB(sb);
49 u32 s = fs32_to_cpu(sbi, de->de_long_inode); /* in block units */ 49 u32 s = fs32_to_cpu(sbi, de->de_long_inode); /* in block units */
50 u32 n = s >> (PAGE_CACHE_SHIFT - sb->s_blocksize_bits); /* in pages */ 50 u32 n = s >> (PAGE_SHIFT - sb->s_blocksize_bits); /* in pages */
51 /* within page */ 51 /* within page */
52 u32 offs = (s << sb->s_blocksize_bits) & ~PAGE_CACHE_MASK; 52 u32 offs = (s << sb->s_blocksize_bits) & ~PAGE_MASK;
53 struct address_space *mapping = sbi->longfile->i_mapping; 53 struct address_space *mapping = sbi->longfile->i_mapping;
54 struct page *page = read_mapping_page(mapping, n, NULL); 54 struct page *page = read_mapping_page(mapping, n, NULL);
55 if (IS_ERR(page)) 55 if (IS_ERR(page))
@@ -115,8 +115,8 @@ static int qnx6_readdir(struct file *file, struct dir_context *ctx)
115 struct qnx6_sb_info *sbi = QNX6_SB(s); 115 struct qnx6_sb_info *sbi = QNX6_SB(s);
116 loff_t pos = ctx->pos & ~(QNX6_DIR_ENTRY_SIZE - 1); 116 loff_t pos = ctx->pos & ~(QNX6_DIR_ENTRY_SIZE - 1);
117 unsigned long npages = dir_pages(inode); 117 unsigned long npages = dir_pages(inode);
118 unsigned long n = pos >> PAGE_CACHE_SHIFT; 118 unsigned long n = pos >> PAGE_SHIFT;
119 unsigned start = (pos & ~PAGE_CACHE_MASK) / QNX6_DIR_ENTRY_SIZE; 119 unsigned start = (pos & ~PAGE_MASK) / QNX6_DIR_ENTRY_SIZE;
120 bool done = false; 120 bool done = false;
121 121
122 ctx->pos = pos; 122 ctx->pos = pos;
@@ -131,7 +131,7 @@ static int qnx6_readdir(struct file *file, struct dir_context *ctx)
131 131
132 if (IS_ERR(page)) { 132 if (IS_ERR(page)) {
133 pr_err("%s(): read failed\n", __func__); 133 pr_err("%s(): read failed\n", __func__);
134 ctx->pos = (n + 1) << PAGE_CACHE_SHIFT; 134 ctx->pos = (n + 1) << PAGE_SHIFT;
135 return PTR_ERR(page); 135 return PTR_ERR(page);
136 } 136 }
137 de = ((struct qnx6_dir_entry *)page_address(page)) + start; 137 de = ((struct qnx6_dir_entry *)page_address(page)) + start;