]> nv-tegra.nvidia Code Review - linux-3.10.git/commitdiff
Remove fs.h from mm.h
authorAlexey Dobriyan <adobriyan@gmail.com>
Sun, 29 Jul 2007 22:36:13 +0000 (02:36 +0400)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 30 Jul 2007 00:09:29 +0000 (17:09 -0700)
Remove fs.h from mm.h. For this,
 1) Uninline vma_wants_writenotify(). It's pretty huge anyway.
 2) Add back fs.h or less bloated headers (err.h) to files that need it.

As result, on x86_64 allyesconfig, fs.h dependencies cut down from 3929 files
rebuilt down to 3444 (-12.3%).

Cross-compile tested without regressions on my two usual configs and (sigh):

alpha              arm-mx1ads        mips-bigsur          powerpc-ebony
alpha-allnoconfig  arm-neponset      mips-capcella        powerpc-g5
alpha-defconfig    arm-netwinder     mips-cobalt          powerpc-holly
alpha-up           arm-netx          mips-db1000          powerpc-iseries
arm                arm-ns9xxx        mips-db1100          powerpc-linkstation
arm-assabet        arm-omap_h2_1610  mips-db1200          powerpc-lite5200
arm-at91rm9200dk   arm-onearm        mips-db1500          powerpc-maple
arm-at91rm9200ek   arm-picotux200    mips-db1550          powerpc-mpc7448_hpc2
arm-at91sam9260ek  arm-pleb          mips-ddb5477         powerpc-mpc8272_ads
arm-at91sam9261ek  arm-pnx4008       mips-decstation      powerpc-mpc8313_rdb
arm-at91sam9263ek  arm-pxa255-idp    mips-e55             powerpc-mpc832x_mds
arm-at91sam9rlek   arm-realview      mips-emma2rh         powerpc-mpc832x_rdb
arm-ateb9200       arm-realview-smp  mips-excite          powerpc-mpc834x_itx
arm-badge4         arm-rpc           mips-fulong          powerpc-mpc834x_itxgp
arm-carmeva        arm-s3c2410       mips-ip22            powerpc-mpc834x_mds
arm-cerfcube       arm-shannon       mips-ip27            powerpc-mpc836x_mds
arm-clps7500       arm-shark         mips-ip32            powerpc-mpc8540_ads
arm-collie         arm-simpad        mips-jazz            powerpc-mpc8544_ds
arm-corgi          arm-spitz         mips-jmr3927         powerpc-mpc8560_ads
arm-csb337         arm-trizeps4      mips-malta           powerpc-mpc8568mds
arm-csb637         arm-versatile     mips-mipssim         powerpc-mpc85xx_cds
arm-ebsa110        i386              mips-mpc30x          powerpc-mpc8641_hpcn
arm-edb7211        i386-allnoconfig  mips-msp71xx         powerpc-mpc866_ads
arm-em_x270        i386-defconfig    mips-ocelot          powerpc-mpc885_ads
arm-ep93xx         i386-up           mips-pb1100          powerpc-pasemi
arm-footbridge     ia64              mips-pb1500          powerpc-pmac32
arm-fortunet       ia64-allnoconfig  mips-pb1550          powerpc-ppc64
arm-h3600          ia64-bigsur       mips-pnx8550-jbs     powerpc-prpmc2800
arm-h7201          ia64-defconfig    mips-pnx8550-stb810  powerpc-ps3
arm-h7202          ia64-gensparse    mips-qemu            powerpc-pseries
arm-hackkit        ia64-sim          mips-rbhma4200       powerpc-up
arm-integrator     ia64-sn2          mips-rbhma4500       s390
arm-iop13xx        ia64-tiger        mips-rm200           s390-allnoconfig
arm-iop32x         ia64-up           mips-sb1250-swarm    s390-defconfig
arm-iop33x         ia64-zx1          mips-sead            s390-up
arm-ixp2000        m68k              mips-tb0219          sparc
arm-ixp23xx        m68k-amiga        mips-tb0226          sparc-allnoconfig
arm-ixp4xx         m68k-apollo       mips-tb0287          sparc-defconfig
arm-jornada720     m68k-atari        mips-workpad         sparc-up
arm-kafa           m68k-bvme6000     mips-wrppmc          sparc64
arm-kb9202         m68k-hp300        mips-yosemite        sparc64-allnoconfig
arm-ks8695         m68k-mac          parisc               sparc64-defconfig
arm-lart           m68k-mvme147      parisc-allnoconfig   sparc64-up
arm-lpd270         m68k-mvme16x      parisc-defconfig     um-x86_64
arm-lpd7a400       m68k-q40          parisc-up            x86_64
arm-lpd7a404       m68k-sun3         powerpc              x86_64-allnoconfig
arm-lubbock        m68k-sun3x        powerpc-cell         x86_64-defconfig
arm-lusl7200       mips              powerpc-celleb       x86_64-up
arm-mainstone      mips-atlas        powerpc-chrp32

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
45 files changed:
arch/alpha/kernel/smp.c
arch/arm/kernel/setup.c
arch/arm/kernel/smp.c
arch/frv/kernel/sys_frv.c
arch/i386/kernel/microcode.c
arch/i386/kernel/sys_i386.c
arch/i386/kernel/sysenter.c
arch/ia64/kernel/init_task.c
arch/m68k/kernel/process.c
arch/m68k/kernel/sys_m68k.c
arch/mips/kernel/smp.c
arch/mips/kernel/syscall.c
arch/parisc/hpux/fs.c
arch/parisc/kernel/init_task.c
arch/parisc/kernel/process.c
arch/parisc/kernel/smp.c
arch/powerpc/kernel/syscalls.c
arch/powerpc/lib/rheap.c
arch/powerpc/oprofile/cell/spu_task_sync.c
arch/s390/kernel/init_task.c
arch/s390/kernel/process.c
arch/s390/kernel/smp.c
arch/s390/kernel/sys_s390.c
arch/sparc/kernel/init_task.c
arch/sparc64/kernel/init_task.c
arch/sparc64/kernel/process.c
arch/um/drivers/mmapper_kern.c
arch/um/kernel/exec.c
arch/um/kernel/init_task.c
arch/um/kernel/syscall.c
arch/x86_64/ia32/ptrace32.c
arch/x86_64/kernel/process.c
arch/x86_64/kernel/sys_x86_64.c
arch/x86_64/vdso/vma.c
drivers/char/agp/compat_ioctl.c
drivers/char/agp/frontend.c
drivers/char/mmtimer.c
drivers/char/mspec.c
drivers/infiniband/hw/ipath/ipath_diag.c
fs/dcookies.c
include/linux/hugetlb.h
include/linux/mm.h
mm/mmap.c
mm/oom_kill.c
mm/vmstat.c

index 0804b6abe20337eb02950d01e3320e4411a528c7..ad176441be558bcf41d7dfd109913ef77a36fa7d 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/threads.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
index 5be2e987b8435b047bf168128364e3736eda30f4..4de432ec903aecc4bef4b91aab249c9bd0c62edd 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/cpu.h>
 #include <linux/interrupt.h>
 #include <linux/smp.h>
+#include <linux/fs.h>
 
 #include <asm/cpu.h>
 #include <asm/elf.h>
index 9746e5293249b2ec5289e5640b69e6b212b64c3c..eafbb2b05eb8a2cb7f78a522053f16e4cf70f574 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/profile.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/cpu.h>
 #include <linux/smp.h>
 #include <linux/seq_file.h>
index 26b3df32b9a7476a89dd2ee238f642a4bc2e73fa..6fbe2665c5776d794f2594dbe2a51784585dcae9 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index d865d041bea1dc7c25d9a8e1eaa63f54c6812ea0..09cf78110358fadc78bbc704349b8283737f5f90 100644 (file)
@@ -82,6 +82,7 @@
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/mutex.h>
 #include <linux/cpu.h>
 #include <linux/firmware.h>
index e5dcb9379018b6cda96460f8bd2856cf0365cfaf..42147304de8855e8d0667249ba43f76bcb7efcde 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 6deb159d08e0cf761fe402ed5ab355bcfc9e3d4b..4eb2e408764f7bab8e81a7310616e3366cb1a29c 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/string.h>
 #include <linux/elf.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/module.h>
 
 #include <asm/cpufeature.h>
index b69c397ed1bf1eef6537e5fd336e3086539c9934..bc8efcad28b877c046c589a4a7514129b5aed010 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index 99fc1226f7f804ed40cf875fca1118d78347e8ac..3ee918695215791b10f01ca19e9095b094cf35f5 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/stddef.h>
index 90238a8c9e14996cf48daca92b083390c703e6a4..36d78cf1a7bc14ea5c86550a8a209846829d6f41 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/sem.h>
index be7362bc2c9a6ef7340bf811d1260dd09cd5cef4..04bbbd8d91abd11a913055bcb5b2a513bd957935 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/sched.h>
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
+#include <linux/err.h>
 
 #include <asm/atomic.h>
 #include <asm/cpu.h>
index b53f7edbc159dffbb111c4863dfdabedbe58c95a..541b5005957e86d08dc38223ae8a2c304c6aff70 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/mman.h>
 #include <linux/ptrace.h>
index f2042e6466a4086e8845759bf70639572d9575c6..1263f00dc35d568a63605890b2edcbb544facb5a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/file.h>
 #include <linux/slab.h>
index 8384bf9cecd240c77ae5f2b9f4ec6c2e1ced5eab..446f98d3fd7bd025018bac31b36034b9e0753a96 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index 355664812b8319e1d0c9b01115fd4dbe162f8dc2..b80e02a4d81de3d193ec1faae269b7614a783cf1 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/personality.h>
 #include <linux/ptrace.h>
index 04c7e1d36cea781713e979f5e2e0755a5c961e65..d7bc7bb42c94e11baf1da17597b9bf0017b50608 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/smp.h>
 #include <linux/kernel_stat.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/bitops.h>
 
index fc6647d332cbf18160e4f62865bf06a61cd75d65..f85f402ceaefea89461e4e558efed352e91b272e 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 2f24ea0d723afdb4f4b96916f72bf33d2d91639f..ada5b42dd231635205bccdbc3cedd6c72f80f0cd 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/slab.h>
 
 #include <asm/rheap.h>
index 133665754a75cc34e34b18cfe83d611fc2611fd5..4a890cb42b98e7a7a2b23a7f2599efe1cc1a5f55 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/dcookies.h>
 #include <linux/kref.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/notifier.h>
 #include <linux/numa.h>
index d73a74013e73e0897c984fab7aabc44437fa3d6b..d494161b05b40125668709c893d3407432dbb971 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index 441975b796fb03d901cef8a63dc3414a3a2b508c..abb447a3e472443b6925b1a60f08909a28d067f0 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
index 03674fbe598f3064932e4e14236ad9329076cc07..35edbef1d2228b021b8e677f22a9bcf7a66d0eeb 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/spinlock.h>
 #include <linux/kernel_stat.h>
 #include <linux/delay.h>
index 13e27bdb96e20ee7877a8c545bc627dc3bea6aea..1eaff84a1eb652191611d5c7a47a713995342973 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index fc31de66b1c227f68c945715f6f5e7673f594379..d9d4f96360c7bff691836f3683d7fce954b5311f 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index 329b38fa5c89e81fb995651f257417e4bfd04589..90007cf88bac650517c67951f81aa056ca7ae71f 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index fd7899ba1d70bde8edee7211139081fe7bad88f9..ca7cdfd55f72084c901a1dfcc3c35e507422ddf7 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/kallsyms.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/stddef.h>
 #include <linux/ptrace.h>
index e41a08f04694ab74b531d31f0c9b50fb0249a3f5..867666a023397182c26f3b1f7e011f589acacba1 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h> 
 #include <linux/module.h>
 #include <linux/mm.h> 
+#include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <asm/uaccess.h>
 #include "mem_user.h"
index 356e50f5aaed4c6567e8780adbba06f80494e2a2..ce6828fd396f3d65147064a8a97ef71c261b6a89 100644 (file)
@@ -6,6 +6,7 @@
 #include "linux/slab.h"
 #include "linux/smp_lock.h"
 #include "linux/ptrace.h"
+#include "linux/fs.h"
 #include "asm/ptrace.h"
 #include "asm/pgtable.h"
 #include "asm/tlbflush.h"
index d4f1d1ab252ba0757e47499db066bdb09cbf62bc..cba516e6c99a279683317045c1392b6315b5492c 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include "linux/mm.h"
+#include "linux/fs.h"
 #include "linux/module.h"
 #include "linux/sched.h"
 #include "linux/init_task.h"
index 237c4eab7cfd6c429a6ca8831a6a681671a3ddd6..7b3b67333ff31c2b4c418308b7cec9ff36b9d951 100644 (file)
@@ -7,6 +7,7 @@
 #include "linux/file.h"
 #include "linux/smp_lock.h"
 #include "linux/mm.h"
+#include "linux/fs.h"
 #include "linux/utsname.h"
 #include "linux/msg.h"
 #include "linux/shm.h"
index 4de3a54318f4d6d4f3636144393ee7c88d13fea4..4a233ad6269cce1f2e7408af2137f9e8e92ba39a 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/unistd.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/ptrace.h>
 #include <asm/ptrace.h>
 #include <asm/compat.h>
index e7ac629d4c4654ec97ddc387fc5ba71c0892e92a..2842f50cbe3fde220dfc33a61b720720aa7a7e7f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/elfcore.h>
 #include <linux/smp.h>
 #include <linux/slab.h>
index d067d9a2ad27bd27cf2fdc108bd64de77c26a8a6..4770b7a2052cf22774d09d06efd7dadf74d34df8 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index d4cb83a6c0662fd3e48969c69031343384926be4..ff9333e5fb083af76a77a5707b1a0661ae76e1ff 100644 (file)
@@ -4,6 +4,7 @@
  * Subject to the GPL, v.2
  */
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/random.h>
index fcb4b1bf0d4e664187c3fbf2633e1f5b5ecb6b96..ecd4248861b9dfda6475e29d0acfcc9c6c547f96 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <linux/kernel.h>
 #include <linux/pci.h>
+#include <linux/fs.h>
 #include <linux/agpgart.h>
 #include <asm/uaccess.h>
 #include "agp.h"
index c7ed617aa7ff436ea8c359f66bdafa097b4641de..7791e98de51c81a34ed3b4aed1b007cb4b728e46 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/agpgart.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/sched.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
index 6e55cfb9c65a3f03a12d0431040532cebdeb2e7c..e60a74c66e3dfa05c00eb45596829e77932ce5c1 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/mmtimer.h>
 #include <linux/miscdevice.h>
 #include <linux/posix-timers.h>
index c716ef0dd370af5043590d12d314e8981daac754..c08a4152ee8fc2f5df6032221d519beafb4837f0 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/vmalloc.h>
 #include <linux/string.h>
 #include <linux/slab.h>
index a698f1949d1040da508c1c727acca8bf6bb24dbb..cf25cdab02f9dd3efa5af610d200cf6211b9b85a 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/io.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
+#include <linux/fs.h>
 #include <asm/uaccess.h>
 
 #include "ipath_kernel.h"
index c1208f53bd74596c74423f085886c859bf51cf3e..792cbf55fa9592cefbd6b2446ed26d573301beee 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/capability.h>
 #include <linux/dcache.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/dcookies.h>
 #include <linux/mutex.h>
index 49b7053043adde30bcfc8475403fe39ba93ce5f6..e6a71c82d204699b6a18226e261a7beda4463ed7 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_HUGETLB_H
 #define _LINUX_HUGETLB_H
 
+#include <linux/fs.h>
+
 #ifdef CONFIG_HUGETLB_PAGE
 
 #include <linux/mempolicy.h>
index 3e9e8fec5a419bbb948c837415437f5310cd399e..655094dc9440fd5e8fdce2ab4f0380b83d72dd0e 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/mmzone.h>
 #include <linux/rbtree.h>
 #include <linux/prio_tree.h>
-#include <linux/fs.h>
 #include <linux/mutex.h>
 #include <linux/debug_locks.h>
 #include <linux/backing-dev.h>
@@ -18,7 +17,9 @@
 
 struct mempolicy;
 struct anon_vma;
+struct file_ra_state;
 struct user_struct;
+struct writeback_control;
 
 #ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
 extern unsigned long max_mapnr;
@@ -861,38 +862,7 @@ struct shrinker {
 extern void register_shrinker(struct shrinker *);
 extern void unregister_shrinker(struct shrinker *);
 
-/*
- * Some shared mappigns will want the pages marked read-only
- * to track write events. If so, we'll downgrade vm_page_prot
- * to the private version (using protection_map[] without the
- * VM_SHARED bit).
- */
-static inline int vma_wants_writenotify(struct vm_area_struct *vma)
-{
-       unsigned int vm_flags = vma->vm_flags;
-
-       /* If it was private or non-writable, the write bit is already clear */
-       if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
-               return 0;
-
-       /* The backer wishes to know when pages are first written to? */
-       if (vma->vm_ops && vma->vm_ops->page_mkwrite)
-               return 1;
-
-       /* The open routine did something to the protections already? */
-       if (pgprot_val(vma->vm_page_prot) !=
-           pgprot_val(protection_map[vm_flags &
-                   (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
-               return 0;
-
-       /* Specialty mapping? */
-       if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
-               return 0;
-
-       /* Can the mapping track the dirty pages? */
-       return vma->vm_file && vma->vm_file->f_mapping &&
-               mapping_cap_account_dirty(vma->vm_file->f_mapping);
-}
+int vma_wants_writenotify(struct vm_area_struct *vma);
 
 extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
 
index 7afc7a7cec6f681001817ad6656d3a20d9ed53a7..b6537211b9ccfdfcf1f7d9d63c5891ba89e483e7 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1029,6 +1029,40 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
 }
 EXPORT_SYMBOL(do_mmap_pgoff);
 
+/*
+ * Some shared mappigns will want the pages marked read-only
+ * to track write events. If so, we'll downgrade vm_page_prot
+ * to the private version (using protection_map[] without the
+ * VM_SHARED bit).
+ */
+int vma_wants_writenotify(struct vm_area_struct *vma)
+{
+       unsigned int vm_flags = vma->vm_flags;
+
+       /* If it was private or non-writable, the write bit is already clear */
+       if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
+               return 0;
+
+       /* The backer wishes to know when pages are first written to? */
+       if (vma->vm_ops && vma->vm_ops->page_mkwrite)
+               return 1;
+
+       /* The open routine did something to the protections already? */
+       if (pgprot_val(vma->vm_page_prot) !=
+           pgprot_val(protection_map[vm_flags &
+                   (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
+               return 0;
+
+       /* Specialty mapping? */
+       if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
+               return 0;
+
+       /* Can the mapping track the dirty pages? */
+       return vma->vm_file && vma->vm_file->f_mapping &&
+               mapping_cap_account_dirty(vma->vm_file->f_mapping);
+}
+
+
 unsigned long mmap_region(struct file *file, unsigned long addr,
                          unsigned long len, unsigned long flags,
                          unsigned int vm_flags, unsigned long pgoff,
index a7001410ab15964449f2b7188be3ecf05a9876eb..10367654ae774fba2072698e1fac470174d8698e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/oom.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/sched.h>
 #include <linux/swap.h>
 #include <linux/timex.h>
index fadf791cd7e6828e3a778f7e636786a4dd6c2cbd..c64d169537bfcfe65fc963b009779de85c9b051a 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/cpu.h>
 #include <linux/sched.h>