]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fri, 1 Apr 2016 12:29:47 +0000 (15:29 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 4 Apr 2016 17:41:08 +0000 (10:41 -0700)
commit09cbfeaf1a5a67bfb3201e0c83c810cecb2efa5a
tree6cdf210c9c0f981cd22544feeba701892ec19464
parentc05c2ec96bb8b7310da1055c7b9d786a3ec6dc0c
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>
381 files changed:
arch/arc/mm/cache.c
arch/arm/mm/flush.c
arch/parisc/kernel/cache.c
arch/powerpc/platforms/cell/spufs/inode.c
arch/s390/hypfs/inode.c
block/bio.c
block/blk-core.c
block/blk-settings.c
block/blk-sysfs.c
block/cfq-iosched.c
block/compat_ioctl.c
block/ioctl.c
block/partition-generic.c
drivers/block/aoe/aoeblk.c
drivers/block/brd.c
drivers/block/drbd/drbd_nl.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/armada/armada_gem.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_userptr.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_tt.c
drivers/gpu/drm/via/via_dmablit.c
drivers/md/bitmap.c
drivers/media/v4l2-core/videobuf-dma-sg.c
drivers/misc/ibmasm/ibmasmfs.c
drivers/misc/vmw_vmci/vmci_queue_pair.c
drivers/mmc/core/host.c
drivers/mmc/host/sh_mmcif.c
drivers/mmc/host/tmio_mmc_dma.c
drivers/mmc/host/tmio_mmc_pio.c
drivers/mmc/host/usdhi6rol0.c
drivers/mtd/devices/block2mtd.c
drivers/mtd/nand/nandsim.c
drivers/nvdimm/btt.c
drivers/nvdimm/pmem.c
drivers/oprofile/oprofilefs.c
drivers/scsi/sd.c
drivers/scsi/st.c
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
drivers/staging/lustre/lnet/libcfs/debug.c
drivers/staging/lustre/lnet/libcfs/tracefile.c
drivers/staging/lustre/lnet/libcfs/tracefile.h
drivers/staging/lustre/lnet/lnet/lib-md.c
drivers/staging/lustre/lnet/lnet/lib-move.c
drivers/staging/lustre/lnet/lnet/lib-socket.c
drivers/staging/lustre/lnet/lnet/router.c
drivers/staging/lustre/lnet/selftest/brw_test.c
drivers/staging/lustre/lnet/selftest/conctl.c
drivers/staging/lustre/lnet/selftest/conrpc.c
drivers/staging/lustre/lnet/selftest/framework.c
drivers/staging/lustre/lnet/selftest/rpc.c
drivers/staging/lustre/lnet/selftest/selftest.h
drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
drivers/staging/lustre/lustre/include/lustre_mdc.h
drivers/staging/lustre/lustre/include/lustre_net.h
drivers/staging/lustre/lustre/include/obd.h
drivers/staging/lustre/lustre/include/obd_support.h
drivers/staging/lustre/lustre/lclient/lcommon_cl.c
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
drivers/staging/lustre/lustre/ldlm/ldlm_request.c
drivers/staging/lustre/lustre/llite/dir.c
drivers/staging/lustre/lustre/llite/llite_internal.h
drivers/staging/lustre/lustre/llite/llite_lib.c
drivers/staging/lustre/lustre/llite/llite_mmap.c
drivers/staging/lustre/lustre/llite/lloop.c
drivers/staging/lustre/lustre/llite/lproc_llite.c
drivers/staging/lustre/lustre/llite/rw.c
drivers/staging/lustre/lustre/llite/rw26.c
drivers/staging/lustre/lustre/llite/vvp_io.c
drivers/staging/lustre/lustre/llite/vvp_page.c
drivers/staging/lustre/lustre/lmv/lmv_obd.c
drivers/staging/lustre/lustre/mdc/mdc_request.c
drivers/staging/lustre/lustre/mgc/mgc_request.c
drivers/staging/lustre/lustre/obdclass/cl_page.c
drivers/staging/lustre/lustre/obdclass/class_obd.c
drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
drivers/staging/lustre/lustre/obdclass/lu_object.c
drivers/staging/lustre/lustre/obdecho/echo_client.c
drivers/staging/lustre/lustre/osc/lproc_osc.c
drivers/staging/lustre/lustre/osc/osc_cache.c
drivers/staging/lustre/lustre/osc/osc_page.c
drivers/staging/lustre/lustre/osc/osc_request.c
drivers/staging/lustre/lustre/ptlrpc/client.c
drivers/staging/lustre/lustre/ptlrpc/import.c
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
drivers/staging/lustre/lustre/ptlrpc/recover.c
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/legacy/inode.c
drivers/usb/storage/scsiglue.c
drivers/video/fbdev/pvr2fb.c
fs/9p/vfs_addr.c
fs/9p/vfs_file.c
fs/9p/vfs_super.c
fs/affs/file.c
fs/afs/dir.c
fs/afs/file.c
fs/afs/mntpt.c
fs/afs/super.c
fs/afs/write.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/block_dev.c
fs/btrfs/check-integrity.c
fs/btrfs/compression.c
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/file-item.c
fs/btrfs/file.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode-map.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/lzo.c
fs/btrfs/raid56.c
fs/btrfs/reada.c
fs/btrfs/relocation.c
fs/btrfs/scrub.c
fs/btrfs/send.c
fs/btrfs/tests/extent-io-tests.c
fs/btrfs/tests/free-space-tests.c
fs/btrfs/volumes.c
fs/btrfs/zlib.c
fs/buffer.c
fs/cachefiles/rdwr.c
fs/ceph/addr.c
fs/ceph/caps.c
fs/ceph/dir.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/super.c
fs/cifs/cifsfs.c
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/file.c
fs/cifs/inode.c
fs/configfs/mount.c
fs/cramfs/inode.c
fs/crypto/crypto.c
fs/dax.c
fs/direct-io.c
fs/dlm/lowcomms.c
fs/ecryptfs/crypto.c
fs/ecryptfs/inode.c
fs/ecryptfs/keystore.c
fs/ecryptfs/main.c
fs/ecryptfs/mmap.c
fs/ecryptfs/read_write.c
fs/efivarfs/super.c
fs/exofs/dir.c
fs/exofs/inode.c
fs/exofs/namei.c
fs/ext2/dir.c
fs/ext2/namei.c
fs/ext4/crypto.c
fs/ext4/dir.c
fs/ext4/file.c
fs/ext4/inline.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/move_extent.c
fs/ext4/page-io.c
fs/ext4/readpage.c
fs/ext4/super.c
fs/ext4/symlink.c
fs/f2fs/data.c
fs/f2fs/debug.c
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/inline.c
fs/f2fs/namei.c
fs/f2fs/node.c
fs/f2fs/recovery.c
fs/f2fs/segment.c
fs/f2fs/super.c
fs/freevxfs/vxfs_immed.c
fs/freevxfs/vxfs_lookup.c
fs/freevxfs/vxfs_subr.c
fs/fs-writeback.c
fs/fscache/page.c
fs/fuse/dev.c
fs/fuse/file.c
fs/fuse/inode.c
fs/gfs2/aops.c
fs/gfs2/bmap.c
fs/gfs2/file.c
fs/gfs2/meta_io.c
fs/gfs2/quota.c
fs/gfs2/rgrp.c
fs/hfs/bnode.c
fs/hfs/btree.c
fs/hfs/inode.c
fs/hfsplus/bitmap.c
fs/hfsplus/bnode.c
fs/hfsplus/btree.c
fs/hfsplus/inode.c
fs/hfsplus/super.c
fs/hfsplus/xattr.c
fs/hostfs/hostfs_kern.c
fs/hugetlbfs/inode.c
fs/isofs/compress.c
fs/isofs/inode.c
fs/jbd2/commit.c
fs/jbd2/journal.c
fs/jbd2/transaction.c
fs/jffs2/debug.c
fs/jffs2/file.c
fs/jffs2/fs.c
fs/jffs2/gc.c
fs/jffs2/nodelist.c
fs/jffs2/write.c
fs/jfs/jfs_metapage.c
fs/jfs/jfs_metapage.h
fs/jfs/super.c
fs/kernfs/mount.c
fs/libfs.c
fs/logfs/dev_bdev.c
fs/logfs/dev_mtd.c
fs/logfs/dir.c
fs/logfs/file.c
fs/logfs/readwrite.c
fs/logfs/segment.c
fs/logfs/super.c
fs/minix/dir.c
fs/minix/namei.c
fs/mpage.c
fs/ncpfs/dir.c
fs/ncpfs/ncplib_kernel.h
fs/nfs/blocklayout/blocklayout.c
fs/nfs/blocklayout/blocklayout.h
fs/nfs/client.c
fs/nfs/dir.c
fs/nfs/direct.c
fs/nfs/file.c
fs/nfs/internal.h
fs/nfs/nfs4xdr.c
fs/nfs/objlayout/objio_osd.c
fs/nfs/pagelist.c
fs/nfs/pnfs.c
fs/nfs/read.c
fs/nfs/write.c
fs/nilfs2/bmap.c
fs/nilfs2/btnode.c
fs/nilfs2/dir.c
fs/nilfs2/gcinode.c
fs/nilfs2/inode.c
fs/nilfs2/mdt.c
fs/nilfs2/namei.c
fs/nilfs2/page.c
fs/nilfs2/recovery.c
fs/nilfs2/segment.c
fs/ntfs/aops.c
fs/ntfs/aops.h
fs/ntfs/attrib.c
fs/ntfs/bitmap.c
fs/ntfs/compress.c
fs/ntfs/dir.c
fs/ntfs/file.c
fs/ntfs/index.c
fs/ntfs/inode.c
fs/ntfs/lcnalloc.c
fs/ntfs/logfile.c
fs/ntfs/mft.c
fs/ntfs/ntfs.h
fs/ntfs/super.c
fs/ocfs2/alloc.c
fs/ocfs2/aops.c
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/file.c
fs/ocfs2/mmap.c
fs/ocfs2/ocfs2.h
fs/ocfs2/refcounttree.c
fs/ocfs2/super.c
fs/orangefs/inode.c
fs/orangefs/orangefs-bufmap.c
fs/orangefs/orangefs-utils.c
fs/pipe.c
fs/proc/task_mmu.c
fs/proc/vmcore.c
fs/pstore/inode.c
fs/qnx6/dir.c
fs/qnx6/inode.c
fs/qnx6/qnx6.h
fs/ramfs/inode.c
fs/reiserfs/file.c
fs/reiserfs/inode.c
fs/reiserfs/ioctl.c
fs/reiserfs/journal.c
fs/reiserfs/stree.c
fs/reiserfs/tail_conversion.c
fs/reiserfs/xattr.c
fs/splice.c
fs/squashfs/block.c
fs/squashfs/cache.c
fs/squashfs/decompressor.c
fs/squashfs/file.c
fs/squashfs/file_direct.c
fs/squashfs/lz4_wrapper.c
fs/squashfs/lzo_wrapper.c
fs/squashfs/page_actor.c
fs/squashfs/page_actor.h
fs/squashfs/super.c
fs/squashfs/symlink.c
fs/squashfs/xz_wrapper.c
fs/squashfs/zlib_wrapper.c
fs/sync.c
fs/sysv/dir.c
fs/sysv/namei.c
fs/ubifs/file.c
fs/ubifs/super.c
fs/ubifs/ubifs.h
fs/udf/file.c
fs/udf/inode.c
fs/ufs/balloc.c
fs/ufs/dir.c
fs/ufs/inode.c
fs/ufs/namei.c
fs/ufs/util.c
fs/ufs/util.h
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/xfs_aops.c
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_file.c
fs/xfs/xfs_linux.h
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_pnfs.c
fs/xfs/xfs_super.c
include/linux/bio.h
include/linux/blkdev.h
include/linux/buffer_head.h
include/linux/ceph/libceph.h
include/linux/f2fs_fs.h
include/linux/fs.h
include/linux/nfs_page.h
include/linux/pagemap.h
include/linux/swap.h
ipc/mqueue.c
kernel/events/uprobes.c
mm/fadvise.c
mm/filemap.c
mm/hugetlb.c
mm/madvise.c
mm/memory-failure.c
mm/memory.c
mm/mincore.c
mm/nommu.c
mm/page-writeback.c
mm/page_io.c
mm/readahead.c
mm/rmap.c
mm/shmem.c
mm/swap.c
mm/swap_state.c
mm/swapfile.c
mm/truncate.c
mm/userfaultfd.c
mm/zswap.c
net/ceph/messenger.c
net/ceph/pagelist.c
net/ceph/pagevec.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/auth_gss/gss_krb5_wrap.c
net/sunrpc/cache.c
net/sunrpc/rpc_pipe.c
net/sunrpc/socklib.c
net/sunrpc/xdr.c