1
0
Fork 0
alistair23-linux/drivers/staging
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
..
android Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2016-03-25 08:48:31 -07:00
board Staging: board: Blank lines aren't necessary before a close brace 2016-02-07 19:57:22 -08:00
clocking-wizard Staging: clocking-wizard: CHECK:Please use a blank line 2016-02-07 20:05:31 -08:00
comedi staging: comedi: ni_mio_common: fix the ni_write[blw]() functions 2016-03-22 22:22:13 -04:00
dgnc Staging driver patches for 4.6-rc1 2016-03-17 22:13:41 -07:00
emxx_udc Staging: emxx_udc: Return NULL instead of 0. 2016-03-11 22:09:09 -08:00
fbtft staging: fbtft: fb_uc1611.c: Drop void pointer cast 2016-03-11 22:09:09 -08:00
fsl-mc staging: fsl-mc: fix incorrect type passed to dev_err macros 2016-03-22 22:22:13 -04:00
fwserial staging: fwserial: (coding-style) rewrite comparisons to NULL as "!fifo->data" 2016-02-07 19:36:14 -08:00
gdm724x Staging: gdm724x: Replace random_ether_addr with eth_random_addr 2016-03-05 14:48:04 -08:00
goldfish staging: goldfish: audio: fix compiliation on arm 2016-03-11 22:09:09 -08:00
gs_fpgaboot staging: gs_fpgaboot: drop wrapper function 'finish_driver' 2016-03-11 22:09:09 -08:00
i4l isdn: i4l: move active-isdn drivers to staging 2016-03-05 15:00:38 -08:00
iio staging: iio: addac: Remove unnecessary else after return 2016-03-11 22:09:09 -08:00
lustre mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
media Staging driver patches for 4.6-rc1 2016-03-17 22:13:41 -07:00
most staging: most: hdm-dim2: Remove possible dereference error 2016-03-22 22:22:13 -04:00
mt29f_spinand MTD updates for v4.6 2016-03-24 19:57:15 -07:00
netlogic staging: netlogic: Replacing pr_err with dev_err after the call to devm_kzalloc 2016-03-11 22:14:06 -08:00
nvec Staging: nvec: removes an unnecessary cast on a void pointer 2016-03-11 22:09:09 -08:00
octeon staging: octeon: Fix braces in condition statement 2016-03-11 22:09:09 -08:00
octeon-usb staging: octeon-usb: update TODO 2016-02-25 22:38:16 -08:00
rdma Round two of 4.6 merge window patches 2016-03-22 15:48:44 -07:00
rtl8188eu Staging: rtl8188eu: Remove function rtw_freq2ch 2016-03-11 22:09:09 -08:00
rtl8192e Staging driver patches for 4.6-rc1 2016-03-17 22:13:41 -07:00
rtl8192u Staging driver patches for 4.6-rc1 2016-03-17 22:13:41 -07:00
rtl8712 staging: refresh TODO for rtl8712 2016-03-22 22:22:13 -04:00
rtl8723au staging: refresh TODO for rtl8723au 2016-03-22 22:22:13 -04:00
rts5208 staging: rts5208: Replace pci_enable_device with pcim_enable_device 2016-03-11 22:09:09 -08:00
skein staging: skein: threefish_block: Use rol64 2016-03-11 22:09:09 -08:00
slicoss Staging: slicoss: changes comparisons to NULL in slicoss.c 2016-03-11 22:09:09 -08:00
sm750fb Staging: sm750fb: Remove unused functions 2016-03-11 22:09:09 -08:00
speakup staging: speakup: Replace del_timer with del_timer_sync 2016-03-11 22:09:09 -08:00
unisys staging: unisys: visornic: Remove unnecessary else after return 2016-03-10 19:29:45 -08:00
vme staging: vme: devices: Replace kzalloc with devm_kzalloc 2016-03-11 22:09:09 -08:00
vt6655 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-03-19 10:05:34 -07:00
vt6656 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-03-19 10:05:34 -07:00
wilc1000 staging: wilc1000: fix a couple of memory leaks 2016-03-22 22:27:36 -04:00
wlan-ng Staging: wlan-ng: Do not print message if kzalloc() failed. 2016-03-11 22:09:09 -08:00
xgifb Staging: xgifb: remove useless blank lines 2016-03-11 22:09:09 -08:00
Kconfig staging: delete STE RMI4 hackish driver 2016-03-22 22:29:38 -04:00
Makefile staging: delete STE RMI4 hackish driver 2016-03-22 22:29:38 -04:00