linux-hardened/fs/xfs/libxfs
Kirill A. Shutemov 09cbfeaf1a 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>
2016-04-04 10:41:08 -07:00
..
xfs_alloc.c libxfs: make xfs_alloc_fix_freelist non-static 2016-01-04 16:10:42 +11:00
xfs_alloc.h libxfs: make xfs_alloc_fix_freelist non-static 2016-01-04 16:10:42 +11:00
xfs_alloc_btree.c xfs: move buffer invalidation to xfs_btree_free_block 2016-02-08 14:58:07 +11:00
xfs_alloc_btree.h
xfs_attr.c xfs: eliminate committed arg from xfs_bmap_finish 2016-01-11 11:34:01 +11:00
xfs_attr_leaf.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_attr_leaf.h xfs: xfs_attr_inactive leaves inconsistent attr fork state behind 2015-05-29 07:40:08 +10:00
xfs_attr_remote.c xfs: eliminate committed arg from xfs_bmap_finish 2016-01-11 11:34:01 +11:00
xfs_attr_remote.h
xfs_attr_sf.h xfs: move struct xfs_attr_shortform to xfs_da_format.h 2016-02-08 15:00:01 +11:00
xfs_bit.c libxfs: Optimize the loop for xfs_bitmap_empty 2016-01-04 16:10:19 +11:00
xfs_bit.h
xfs_bmap.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
xfs_bmap.h xfs: eliminate committed arg from xfs_bmap_finish 2016-01-11 11:34:01 +11:00
xfs_bmap_btree.c Merge branch 'xfs-misc-fixes-4.6-2' into for-next 2016-03-07 09:34:54 +11:00
xfs_bmap_btree.h
xfs_btree.c xfs: move buffer invalidation to xfs_btree_free_block 2016-02-08 14:58:07 +11:00
xfs_btree.h libxfs: refactor short btree block verification 2016-01-04 16:13:21 +11:00
xfs_cksum.h
xfs_da_btree.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_da_btree.h
xfs_da_format.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_da_format.h xfs: move struct xfs_attr_shortform to xfs_da_format.h 2016-02-08 15:00:01 +11:00
xfs_dir2.c xfs: mode di_mode to vfs inode 2016-02-09 16:54:58 +11:00
xfs_dir2.h xfs: move type conversion functions to xfs_dir.h 2014-12-04 09:43:17 +11:00
xfs_dir2_block.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_dir2_data.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_dir2_leaf.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_dir2_node.c xfs: always set rvalp in xfs_dir2_node_trim_free 2016-03-15 11:44:18 +11:00
xfs_dir2_priv.h xfs: move type conversion functions to xfs_dir.h 2014-12-04 09:43:17 +11:00
xfs_dir2_sf.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dquot_buf.c xfs: handle dquot buffer readahead in log recovery correctly 2016-01-12 07:04:01 +11:00
xfs_format.h Merge branch 'xfs-setxattr-promotion' into for-next 2016-01-19 08:16:08 +11:00
xfs_fs.h xfs: use FS_XFLAG definitions directly 2016-01-04 16:44:15 +11:00
xfs_ialloc.c xfs: fix computation of inode btree maxlevels 2016-03-07 08:39:56 +11:00
xfs_ialloc.h Merge branch 'xfs-misc-fixes-for-4.2-3' into for-next 2015-06-23 08:49:01 +10:00
xfs_ialloc_btree.c xfs: move buffer invalidation to xfs_btree_free_block 2016-02-08 14:58:07 +11:00
xfs_ialloc_btree.h xfs: allocate sparse inode chunks on full chunk allocation failure 2015-05-29 09:18:32 +10:00
xfs_inode_buf.c xfs: mode di_mode to vfs inode 2016-02-09 16:54:58 +11:00
xfs_inode_buf.h xfs: mode di_mode to vfs inode 2016-02-09 16:54:58 +11:00
xfs_inode_fork.c Merge branch 'xfs-gut-icdinode-4.6' into for-next 2016-03-07 09:30:32 +11:00
xfs_inode_fork.h
xfs_log_format.h Merge branch 'xfs-gut-icdinode-4.6' into for-next 2016-03-07 09:30:32 +11:00
xfs_log_recover.h xfs: support a crc verification only log record pass 2016-01-04 15:55:10 +11:00
xfs_log_rlimit.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_quota_defs.h xfs: wire up Q_XGETNEXTQUOTA / get_nextdqblk 2016-02-08 11:27:38 +11:00
xfs_rtbitmap.c Merge branch 'xfs-gut-icdinode-4.6' into for-next 2016-03-07 09:30:32 +11:00
xfs_sb.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_sb.h xfs: remove unused function definitions 2016-02-08 14:58:07 +11:00
xfs_shared.h xfs: RT bitmap and summary buffers need verifiers 2016-02-09 16:41:45 +11:00
xfs_symlink_remote.c xfs: print name of verifier if it fails 2016-01-04 16:10:19 +11:00
xfs_trans_resv.c xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_trans_resv.h xfs: clean up XFS_MIN_FREELIST macros 2015-06-22 10:13:30 +10:00
xfs_trans_space.h xfs: clean up XFS_MIN_FREELIST macros 2015-06-22 10:13:30 +10:00
xfs_types.h xfs: move xfs_types.h to libxfs 2015-01-09 10:46:31 +11:00