aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.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/btrfs/disk-io.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/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4b02591b0301..942af3d2885f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1055,7 +1055,7 @@ static void btree_invalidatepage(struct page *page, unsigned int offset,
1055 (unsigned long long)page_offset(page)); 1055 (unsigned long long)page_offset(page));
1056 ClearPagePrivate(page); 1056 ClearPagePrivate(page);
1057 set_page_private(page, 0); 1057 set_page_private(page, 0);
1058 page_cache_release(page); 1058 put_page(page);
1059 } 1059 }
1060} 1060}
1061 1061
@@ -1757,7 +1757,7 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
1757 if (err) 1757 if (err)
1758 return err; 1758 return err;
1759 1759
1760 bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE; 1760 bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_SIZE;
1761 bdi->congested_fn = btrfs_congested_fn; 1761 bdi->congested_fn = btrfs_congested_fn;
1762 bdi->congested_data = info; 1762 bdi->congested_data = info;
1763 bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK; 1763 bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK;
@@ -2537,7 +2537,7 @@ int open_ctree(struct super_block *sb,
2537 err = ret; 2537 err = ret;
2538 goto fail_bdi; 2538 goto fail_bdi;
2539 } 2539 }
2540 fs_info->dirty_metadata_batch = PAGE_CACHE_SIZE * 2540 fs_info->dirty_metadata_batch = PAGE_SIZE *
2541 (1 + ilog2(nr_cpu_ids)); 2541 (1 + ilog2(nr_cpu_ids));
2542 2542
2543 ret = percpu_counter_init(&fs_info->delalloc_bytes, 0, GFP_KERNEL); 2543 ret = percpu_counter_init(&fs_info->delalloc_bytes, 0, GFP_KERNEL);
@@ -2782,7 +2782,7 @@ int open_ctree(struct super_block *sb,
2782 * flag our filesystem as having big metadata blocks if 2782 * flag our filesystem as having big metadata blocks if
2783 * they are bigger than the page size 2783 * they are bigger than the page size
2784 */ 2784 */
2785 if (btrfs_super_nodesize(disk_super) > PAGE_CACHE_SIZE) { 2785 if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) {
2786 if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) 2786 if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA))
2787 printk(KERN_INFO "BTRFS: flagging fs with big metadata feature\n"); 2787 printk(KERN_INFO "BTRFS: flagging fs with big metadata feature\n");
2788 features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; 2788 features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
@@ -2832,7 +2832,7 @@ int open_ctree(struct super_block *sb,
2832 2832
2833 fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); 2833 fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super);
2834 fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, 2834 fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages,
2835 SZ_4M / PAGE_CACHE_SIZE); 2835 SZ_4M / PAGE_SIZE);
2836 2836
2837 tree_root->nodesize = nodesize; 2837 tree_root->nodesize = nodesize;
2838 tree_root->sectorsize = sectorsize; 2838 tree_root->sectorsize = sectorsize;
@@ -4071,9 +4071,9 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
4071 ret = -EINVAL; 4071 ret = -EINVAL;
4072 } 4072 }
4073 /* Only PAGE SIZE is supported yet */ 4073 /* Only PAGE SIZE is supported yet */
4074 if (sectorsize != PAGE_CACHE_SIZE) { 4074 if (sectorsize != PAGE_SIZE) {
4075 printk(KERN_ERR "BTRFS: sectorsize %llu not supported yet, only support %lu\n", 4075 printk(KERN_ERR "BTRFS: sectorsize %llu not supported yet, only support %lu\n",
4076 sectorsize, PAGE_CACHE_SIZE); 4076 sectorsize, PAGE_SIZE);
4077 ret = -EINVAL; 4077 ret = -EINVAL;
4078 } 4078 }
4079 if (!is_power_of_2(nodesize) || nodesize < sectorsize || 4079 if (!is_power_of_2(nodesize) || nodesize < sectorsize ||