aboutsummaryrefslogtreecommitdiffstats
path: root/fs/orangefs
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/orangefs
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/orangefs')
-rw-r--r--fs/orangefs/inode.c10
-rw-r--r--fs/orangefs/orangefs-bufmap.c4
-rw-r--r--fs/orangefs/orangefs-utils.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 2382e267b49e..0166faabf8f2 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -18,8 +18,8 @@ static int read_one_page(struct page *page)
18 int max_block; 18 int max_block;
19 ssize_t bytes_read = 0; 19 ssize_t bytes_read = 0;
20 struct inode *inode = page->mapping->host; 20 struct inode *inode = page->mapping->host;
21 const __u32 blocksize = PAGE_CACHE_SIZE; /* inode->i_blksize */ 21 const __u32 blocksize = PAGE_SIZE; /* inode->i_blksize */
22 const __u32 blockbits = PAGE_CACHE_SHIFT; /* inode->i_blkbits */ 22 const __u32 blockbits = PAGE_SHIFT; /* inode->i_blkbits */
23 struct iov_iter to; 23 struct iov_iter to;
24 struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE}; 24 struct bio_vec bv = {.bv_page = page, .bv_len = PAGE_SIZE};
25 25
@@ -86,7 +86,7 @@ static int orangefs_readpages(struct file *file,
86 "failure adding page to cache, read_one_page returned: %d\n", 86 "failure adding page to cache, read_one_page returned: %d\n",
87 ret); 87 ret);
88 } else { 88 } else {
89 page_cache_release(page); 89 put_page(page);
90 } 90 }
91 } 91 }
92 BUG_ON(!list_empty(pages)); 92 BUG_ON(!list_empty(pages));
@@ -328,7 +328,7 @@ static int orangefs_init_iops(struct inode *inode)
328 case S_IFREG: 328 case S_IFREG:
329 inode->i_op = &orangefs_file_inode_operations; 329 inode->i_op = &orangefs_file_inode_operations;
330 inode->i_fop = &orangefs_file_operations; 330 inode->i_fop = &orangefs_file_operations;
331 inode->i_blkbits = PAGE_CACHE_SHIFT; 331 inode->i_blkbits = PAGE_SHIFT;
332 break; 332 break;
333 case S_IFLNK: 333 case S_IFLNK:
334 inode->i_op = &orangefs_symlink_inode_operations; 334 inode->i_op = &orangefs_symlink_inode_operations;
@@ -456,7 +456,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir,
456 inode->i_uid = current_fsuid(); 456 inode->i_uid = current_fsuid();
457 inode->i_gid = current_fsgid(); 457 inode->i_gid = current_fsgid();
458 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 458 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
459 inode->i_size = PAGE_CACHE_SIZE; 459 inode->i_size = PAGE_SIZE;
460 inode->i_rdev = dev; 460 inode->i_rdev = dev;
461 461
462 error = insert_inode_locked4(inode, hash, orangefs_test_inode, ref); 462 error = insert_inode_locked4(inode, hash, orangefs_test_inode, ref);
diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index 1f8acc9f9a88..75375e90a63f 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -170,7 +170,7 @@ orangefs_bufmap_unmap(struct orangefs_bufmap *bufmap)
170 int i; 170 int i;
171 171
172 for (i = 0; i < bufmap->page_count; i++) 172 for (i = 0; i < bufmap->page_count; i++)
173 page_cache_release(bufmap->page_array[i]); 173 put_page(bufmap->page_array[i]);
174} 174}
175 175
176static void 176static void
@@ -299,7 +299,7 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap,
299 299
300 for (i = 0; i < ret; i++) { 300 for (i = 0; i < ret; i++) {
301 SetPageError(bufmap->page_array[i]); 301 SetPageError(bufmap->page_array[i]);
302 page_cache_release(bufmap->page_array[i]); 302 put_page(bufmap->page_array[i]);
303 } 303 }
304 return -ENOMEM; 304 return -ENOMEM;
305 } 305 }
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index 40f5163b56aa..8277aba65e87 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -303,7 +303,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int size)
303 } 303 }
304 break; 304 break;
305 case S_IFDIR: 305 case S_IFDIR:
306 inode->i_size = PAGE_CACHE_SIZE; 306 inode->i_size = PAGE_SIZE;
307 orangefs_inode->blksize = (1 << inode->i_blkbits); 307 orangefs_inode->blksize = (1 << inode->i_blkbits);
308 spin_lock(&inode->i_lock); 308 spin_lock(&inode->i_lock);
309 inode_set_bytes(inode, inode->i_size); 309 inode_set_bytes(inode, inode->i_size);