From 1f58336fe0515bc929e4de227eb44b12a4a18998 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:25:56 -0500 Subject: [PATCH] Import 2.3.9 --- arch/arm/kernel/dec21285.c | 1 + arch/arm/kernel/entry-common.S | 1 + arch/mips/arc/console.c | 1 + arch/mips/arc/memory.c | 1 - arch/mips/arc/printf.c | 1 + arch/mips/baget/balo_supp.S | 1 - arch/mips/baget/prom/init.c | 1 - arch/mips/baget/setup.c | 1 - arch/mips/dec/prom/cmdline.c | 1 - arch/mips/dec/prom/identify.c | 1 - arch/mips/dec/prom/init.c | 1 - arch/mips/dec/prom/memory.c | 1 - arch/mips/dec/serial.c | 1 + arch/mips/kernel/r2300_misc.S | 2 -- arch/mips/kernel/time.c | 1 + arch/mips/sgi/kernel/indy_int.c | 2 -- drivers/block/icside.c | 1 + drivers/char/dz.c | 1 + drivers/char/vino.c | 1 - drivers/i2o/i2o_config.c | 1 - drivers/i2o/i2o_core.c | 1 - drivers/i2o/i2o_lan.c | 1 + drivers/i2o/i2o_pci.c | 1 - drivers/i2o/i2o_proc.c | 1 - drivers/net/cycx_drv.c | 1 - drivers/net/irda/irtty.c | 1 - drivers/sbus/char/aurora.c | 1 - drivers/scsi/aic7xxx_proc.c | 2 ++ drivers/sgi/char/graphics_syms.c | 1 - drivers/sgi/char/newport.c | 1 - drivers/sound/cmpci.c | 1 + drivers/sound/sb_ess.c | 1 + drivers/tc/tcsyms.c | 1 - drivers/usb/acm.c | 1 - drivers/usb/audio.c | 1 - drivers/usb/cpia.c | 1 - drivers/usb/hub.c | 1 - drivers/usb/mouse.c | 1 - drivers/usb/usb.c | 1 - drivers/usb/usb_scsi.c | 1 + drivers/usb/usb_scsi.h | 2 ++ fs/buffer.c | 15 +++++++------ fs/lockd/host.c | 1 + fs/nfs/dir.c | 6 ++++-- fs/smbfs/inode.c | 2 -- include/asm-arm/arch-ebsa285/irq.h | 1 + include/asm-arm/arch-ebsa285/memory.h | 2 ++ include/asm-mips/io.h | 2 -- include/asm-mips/keyboard.h | 1 - include/asm-ppc/mmu.h | 2 ++ include/asm-ppc/ptrace.h | 2 ++ include/linux/cyclomx.h | 1 + include/linux/pagemap.h | 7 ++++-- include/net/dn_fib.h | 2 ++ include/net/dn_raw.h | 2 ++ init/main.c | 1 + ipc/msg.c | 1 + ipc/sem.c | 1 + ipc/shm.c | 1 + kernel/ksyms.c | 2 ++ mm/filemap.c | 31 ++++++++++++++++++++++++++- mm/swapfile.c | 1 - net/decnet/dn_nsp_out.c | 1 - net/decnet/dn_timer.c | 1 - net/socket.c | 9 -------- net/sunrpc/xprt.c | 1 - 66 files changed, 83 insertions(+), 58 deletions(-) diff --git a/arch/arm/kernel/dec21285.c b/arch/arm/kernel/dec21285.c index c4103abee3b1..80cef0b23ec8 100644 --- a/arch/arm/kernel/dec21285.c +++ b/arch/arm/kernel/dec21285.c @@ -3,6 +3,7 @@ * * Copyright (C) 1998 Russell King, Phil Blundell */ +#include #include #include #include diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 2fc0fdddc3e6..7dbc7ff95bb3 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -1,3 +1,4 @@ +#include /*============================================================================ * All exits to user mode from the kernel go through this code. */ diff --git a/arch/mips/arc/console.c b/arch/mips/arc/console.c index 53635bfc567b..47f2bd07d0ad 100644 --- a/arch/mips/arc/console.c +++ b/arch/mips/arc/console.c @@ -6,6 +6,7 @@ * * $Id: console.c,v 1.2 1999/06/12 18:42:38 ulfc Exp $ */ +#include #include #include #include diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c index d235a627b95b..66244bcc4706 100644 --- a/arch/mips/arc/memory.c +++ b/arch/mips/arc/memory.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff --git a/arch/mips/arc/printf.c b/arch/mips/arc/printf.c index ec1191133f2a..bc4f84e6b40d 100644 --- a/arch/mips/arc/printf.c +++ b/arch/mips/arc/printf.c @@ -6,6 +6,7 @@ * * $Id: printf.c,v 1.2 1999/06/12 18:42:38 ulfc Exp $ */ +#include #include #include diff --git a/arch/mips/baget/balo_supp.S b/arch/mips/baget/balo_supp.S index 6b79d22d3f49..1c57539a550c 100644 --- a/arch/mips/baget/balo_supp.S +++ b/arch/mips/baget/balo_supp.S @@ -4,7 +4,6 @@ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov */ -#include #include #include #include diff --git a/arch/mips/baget/prom/init.c b/arch/mips/baget/prom/init.c index e5c100dea1f0..a59032812670 100644 --- a/arch/mips/baget/prom/init.c +++ b/arch/mips/baget/prom/init.c @@ -6,7 +6,6 @@ * $Id$ */ #include -#include #include char arcs_cmdline[CL_SIZE]; diff --git a/arch/mips/baget/setup.c b/arch/mips/baget/setup.c index de5c5763d183..7ebc1f51035c 100644 --- a/arch/mips/baget/setup.c +++ b/arch/mips/baget/setup.c @@ -5,7 +5,6 @@ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov * */ -#include #include #include #include diff --git a/arch/mips/dec/prom/cmdline.c b/arch/mips/dec/prom/cmdline.c index 31d6ec318ede..c5f8e06e9c49 100644 --- a/arch/mips/dec/prom/cmdline.c +++ b/arch/mips/dec/prom/cmdline.c @@ -7,7 +7,6 @@ */ #include #include -#include #include #include diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c index 65d7b5abfa17..b8c6a1e1e9af 100644 --- a/arch/mips/dec/prom/identify.c +++ b/arch/mips/dec/prom/identify.c @@ -6,7 +6,6 @@ * $Id: $ */ #include -#include #include #include diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c index 2cb9da66c58d..193bbbc6c014 100644 --- a/arch/mips/dec/prom/init.c +++ b/arch/mips/dec/prom/init.c @@ -6,7 +6,6 @@ * $Id: $ */ #include -#include #include "prom.h" /* diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c index de80c34e8c72..dbf2c6246cf9 100644 --- a/arch/mips/dec/prom/memory.c +++ b/arch/mips/dec/prom/memory.c @@ -7,7 +7,6 @@ */ #include #include -#include #include #include "prom.h" diff --git a/arch/mips/dec/serial.c b/arch/mips/dec/serial.c index fcf324199a30..ad348c6d1f44 100644 --- a/arch/mips/dec/serial.c +++ b/arch/mips/dec/serial.c @@ -16,6 +16,7 @@ * console device I strongly recommend to use only one. */ +#include #include #include diff --git a/arch/mips/kernel/r2300_misc.S b/arch/mips/kernel/r2300_misc.S index c8a742135626..de55efb4ed26 100644 --- a/arch/mips/kernel/r2300_misc.S +++ b/arch/mips/kernel/r2300_misc.S @@ -10,8 +10,6 @@ * Copyright (c) 1998 Harald Koerfgen * Copyright (c) 1998 Gleb Raiko & Vladimir Roganov */ -#include - #include #include #include diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 601b8ab5fbc9..6f3e94049ad5 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c @@ -6,6 +6,7 @@ * This file contains the time handling details for PC-style clocks as * found in some MIPS systems. */ +#include #include #include #include diff --git a/arch/mips/sgi/kernel/indy_int.c b/arch/mips/sgi/kernel/indy_int.c index 06f896563add..0c34351c61c8 100644 --- a/arch/mips/sgi/kernel/indy_int.c +++ b/arch/mips/sgi/kernel/indy_int.c @@ -9,9 +9,7 @@ * - Indigo2 changes * - Interrupt handling fixes */ -#include #include - #include #include #include diff --git a/drivers/block/icside.c b/drivers/block/icside.c index 299bce7a69dd..0d29761eec33 100644 --- a/drivers/block/icside.c +++ b/drivers/block/icside.c @@ -10,6 +10,7 @@ * 22-May-1999 RMK Added support for V6 DMA */ +#include #include #include #include diff --git a/drivers/char/dz.c b/drivers/char/dz.c index c26a448e8520..3bfb89ff952c 100644 --- a/drivers/char/dz.c +++ b/drivers/char/dz.c @@ -24,6 +24,7 @@ #define MOD_DEC_USE_COUNT #endif +#include #include #include #include diff --git a/drivers/char/vino.c b/drivers/char/vino.c index 79627c29314b..1da4b894ed46 100644 --- a/drivers/char/vino.c +++ b/drivers/char/vino.c @@ -9,7 +9,6 @@ * some more code. */ -#include #include #include #include diff --git a/drivers/i2o/i2o_config.c b/drivers/i2o/i2o_config.c index c3c644883343..8fd93bff96ea 100644 --- a/drivers/i2o/i2o_config.c +++ b/drivers/i2o/i2o_config.c @@ -14,7 +14,6 @@ * 2 of the License, or (at your option) any later version. */ -#include #include #include #include diff --git a/drivers/i2o/i2o_core.c b/drivers/i2o/i2o_core.c index 3a3f1fe946ff..7945c79612c1 100644 --- a/drivers/i2o/i2o_core.c +++ b/drivers/i2o/i2o_core.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include diff --git a/drivers/i2o/i2o_lan.c b/drivers/i2o/i2o_lan.c index 1ebbe0b49faf..f15b7476e812 100644 --- a/drivers/i2o/i2o_lan.c +++ b/drivers/i2o/i2o_lan.c @@ -25,6 +25,7 @@ * - code/test for other LAN classes */ +#include #include #include diff --git a/drivers/i2o/i2o_pci.c b/drivers/i2o/i2o_pci.c index 596d9f953fde..196d58c85823 100644 --- a/drivers/i2o/i2o_pci.c +++ b/drivers/i2o/i2o_pci.c @@ -12,7 +12,6 @@ * 2 of the License, or (at your option) any later version. */ -#include #include #include #include diff --git a/drivers/i2o/i2o_proc.c b/drivers/i2o/i2o_proc.c index ce38b391495f..cdadc9cdcba3 100644 --- a/drivers/i2o/i2o_proc.c +++ b/drivers/i2o/i2o_proc.c @@ -38,7 +38,6 @@ #define FMT_U64_HEX "0x%08x%08x" #define U64_VAL(pu64) *((u32*)(pu64)+1), *((u32*)(pu64)) -#include #include #include #include diff --git a/drivers/net/cycx_drv.c b/drivers/net/cycx_drv.c index e75552e48ca1..7f803c63dd6d 100644 --- a/drivers/net/cycx_drv.c +++ b/drivers/net/cycx_drv.c @@ -39,7 +39,6 @@ * Aug 8, 1998 Arnaldo Initial version. */ -#include #ifdef MODULE #ifdef MODVERSIONS #include diff --git a/drivers/net/irda/irtty.c b/drivers/net/irda/irtty.c index ad8d2dc0ef10..751d98ec7b05 100644 --- a/drivers/net/irda/irtty.c +++ b/drivers/net/irda/irtty.c @@ -24,7 +24,6 @@ * ********************************************************************/ -#include #include #include #include diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c index 607b0f230c7c..fde6f7649b0f 100644 --- a/drivers/sbus/char/aurora.c +++ b/drivers/sbus/char/aurora.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/aic7xxx_proc.c b/drivers/scsi/aic7xxx_proc.c index 3314514f4f5f..a986c5e805d6 100644 --- a/drivers/scsi/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx_proc.c @@ -29,6 +29,8 @@ * $Id: aic7xxx_proc.c,v 4.1 1997/06/97 08:23:42 deang Exp $ *-M*************************************************************************/ +#include + #define BLS (&aic7xxx_buffer[size]) #define HDRB \ " < 2K 2K+ 4K+ 8K+ 16K+ 32K+ 64K+ 128K+" diff --git a/drivers/sgi/char/graphics_syms.c b/drivers/sgi/char/graphics_syms.c index 59c457bc9164..727909b4d850 100644 --- a/drivers/sgi/char/graphics_syms.c +++ b/drivers/sgi/char/graphics_syms.c @@ -8,7 +8,6 @@ */ #define __NO_VERSION__ -#include #include /* extern int rrm_command (unsigned int cmd, void *arg); diff --git a/drivers/sgi/char/newport.c b/drivers/sgi/char/newport.c index 023a228c2d2f..ae201cf19c7d 100644 --- a/drivers/sgi/char/newport.c +++ b/drivers/sgi/char/newport.c @@ -12,7 +12,6 @@ #include #include #include -#include #include struct newport_regs *npregs; diff --git a/drivers/sound/cmpci.c b/drivers/sound/cmpci.c index f4befd5a3ee6..c6f4f45c692e 100644 --- a/drivers/sound/cmpci.c +++ b/drivers/sound/cmpci.c @@ -62,6 +62,7 @@ /*****************************************************************************/ +#include #include #include #include diff --git a/drivers/sound/sb_ess.c b/drivers/sound/sb_ess.c index c6eb5c8d5e2a..3f55b74cf777 100644 --- a/drivers/sound/sb_ess.c +++ b/drivers/sound/sb_ess.c @@ -183,6 +183,7 @@ * ES1946 yes This is a PCI chip; not handled by this driver */ +#include #include #include "sound_config.h" diff --git a/drivers/tc/tcsyms.c b/drivers/tc/tcsyms.c index 37cbd364a0e1..88af39ec5f7b 100644 --- a/drivers/tc/tcsyms.c +++ b/drivers/tc/tcsyms.c @@ -3,7 +3,6 @@ * */ -#include #include #include diff --git a/drivers/usb/acm.c b/drivers/usb/acm.c index 10c837d5a28e..d5acef82f543 100644 --- a/drivers/usb/acm.c +++ b/drivers/usb/acm.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/audio.c b/drivers/usb/audio.c index 9743ec89e4e2..abbb73c4f029 100644 --- a/drivers/usb/audio.c +++ b/drivers/usb/audio.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include "usb.h" diff --git a/drivers/usb/cpia.c b/drivers/usb/cpia.c index 2402d3425ea3..ba89884a4520 100644 --- a/drivers/usb/cpia.c +++ b/drivers/usb/cpia.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/hub.c b/drivers/usb/hub.c index 0a1ec1f011b2..20ff104279ca 100644 --- a/drivers/usb/hub.c +++ b/drivers/usb/hub.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/mouse.c b/drivers/usb/mouse.c index a79c10a070ec..7ebb03be46f8 100644 --- a/drivers/usb/mouse.c +++ b/drivers/usb/mouse.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/usb.c b/drivers/usb/usb.c index 4be88f74ebfd..bbce88b64c9b 100644 --- a/drivers/usb/usb.c +++ b/drivers/usb/usb.c @@ -36,7 +36,6 @@ * 6 wLength 2 Count Bytes for data */ -#include #include #include #include diff --git a/drivers/usb/usb_scsi.c b/drivers/usb/usb_scsi.c index 1a3e16b257ee..5701d26710f2 100644 --- a/drivers/usb/usb_scsi.c +++ b/drivers/usb/usb_scsi.c @@ -25,6 +25,7 @@ * */ +#include #include #include #include diff --git a/drivers/usb/usb_scsi.h b/drivers/usb/usb_scsi.h index 58367d852bd8..3e6386f4f1e3 100644 --- a/drivers/usb/usb_scsi.h +++ b/drivers/usb/usb_scsi.h @@ -11,6 +11,8 @@ * */ +#include + #define USB_SCSI "usbscsi: " extern int usbscsi_debug; diff --git a/fs/buffer.c b/fs/buffer.c index f5a4aabd6ebd..108b385eaa4e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -78,6 +78,7 @@ static int nr_buffers_type[NR_LIST] = {0,}; static struct buffer_head * unused_list = NULL; static int nr_unused_buffer_heads = 0; static spinlock_t unused_list_lock = SPIN_LOCK_UNLOCKED; +static DECLARE_WAIT_QUEUE_HEAD(buffer_wait); struct bh_free_head { struct buffer_head *list; @@ -85,8 +86,6 @@ struct bh_free_head { }; static struct bh_free_head free_list[NR_SIZES]; -static DECLARE_WAIT_QUEUE_HEAD(buffer_wait); - static kmem_cache_t *bh_cachep; static int grow_buffers(int size); @@ -904,7 +903,6 @@ void __brelse(struct buffer_head * buf) if (atomic_read(&buf->b_count)) { atomic_dec(&buf->b_count); - wake_up(&buffer_wait); return; } printk("VFS: brelse: Trying to free free buffer\n"); @@ -923,7 +921,6 @@ void __bforget(struct buffer_head * buf) if (atomic_read(&buf->b_count) != 1 || buffer_locked(buf)) { touch_buffer(buf); atomic_dec(&buf->b_count); - wake_up(&buffer_wait); } else { atomic_set(&buf->b_count, 0); buf->b_state = 0; @@ -1837,9 +1834,16 @@ void __init buffer_init(unsigned long memory_size) for something that is really too small */ do { + unsigned long tmp; + nr_hash = (PAGE_SIZE << order) / sizeof(struct buffer_head *); bh_hash_mask = (nr_hash - 1); - bh_hash_shift = (PAGE_SHIFT + order); + + tmp = nr_hash; + bh_hash_shift = 0; + while((tmp >>= 1UL) != 0UL) + bh_hash_shift++; + hash_table = (struct buffer_head **) __get_free_pages(GFP_ATOMIC, order); } while (hash_table == NULL && --order > 0); @@ -2070,7 +2074,6 @@ int bdflush(void * unused) --written; } else ll_rw_block(WRITE, 1, &bh); - wake_up(&buffer_wait); atomic_dec(&bh->b_count); goto repeat; } diff --git a/fs/lockd/host.c b/fs/lockd/host.c index e8b208f65236..02cfb07f4129 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -140,6 +140,7 @@ nlm_lookup_host(struct svc_client *clnt, struct sockaddr_in *sin, host->h_nextrebind = jiffies + NLM_HOST_REBIND; host->h_expires = jiffies + NLM_HOST_EXPIRE; host->h_count = 1; + init_waitqueue_head(&host->h_gracewait); host->h_state = 0; /* pseudo NSM state */ host->h_nsmstate = 0; /* real NSM state */ host->h_exportent = clnt; diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 4a55e2779ae1..31d76e5c6011 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -884,6 +884,8 @@ static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) nfs_flush_dircache(dir); error = nfs_proc_mkdir(NFS_DSERVER(dentry), NFS_FH(dentry->d_parent), dentry->d_name.name, &sattr, &fhandle, &fattr); + if (!error) + dir->i_nlink++; return error; } @@ -909,8 +911,8 @@ dentry->d_inode->i_count, dentry->d_inode->i_nlink); /* Update i_nlink and invalidate dentry. */ if (!error) { d_drop(dentry); - if (dentry->d_inode->i_nlink) - dentry->d_inode->i_nlink --; + if (dir->i_nlink) + dir->i_nlink--; } return error; diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 627186cae2a7..cf35398233c2 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c @@ -6,9 +6,7 @@ * */ -#include #include - #include #include #include diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index d8f0ab21d8a0..ca1a55cdb4ae 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -10,6 +10,7 @@ * 26-Jan-1999 PJB Don't use IACK on CATS * 16-Mar-1999 RMK Added autodetect of ISA PICs */ +#include #include #include #include diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h index 745750e3be21..a03cea639672 100644 --- a/include/asm-arm/arch-ebsa285/memory.h +++ b/include/asm-arm/arch-ebsa285/memory.h @@ -15,6 +15,8 @@ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H +#include + #if defined(CONFIG_HOST_FOOTBRIDGE) /* diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h index 7d97af3f6028..103ed6dd183b 100644 --- a/include/asm-mips/io.h +++ b/include/asm-mips/io.h @@ -6,8 +6,6 @@ */ #undef CONF_SLOWDOWN_IO -#include - #include #include diff --git a/include/asm-mips/keyboard.h b/include/asm-mips/keyboard.h index ab9467784ded..0cd00b7b816b 100644 --- a/include/asm-mips/keyboard.h +++ b/include/asm-mips/keyboard.h @@ -12,7 +12,6 @@ #ifdef __KERNEL__ -#include #include #include #include diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index 7355f3c8dc0c..81dadd22a4e7 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h @@ -5,6 +5,8 @@ #ifndef _PPC_MMU_H_ #define _PPC_MMU_H_ +#include + #ifndef __ASSEMBLY__ /* Hardware Page Table Entry */ typedef struct _PTE { diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 167c9aa60313..a37b96a0c660 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h @@ -17,6 +17,8 @@ * the PT_* values below. This simplifies arch/ppc/kernel/ptrace.c. */ +#include + #ifndef __ASSEMBLY__ #ifdef CONFIG_PPC64 #define PPC_REG unsigned long /*long*/ diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h index 721056e32b10..aaf4a917d0e0 100644 --- a/include/linux/cyclomx.h +++ b/include/linux/cyclomx.h @@ -21,6 +21,7 @@ #ifndef _CYCLOMX_H #define _CYCLOMX_H +#include #include #include diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 3b7272caafe5..33a969a9835f 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -39,11 +39,14 @@ static inline unsigned long page_address(struct page * page) */ #define page_cache_entry(x) (mem_map + MAP_NR(x)) -#define PAGE_HASH_BITS 16 +extern unsigned int page_hash_bits; +#define PAGE_HASH_BITS (page_hash_bits) #define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) extern atomic_t page_cache_size; /* # of pages currently in the hash table */ -extern struct page * page_hash_table[PAGE_HASH_SIZE]; +extern struct page **page_hash_table; + +extern void page_cache_init(unsigned long); /* * We use a power-of-two hash table to avoid a modulus, diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 22d227278701..d8118449c8ff 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h @@ -1,6 +1,8 @@ #ifndef _NET_DN_FIB_H #define _NET_DN_FIB_H +#include + #ifdef CONFIG_DECNET_ROUTER diff --git a/include/net/dn_raw.h b/include/net/dn_raw.h index a4502d29c5f9..8232ddf4ec13 100644 --- a/include/net/dn_raw.h +++ b/include/net/dn_raw.h @@ -1,6 +1,8 @@ #ifndef _NET_DN_RAW_H #define _NET_DN_RAW_H +#include + #ifdef CONFIG_DECNET_RAW extern struct proto_ops dn_raw_proto_ops; diff --git a/init/main.c b/init/main.c index 7057b9d2b0a1..4b8581cf06a9 100644 --- a/init/main.c +++ b/init/main.c @@ -1186,6 +1186,7 @@ asmlinkage void __init start_kernel(void) dcache_init(); vma_init(); buffer_init(memory_end-memory_start); + page_cache_init(memory_end-memory_start); signals_init(); inode_init(); file_table_init(); diff --git a/ipc/msg.c b/ipc/msg.c index 1c9f3bd06829..86e5a9f26fcd 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -11,6 +11,7 @@ * /proc/sysvipc/msg support (c) 1999 Dragos Acostachioaie */ +#include #include #include #include diff --git a/ipc/sem.c b/ipc/sem.c index 7c4d0de44fdc..5a48748a2a8e 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -52,6 +52,7 @@ * /proc/sysvipc/sem support (c) 1999 Dragos Acostachioaie */ +#include #include #include #include diff --git a/ipc/shm.c b/ipc/shm.c index 8a1ded7c8098..36380c533f23 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -8,6 +8,7 @@ * /proc/sysvipc/shm support (c) 1999 Dragos Acostachioaie */ +#include #include #include #include diff --git a/kernel/ksyms.c b/kernel/ksyms.c index 1c0ba5f26f6f..04fd2517aa38 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -171,6 +171,8 @@ EXPORT_SYMBOL(block_flushpage); EXPORT_SYMBOL(generic_file_read); EXPORT_SYMBOL(generic_file_write); EXPORT_SYMBOL(generic_file_mmap); +EXPORT_SYMBOL(page_hash_bits); +EXPORT_SYMBOL(page_hash_table); EXPORT_SYMBOL(file_lock_table); EXPORT_SYMBOL(posix_lock_file); EXPORT_SYMBOL(posix_test_lock); diff --git a/mm/filemap.c b/mm/filemap.c index f2cb29a78d8c..ed5b6d34c7a5 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,8 @@ */ atomic_t page_cache_size = ATOMIC_INIT(0); -struct page * page_hash_table[PAGE_HASH_SIZE]; +unsigned int page_hash_bits; +struct page **page_hash_table; spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED; @@ -1915,3 +1917,30 @@ void put_cached_page(unsigned long addr) page_count(page)); page_cache_release(page); } + +void __init page_cache_init(unsigned long memory_size) +{ + unsigned long htable_size, order; + + htable_size = memory_size >> PAGE_SHIFT; + htable_size *= sizeof(struct page *); + for(order = 0; (PAGE_SIZE << order) < htable_size; order++) + ; + + do { + unsigned long tmp = (PAGE_SIZE << order) / sizeof(struct page *); + + page_hash_bits = 0; + while((tmp >>= 1UL) != 0UL) + page_hash_bits++; + + page_hash_table = (struct page **) + __get_free_pages(GFP_ATOMIC, order); + } while(page_hash_table == NULL && --order > 0); + + printk("Page-cache hash table entries: %d (order: %ld, %ld bytes)\n", + (1 << page_hash_bits), order, (PAGE_SIZE << order)); + if (!page_hash_table) + panic("Failed to allocate page hash table\n"); + memset(page_hash_table, 0, PAGE_HASH_SIZE * sizeof(struct page *)); +} diff --git a/mm/swapfile.c b/mm/swapfile.c index a4a523ef25cb..ce18f34f5d4e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -5,7 +5,6 @@ * Swap reorganised 29.12.95, Stephen Tweedie */ -#include #include #include #include diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index b4211e91b833..97801e3e5c6f 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c @@ -34,7 +34,6 @@ GNU General Public License for more details. *******************************************************************************/ -#include #include #include #include diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c index 8cfeaee70528..05f18c5a5671 100644 --- a/net/decnet/dn_timer.c +++ b/net/decnet/dn_timer.c @@ -13,7 +13,6 @@ * timer idea. * Steve Whitehouse : Added checks for sk->sock_readers */ -#include #include #include #include diff --git a/net/socket.c b/net/socket.c index 41499da08166..9a34b7580e67 100644 --- a/net/socket.c +++ b/net/socket.c @@ -950,7 +950,6 @@ asmlinkage int sys_sendto(int fd, void * buff, size_t len, unsigned flags, struct msghdr msg; struct iovec iov; - lock_kernel(); sock = sockfd_lookup(fd, &err); if (!sock) goto out; @@ -977,7 +976,6 @@ asmlinkage int sys_sendto(int fd, void * buff, size_t len, unsigned flags, out_put: sockfd_put(sock); out: - unlock_kernel(); return err; } @@ -1005,7 +1003,6 @@ asmlinkage int sys_recvfrom(int fd, void * ubuf, size_t size, unsigned flags, char address[MAX_SOCK_ADDR]; int err,err2; - lock_kernel(); sock = sockfd_lookup(fd, &err); if (!sock) goto out; @@ -1030,7 +1027,6 @@ asmlinkage int sys_recvfrom(int fd, void * ubuf, size_t size, unsigned flags, } sockfd_put(sock); out: - unlock_kernel(); return err; } @@ -1123,8 +1119,6 @@ asmlinkage int sys_sendmsg(int fd, struct msghdr *msg, unsigned flags) struct msghdr msg_sys; int err, ctl_len, iov_size, total_len; - lock_kernel(); - err = -EFAULT; if (copy_from_user(&msg_sys,msg,sizeof(struct msghdr))) goto out; @@ -1194,7 +1188,6 @@ out_freeiov: out_put: sockfd_put(sock); out: - unlock_kernel(); return err; } @@ -1218,7 +1211,6 @@ asmlinkage int sys_recvmsg(int fd, struct msghdr *msg, unsigned int flags) struct sockaddr *uaddr; int *uaddr_len; - lock_kernel(); err=-EFAULT; if (copy_from_user(&msg_sys,msg,sizeof(struct msghdr))) goto out; @@ -1282,7 +1274,6 @@ out_freeiov: out_put: sockfd_put(sock); out: - unlock_kernel(); return err; } diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index ae10c3342e9e..0f2922dfd581 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -42,7 +42,6 @@ #define __KERNEL_SYSCALLS__ #include -#include #include #include #include -- 2.39.5