diff options
70 files changed, 657 insertions, 323 deletions
@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 2 -EXTRAVERSION =-pre4 +EXTRAVERSION =-pre5 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index 789604e6fbfd..d7fd9193ddbc 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile @@ -39,6 +39,9 @@ obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o obj-$(CONFIG_X86_LOCAL_APIC) += mpparse.o apic.o nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o acpitable.o +ifdef CONFIG_VISWS +obj-y += setup-visws.o obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o +endif include $(TOPDIR)/Rules.make diff --git a/arch/i386/kernel/setup-visws.c b/arch/i386/kernel/setup-visws.c new file mode 100644 index 000000000000..1c8220b82216 --- /dev/null +++ b/arch/i386/kernel/setup-visws.c @@ -0,0 +1,126 @@ +/* + * Unmaintained SGI Visual Workstation support. + * Split out from setup.c by davej@suse.de + */ + +char visws_board_type = -1; +char visws_board_rev = -1; + +#define PIIX_PM_START 0x0F80 + +#define SIO_GPIO_START 0x0FC0 + +#define SIO_PM_START 0x0FC8 + +#define PMBASE PIIX_PM_START +#define GPIREG0 (PMBASE+0x30) +#define GPIREG(x) (GPIREG0+((x)/8)) +#define PIIX_GPI_BD_ID1 18 +#define PIIX_GPI_BD_REG GPIREG(PIIX_GPI_BD_ID1) + +#define PIIX_GPI_BD_SHIFT (PIIX_GPI_BD_ID1 % 8) + +#define SIO_INDEX 0x2e +#define SIO_DATA 0x2f + +#define SIO_DEV_SEL 0x7 +#define SIO_DEV_ENB 0x30 +#define SIO_DEV_MSB 0x60 +#define SIO_DEV_LSB 0x61 + +#define SIO_GP_DEV 0x7 + +#define SIO_GP_BASE SIO_GPIO_START +#define SIO_GP_MSB (SIO_GP_BASE>>8) +#define SIO_GP_LSB (SIO_GP_BASE&0xff) + +#define SIO_GP_DATA1 (SIO_GP_BASE+0) + +#define SIO_PM_DEV 0x8 + +#define SIO_PM_BASE SIO_PM_START +#define SIO_PM_MSB (SIO_PM_BASE>>8) +#define SIO_PM_LSB (SIO_PM_BASE&0xff) +#define SIO_PM_INDEX (SIO_PM_BASE+0) +#define SIO_PM_DATA (SIO_PM_BASE+1) + +#define SIO_PM_FER2 0x1 + +#define SIO_PM_GP_EN 0x80 + +void __init visws_get_board_type_and_rev(void) +{ + int raw; + + visws_board_type = (char)(inb_p(PIIX_GPI_BD_REG) & PIIX_GPI_BD_REG) + >> PIIX_GPI_BD_SHIFT; +/* + * Get Board rev. + * First, we have to initialize the 307 part to allow us access + * to the GPIO registers. Let's map them at 0x0fc0 which is right + * after the PIIX4 PM section. + */ + outb_p(SIO_DEV_SEL, SIO_INDEX); + outb_p(SIO_GP_DEV, SIO_DATA); /* Talk to GPIO regs. */ + + outb_p(SIO_DEV_MSB, SIO_INDEX); + outb_p(SIO_GP_MSB, SIO_DATA); /* MSB of GPIO base address */ + + outb_p(SIO_DEV_LSB, SIO_INDEX); + outb_p(SIO_GP_LSB, SIO_DATA); /* LSB of GPIO base address */ + + outb_p(SIO_DEV_ENB, SIO_INDEX); + outb_p(1, SIO_DATA); /* Enable GPIO registers. */ + +/* + * Now, we have to map the power management section to write + * a bit which enables access to the GPIO registers. + * What lunatic came up with this shit? + */ + outb_p(SIO_DEV_SEL, SIO_INDEX); + outb_p(SIO_PM_DEV, SIO_DATA); /* Talk to GPIO regs. */ + + outb_p(SIO_DEV_MSB, SIO_INDEX); + outb_p(SIO_PM_MSB, SIO_DATA); /* MSB of PM base address */ + + outb_p(SIO_DEV_LSB, SIO_INDEX); + outb_p(SIO_PM_LSB, SIO_DATA); /* LSB of PM base address */ + + outb_p(SIO_DEV_ENB, SIO_INDEX); + outb_p(1, SIO_DATA); /* Enable PM registers. */ + +/* + * Now, write the PM register which enables the GPIO registers. + */ + outb_p(SIO_PM_FER2, SIO_PM_INDEX); + outb_p(SIO_PM_GP_EN, SIO_PM_DATA); + +/* + * Now, initialize the GPIO registers. + * We want them all to be inputs which is the + * power on default, so let's leave them alone. + * So, let's just read the board rev! + */ + raw = inb_p(SIO_GP_DATA1); + raw &= 0x7f; /* 7 bits of valid board revision ID. */ + + if (visws_board_type == VISWS_320) { + if (raw < 0x6) { + visws_board_rev = 4; + } else if (raw < 0xc) { + visws_board_rev = 5; + } else { + visws_board_rev = 6; + } + } else if (visws_board_type == VISWS_540) { + visws_board_rev = 2; + } else { + visws_board_rev = raw; + } + + printk(KERN_INFO "Silicon Graphics %s (rev %d)\n", + visws_board_type == VISWS_320 ? "320" : + (visws_board_type == VISWS_540 ? "540" : + "unknown"), visws_board_rev); + } +} diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 274fb64fd81e..efd313e13fe9 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -158,6 +158,7 @@ extern void mcheck_init(struct cpuinfo_x86 *c); extern int root_mountflags; extern char _text, _etext, _edata, _end; extern int blk_nohighio; +void __init visws_get_board_type_and_rev(void); static int disable_x86_serial_nr __initdata = 1; static int disable_x86_fxsr __initdata = 0; @@ -191,131 +192,6 @@ int enable_acpi_smp_table; #define RAMDISK_PROMPT_FLAG 0x8000 #define RAMDISK_LOAD_FLAG 0x4000 -#ifdef CONFIG_VISWS -char visws_board_type = -1; -char visws_board_rev = -1; - -#define PIIX_PM_START 0x0F80 - -#define SIO_GPIO_START 0x0FC0 - -#define SIO_PM_START 0x0FC8 - -#define PMBASE PIIX_PM_START -#define GPIREG0 (PMBASE+0x30) -#define GPIREG(x) (GPIREG0+((x)/8)) -#define PIIX_GPI_BD_ID1 18 -#define PIIX_GPI_BD_REG GPIREG(PIIX_GPI_BD_ID1) - -#define PIIX_GPI_BD_SHIFT (PIIX_GPI_BD_ID1 % 8) - -#define SIO_INDEX 0x2e -#define SIO_DATA 0x2f - -#define SIO_DEV_SEL 0x7 -#define SIO_DEV_ENB 0x30 -#define SIO_DEV_MSB 0x60 -#define SIO_DEV_LSB 0x61 - -#define SIO_GP_DEV 0x7 - -#define SIO_GP_BASE SIO_GPIO_START -#define SIO_GP_MSB (SIO_GP_BASE>>8) -#define SIO_GP_LSB (SIO_GP_BASE&0xff) - -#define SIO_GP_DATA1 (SIO_GP_BASE+0) - -#define SIO_PM_DEV 0x8 - -#define SIO_PM_BASE SIO_PM_START -#define SIO_PM_MSB (SIO_PM_BASE>>8) -#define SIO_PM_LSB (SIO_PM_BASE&0xff) -#define SIO_PM_INDEX (SIO_PM_BASE+0) -#define SIO_PM_DATA (SIO_PM_BASE+1) - -#define SIO_PM_FER2 0x1 - -#define SIO_PM_GP_EN 0x80 - -static void __init visws_get_board_type_and_rev(void) -{ - int raw; - - visws_board_type = (char)(inb_p(PIIX_GPI_BD_REG) & PIIX_GPI_BD_REG) - >> PIIX_GPI_BD_SHIFT; -/* - * Get Board rev. - * First, we have to initialize the 307 part to allow us access - * to the GPIO registers. Let's map them at 0x0fc0 which is right - * after the PIIX4 PM section. - */ - outb_p(SIO_DEV_SEL, SIO_INDEX); - outb_p(SIO_GP_DEV, SIO_DATA); /* Talk to GPIO regs. */ - - outb_p(SIO_DEV_MSB, SIO_INDEX); - outb_p(SIO_GP_MSB, SIO_DATA); /* MSB of GPIO base address */ - - outb_p(SIO_DEV_LSB, SIO_INDEX); - outb_p(SIO_GP_LSB, SIO_DATA); /* LSB of GPIO base address */ - - outb_p(SIO_DEV_ENB, SIO_INDEX); - outb_p(1, SIO_DATA); /* Enable GPIO registers. */ - -/* - * Now, we have to map the power management section to write - * a bit which enables access to the GPIO registers. - * What lunatic came up with this shit? - */ - outb_p(SIO_DEV_SEL, SIO_INDEX); - outb_p(SIO_PM_DEV, SIO_DATA); /* Talk to GPIO regs. */ - - outb_p(SIO_DEV_MSB, SIO_INDEX); - outb_p(SIO_PM_MSB, SIO_DATA); /* MSB of PM base address */ - - outb_p(SIO_DEV_LSB, SIO_INDEX); - outb_p(SIO_PM_LSB, SIO_DATA); /* LSB of PM base address */ - - outb_p(SIO_DEV_ENB, SIO_INDEX); - outb_p(1, SIO_DATA); /* Enable PM registers. */ - -/* - * Now, write the PM register which enables the GPIO registers. - */ - outb_p(SIO_PM_FER2, SIO_PM_INDEX); - outb_p(SIO_PM_GP_EN, SIO_PM_DATA); - -/* - * Now, initialize the GPIO registers. - * We want them all to be inputs which is the - * power on default, so let's leave them alone. - * So, let's just read the board rev! - */ - raw = inb_p(SIO_GP_DATA1); - raw &= 0x7f; /* 7 bits of valid board revision ID. */ - - if (visws_board_type == VISWS_320) { - if (raw < 0x6) { - visws_board_rev = 4; - } else if (raw < 0xc) { - visws_board_rev = 5; - } else { - visws_board_rev = 6; - - } - } else if (visws_board_type == VISWS_540) { - visws_board_rev = 2; - } else { - visws_board_rev = raw; - } - - printk(KERN_INFO "Silicon Graphics %s (rev %d)\n", - visws_board_type == VISWS_320 ? "320" : - (visws_board_type == VISWS_540 ? "540" : - "unknown"), - visws_board_rev); - } -#endif - static char command_line[COMMAND_LINE_SIZE]; char saved_command_line[COMMAND_LINE_SIZE]; @@ -1289,8 +1165,24 @@ static int __init init_amd(struct cpuinfo_x86 *c) } break; - case 6: /* An Athlon/Duron. We can trust the BIOS probably */ - break; + case 6: /* An Athlon/Duron */ + + /* Bit 15 of Athlon specific MSR 15, needs to be 0 + * to enable SSE on Palomino/Morgan CPU's. + * If the BIOS didn't enable it already, enable it + * here. + */ + if (c->x86_model == 6 || c->x86_model == 7) { + if (!test_bit(X86_FEATURE_XMM, &c->x86_capability)) { + printk(KERN_INFO "Enabling disabled K7/SSE Support.\n"); + rdmsr(MSR_K7_HWCR, l, h); + l &= ~0x00008000; + wrmsr(MSR_K7_HWCR, l, h); + set_bit(X86_FEATURE_XMM, &c->x86_capability); + } + } + break; + } display_cacheinfo(c); @@ -2200,6 +2092,56 @@ static void __init init_intel(struct cpuinfo_x86 *c) if ( p ) strcpy(c->x86_model_id, p); + +#ifdef CONFIG_SMP + if (test_bit(X86_FEATURE_HT, &c->x86_capability)) { + extern int phys_proc_id[NR_CPUS]; + + u32 eax, ebx, ecx, edx; + int index_lsb, index_msb, tmp; + int initial_apic_id; + int cpu = smp_processor_id(); + + cpuid(1, &eax, &ebx, &ecx, &edx); + smp_num_siblings = (ebx & 0xff0000) >> 16; + + if (smp_num_siblings == 1) { + printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); + } else if (smp_num_siblings > 1 ) { + index_lsb = 0; + index_msb = 31; + /* + * At this point we only support two siblings per + * processor package. + */ +#define NR_SIBLINGS 2 + if (smp_num_siblings != NR_SIBLINGS) { + printk(KERN_WARNING "CPU: Unsupported number of the siblings %d", smp_num_siblings); + smp_num_siblings = 1; + goto too_many_siblings; + } + tmp = smp_num_siblings; + while ((tmp & 1) == 0) { + tmp >>=1 ; + index_lsb++; + } + tmp = smp_num_siblings; + while ((tmp & 0x80000000 ) == 0) { + tmp <<=1 ; + index_msb--; + } + if (index_lsb != index_msb ) + index_msb++; + initial_apic_id = ebx >> 24 & 0xff; + phys_proc_id[cpu] = initial_apic_id >> index_msb; + + printk(KERN_INFO "CPU: Physical Processor ID: %d\n", + phys_proc_id[cpu]); + } + + } +too_many_siblings: +#endif } void __init get_cpu_vendor(struct cpuinfo_x86 *c) @@ -2706,7 +2648,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", - "fxsr", "sse", "sse2", "ss", NULL, "tm", "ia64", NULL, + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL, /* AMD-defined */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 64d6c827cd96..73727329ab11 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -56,6 +56,10 @@ static int max_cpus = -1; /* Total count of live CPUs */ int smp_num_cpus = 1; +/* Number of siblings per CPU package */ +int smp_num_siblings = 1; +int __initdata phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */ + /* Bitmask of currently online CPUs */ unsigned long cpu_online_map; @@ -971,6 +975,8 @@ static int boot_cpu_logical_apicid; /* Where the IO area was mapped on multiquad, always 0 otherwise */ void *xquad_portio = NULL; +int cpu_sibling_map[NR_CPUS] __cacheline_aligned; + void __init smp_boot_cpus(void) { int apicid, cpu, bit; @@ -1162,6 +1168,34 @@ void __init smp_boot_cpus(void) printk(KERN_WARNING "WARNING: SMP operation may be unreliable with B stepping processors.\n"); Dprintk("Boot done.\n"); + /* + * If Hyper-Threading is avaialble, construct cpu_sibling_map[], so + * that we can tell the sibling CPU efficiently. + */ + if (test_bit(X86_FEATURE_HT, boot_cpu_data.x86_capability) + && smp_num_siblings > 1) { + for (cpu = 0; cpu < NR_CPUS; cpu++) + cpu_sibling_map[cpu] = NO_PROC_ID; + + for (cpu = 0; cpu < smp_num_cpus; cpu++) { + int i; + + for (i = 0; i < smp_num_cpus; i++) { + if (i == cpu) + continue; + if (phys_proc_id[cpu] == phys_proc_id[i]) { + cpu_sibling_map[cpu] = i; + printk("cpu_sibling_map[%d] = %d\n", cpu, cpu_sibling_map[cpu]); + break; + } + } + if (cpu_sibling_map[cpu] == NO_PROC_ID) { + smp_num_siblings = 1; + printk(KERN_WARNING "WARNING: No sibling found for CPU %d.\n", cpu); + } + } + } + #ifndef CONFIG_VISWS /* * Here we can be sure that there is an IO-APIC in the system. Let's diff --git a/drivers/acpi/ospm/thermal/tzpolicy.c b/drivers/acpi/ospm/thermal/tzpolicy.c index 3c4ebbb2d374..83608fab27ce 100644 --- a/drivers/acpi/ospm/thermal/tzpolicy.c +++ b/drivers/acpi/ospm/thermal/tzpolicy.c @@ -31,6 +31,7 @@ #include <linux/proc_fs.h> #include <linux/sysctl.h> #include <linux/pm.h> +#include <linux/sched.h> #include <acpi.h> #include <bm.h> diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c index eedafcaa9f7a..9664721ec353 100644 --- a/drivers/block/ps2esdi.c +++ b/drivers/block/ps2esdi.c @@ -952,10 +952,10 @@ static void ps2esdi_normal_interrupt_handler(u_int int_ret_code) break; } if(ending != -1) { - spin_lock_irqsave(ps2esdi_LOCK, flags); + spin_lock_irqsave(&ps2esdi_lock, flags); end_request(ending); do_ps2esdi_request(BLK_DEFAULT_QUEUE(MAJOR_NR)); - spin_unlock_irqrestore(ps2esdi_LOCK, flags); + spin_unlock_irqrestore(&ps2esdi_lock, flags); } } /* handle interrupts */ diff --git a/drivers/char/ftape/RELEASE-NOTES b/drivers/char/ftape/RELEASE-NOTES index 4cb63e56df33..03799dbc05a4 100644 --- a/drivers/char/ftape/RELEASE-NOTES +++ b/drivers/char/ftape/RELEASE-NOTES @@ -838,6 +838,7 @@ received. I hope to find some time to do this soon. - Split ftape-io.c into ftape-io.c and ftape-ctl.c files. - Corrected too high media error count after writing to a bad tape. +- Added #include <asm/segment.h> again because old kernel versions need it. - Fixed fdc not being disabled when open failed because no tape drive was found. diff --git a/drivers/char/ftape/compressor/zftape-compress.c b/drivers/char/ftape/compressor/zftape-compress.c index 4265bba231f7..5abdde05455b 100644 --- a/drivers/char/ftape/compressor/zftape-compress.c +++ b/drivers/char/ftape/compressor/zftape-compress.c @@ -40,6 +40,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else +#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.c b/drivers/char/ftape/lowlevel/ftape-ctl.c index 3c8f7f522e9a..6c1ef5235053 100644 --- a/drivers/char/ftape/lowlevel/ftape-ctl.c +++ b/drivers/char/ftape/lowlevel/ftape-ctl.c @@ -36,6 +36,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else +#include <asm/segment.h> #endif #include <asm/io.h> diff --git a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c index 1821480b43bf..6441ca9298f2 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.c +++ b/drivers/char/ftape/zftape/zftape-ctl.c @@ -36,6 +36,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else +#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff --git a/drivers/char/ftape/zftape/zftape-read.c b/drivers/char/ftape/zftape/zftape-read.c index 35657926fc9a..756ee32391d3 100644 --- a/drivers/char/ftape/zftape/zftape-read.c +++ b/drivers/char/ftape/zftape/zftape-read.c @@ -32,6 +32,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else +#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff --git a/drivers/char/ftape/zftape/zftape-write.c b/drivers/char/ftape/zftape/zftape-write.c index 66b581ad7ea9..8608c4dcc9d8 100644 --- a/drivers/char/ftape/zftape/zftape-write.c +++ b/drivers/char/ftape/zftape/zftape-write.c @@ -32,6 +32,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else +#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index f2a087486ed1..addbe20a4b7f 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2588,6 +2588,13 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) if (cap.mechtype == mechtype_caddy || cap.mechtype == mechtype_popup) CDROM_CONFIG_FLAGS (drive)->close_tray = 0; + /* Some drives used by Apple don't advertise audio play + * but they do support reading TOC & audio datas + */ + if (strcmp (drive->id->model, "MATSHITADVD-ROM SR-8187") == 0 || + strcmp (drive->id->model, "MATSHITADVD-ROM SR-8186") == 0) + CDROM_CONFIG_FLAGS (drive)->audio_play = 1; + #if ! STANDARD_ATAPI if (cdi->sanyo_slot > 0) { CDROM_CONFIG_FLAGS (drive)->is_changer = 1; diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index e50c7b4e7091..9206953f24fa 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -863,8 +863,10 @@ static void __exit idedisk_exit (void) } /* We must remove proc entries defined in this module. Otherwise we oops while accessing these entries */ +#ifdef CONFIG_PROC_FS if (drive->proc) ide_remove_proc_entries(drive->proc, idedisk_proc); +#endif } ide_unregister_module(&idedisk_module); } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index c138d365ba98..ca55f3b1845c 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -2029,10 +2029,13 @@ static void __exit idefloppy_exit (void) printk ("%s: cleanup_module() called while still busy\n", drive->name); failed++; } + +#ifdef CONFIG_PROC_FS /* We must remove proc entries defined in this module. Otherwise we oops while accessing these entries */ if (drive->proc) ide_remove_proc_entries(drive->proc, idefloppy_proc); +#endif } ide_unregister_module(&idefloppy_module); } diff --git a/drivers/net/hamradio/soundmodem/sm_sbc.c b/drivers/net/hamradio/soundmodem/sm_sbc.c index 54e4e4f1e34a..85ae47588ef4 100644 --- a/drivers/net/hamradio/soundmodem/sm_sbc.c +++ b/drivers/net/hamradio/soundmodem/sm_sbc.c @@ -50,6 +50,7 @@ #if LINUX_VERSION_CODE >= 0x20100 #include <asm/uaccess.h> #else +#include <asm/segment.h> #include <linux/mm.h> #undef put_user diff --git a/drivers/net/hamradio/soundmodem/sm_wss.c b/drivers/net/hamradio/soundmodem/sm_wss.c index a6a2b782b9b1..6d94d6da4a46 100644 --- a/drivers/net/hamradio/soundmodem/sm_wss.c +++ b/drivers/net/hamradio/soundmodem/sm_wss.c @@ -49,6 +49,7 @@ #if LINUX_VERSION_CODE >= 0x20100 #include <asm/uaccess.h> #else +#include <asm/segment.h> #include <linux/mm.h> #undef put_user diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c index e02ed0d65d7d..f3a574fe356c 100644 --- a/drivers/net/wan/sdla_chdlc.c +++ b/drivers/net/wan/sdla_chdlc.c @@ -65,6 +65,7 @@ #include <linux/inetdevice.h> #include <linux/netdevice.h> #else + #include <asm/segment.h> #include <net/route.h> /* Adding new route entries : 2.0.X kernels */ #endif diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index 050fca46d7c3..c14bc778bd9f 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c @@ -169,6 +169,7 @@ #include <linux/netdevice.h> #else + #include <asm/segment.h> #endif #include <net/route.h> /* Dynamic Route Creation */ diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c index 58a5aa5e80b9..73a9d033e8c6 100644 --- a/drivers/net/wan/sdla_ppp.c +++ b/drivers/net/wan/sdla_ppp.c @@ -111,6 +111,7 @@ #include <linux/inetdevice.h> #include <linux/netdevice.h> #else + #include <asm/segment.h> #include <net/route.h> /* Adding new route entries : 2.0.X kernels */ #endif diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c index 47a379fc80bb..47bf1b3f8e9c 100644 --- a/drivers/net/wan/sdla_x25.c +++ b/drivers/net/wan/sdla_x25.c @@ -98,6 +98,7 @@ #if defined(LINUX_2_1) || defined(LINUX_2_4) #include <asm/uaccess.h> #else + #include <asm/segment.h> #include <net/route.h> #endif diff --git a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c index abb81220c60e..335d0a5d9c1c 100644 --- a/drivers/net/wan/sdlamain.c +++ b/drivers/net/wan/sdlamain.c @@ -78,6 +78,7 @@ #else + #include <asm/segment.h> #define devinet_ioctl(x,y) dev_ioctl(x,y) #define netdevice_t struct device #define test_and_set_bit set_bit diff --git a/drivers/s390/s390io.c b/drivers/s390/s390io.c index f06ffdfd2d9b..c22080d11f5b 100644 --- a/drivers/s390/s390io.c +++ b/drivers/s390/s390io.c @@ -6,6 +6,7 @@ * Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH, * IBM Corporation * Author(s): Ingo Adlung (adlung@de.ibm.com) + * Cornelia Huck (cohuck@de.ibm.com) * ChangeLog: 01/07/2001 Blacklist cleanup (djbarrow@de.ibm.com,barrow_dj@yahoo.com) * 01/04/2001 Holger Smolinski (smolinsk@de.ibm.com) * Fixed lost interrupts and do_adapter_IO @@ -108,7 +109,9 @@ static void init_IRQ_handler( int irq, void *dev_id, struct pt_regs *regs); static void s390_process_subchannels( void); static void s390_device_recognition_all( void); static void s390_device_recognition_irq( int irq); +#ifdef CONFIG_PROC_FS static void s390_redo_validation(void); +#endif static int s390_validate_subchannel( int irq, int enable); static int s390_SenseID( int irq, senseid_t *sid, __u8 lpm); static int s390_SetPGID( int irq, __u8 lpm, pgid_t *pgid); @@ -117,7 +120,9 @@ static int s390_process_IRQ( unsigned int irq ); static int enable_subchannel( unsigned int irq); static int disable_subchannel( unsigned int irq); +#ifdef CONFIG_PROC_FS static int chan_proc_init( void ); +#endif static inline void do_adapter_IO( __u32 intparm ); @@ -666,6 +671,7 @@ static int __init cio_notoper_setup(char *parm) __setup("cio_notoper_msg=", cio_notoper_setup); +#ifdef CONFIG_PROC_FS static int __init cio_proc_devinfo_setup(char *parm) { if (!strcmp(parm, "yes")) { @@ -673,13 +679,14 @@ static int __init cio_proc_devinfo_setup(char *parm) } else if (!strcmp(parm, "no")) { cio_proc_devinfo = 0; } else { - printk("cio_proc_devinfo_setup: invalid parameter '%s'\n",parm); + printk( KERN_ERR "cio_proc_devinfo_setup: invalid parameter '%s'\n",parm); } return 1; } __setup("cio_proc_devinfo=", cio_proc_devinfo_setup); +#endif /* * register for adapter interrupts @@ -4779,10 +4786,12 @@ void s390_redo_validation(void) } } +#ifdef CONFIG_PROC_FS if (cio_proc_devinfo) if (irq < MAX_CIO_PROCFS_ENTRIES) { cio_procfs_device_create(ioinfo[irq]->devno); } +#endif } } irq++; @@ -6523,10 +6532,11 @@ void s390_do_crw_pending( crwe_t *pcrwe ) if ( ioinfo[irq]->ui.flags.oper == 0 ) { not_oper_handler_func_t nopfunc=ioinfo[irq]->nopfunc; - +#ifdef CONFIG_PROC_FS /* remove procfs entry */ if (cio_proc_devinfo) cio_procfs_device_remove(dev_no); +#endif /* * If the device has gone * call not oper handler @@ -6573,12 +6583,13 @@ void s390_do_crw_pending( crwe_t *pcrwe ) pdevreg->oper_func( irq, pdevreg ); } /* endif */ - +#ifdef CONFIG_PROC_FS /* add new procfs entry */ if (cio_proc_devinfo) if (highest_subchannel < MAX_CIO_PROCFS_ENTRIES) { cio_procfs_device_create(ioinfo[irq]->devno); } +#endif } /* * ... it is and was operational, but @@ -6586,23 +6597,26 @@ void s390_do_crw_pending( crwe_t *pcrwe ) */ else if ((ioinfo[irq]->devno != dev_no) && ( ioinfo[irq]->nopfunc != NULL )) { +#ifdef CONFIG_PROC_FS int devno_old = ioinfo[irq]->devno; +#endif ioinfo[irq]->nopfunc( irq, DEVSTAT_REVALIDATE ); - +#ifdef CONFIG_PROC_FS /* remove old entry, add new */ if (cio_proc_devinfo) { cio_procfs_device_remove(devno_old); cio_procfs_device_create(ioinfo[irq]->devno); } +#endif } /* endif */ } /* endif */ - +#ifdef CONFIG_PROC_FS /* get rid of dead procfs entries */ if (cio_proc_devinfo) cio_procfs_device_purge(); - +#endif } /* endif */ break; @@ -6756,6 +6770,7 @@ int cio_debug_init( void ) __initcall(cio_debug_init); +#ifdef CONFIG_PROC_FS /* * Display info on subchannels in /proc/subchannels. * Adapted from procfs stuff in dasd.c by Cornelia Huck, 02/28/01. @@ -7163,19 +7178,19 @@ int cio_procfs_device_create(int devno) entry->cio_chpid_entry = create_proc_entry( "chpids", S_IFREG|S_IRUGO, entry->cio_device_entry); entry->cio_chpid_entry->proc_fops = &cio_chpid_entry_file_ops; } else { - printk("Error, could not allocate procfs structure!\n"); + printk( KERN_WARNING "Error, could not allocate procfs structure!\n"); remove_proc_entry(buf, cio_procfs_deviceinfo_root); kfree(entry); rc = -ENOMEM; } } else { - printk("Error, could not allocate procfs structure!\n"); + printk( KERN_WARNING "Error, could not allocate procfs structure!\n"); kfree(entry); rc = -ENOMEM; } } else { - printk("Error, could not allocate procfs structure!\n"); + printk( KERN_WARNING "Error, could not allocate procfs structure!\n"); rc = -ENOMEM; } return rc; @@ -7370,7 +7385,7 @@ static ssize_t cio_ignore_proc_write (struct file *file, const char *user_buf, } buffer[user_len]='\0'; #ifdef CIO_DEBUG_IO - printk ("/proc/cio_ignore: '%s'\n", buffer); + printk ( KERN_DEBUG "/proc/cio_ignore: '%s'\n", buffer); #endif /* CIO_DEBUG_IO */ if (cio_debug_initialized) debug_sprintf_event(cio_debug_msg_id, 2, "/proc/cio_ignore: '%s'\n",buffer); @@ -7491,6 +7506,7 @@ static int cio_irq_proc_init(void) __initcall(cio_irq_proc_init); /* end of procfs stuff */ +#endif schib_t *s390_get_schib( int irq ) { diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 229bad39f2c4..bdd0ac884ad7 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -983,7 +983,7 @@ int fdomain_16x0_detect( Scsi_Host_Template *tpnt ) /* Register the IRQ with the kernel */ retcode = request_irq( interrupt_level, - do_fdomain_16x0_intr, pdev?SA_SHIRQ:0, "fdomain", NULL); + do_fdomain_16x0_intr, pdev?SA_SHIRQ:0, "fdomain", shpnt); if (retcode < 0) { if (retcode == -EINVAL) { @@ -2035,6 +2035,15 @@ int fdomain_16x0_biosparam( Scsi_Disk *disk, kdev_t dev, int *info_array ) return 0; } +int fdomain_16x0_release(struct Scsi_Host *shpnt) +{ + if (shpnt->irq) + free_irq(shpnt->irq, shpnt); + if (shpnt->io_port && shpnt->n_io_port) + release_region(shpnt->io_port, shpnt->n_io_port); + +} + MODULE_LICENSE("GPL"); /* Eventually this will go into an include file, but this will be later */ diff --git a/drivers/scsi/fdomain.h b/drivers/scsi/fdomain.h index 1769d24c70e3..a85539af125b 100644 --- a/drivers/scsi/fdomain.h +++ b/drivers/scsi/fdomain.h @@ -34,6 +34,7 @@ int fdomain_16x0_queue( Scsi_Cmnd *, void (*done)(Scsi_Cmnd *) ); int fdomain_16x0_biosparam( Disk *, kdev_t, int * ); int fdomain_16x0_proc_info( char *buffer, char **start, off_t offset, int length, int hostno, int inout ); +int fdomain_16x0_release( struct Scsi_Host *shpnt ); #define FDOMAIN_16X0 { proc_info: fdomain_16x0_proc_info, \ detect: fdomain_16x0_detect, \ @@ -43,6 +44,7 @@ int fdomain_16x0_proc_info( char *buffer, char **start, off_t offset, abort: fdomain_16x0_abort, \ reset: fdomain_16x0_reset, \ bios_param: fdomain_16x0_biosparam, \ + release: fdomain_16x0_release, \ can_queue: 1, \ this_id: 6, \ sg_tablesize: 64, \ diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index ce2e2e090212..df2b302cc492 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -8626,9 +8626,9 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs) if (DEBUG_FLAGS & DEBUG_TINY) printk ("]\n"); if (done_list) { - NCR_LOCK_SCSI_DONE(np, flags); + NCR_LOCK_SCSI_DONE(done_list->host, flags); ncr_flush_done_cmds(done_list); - NCR_UNLOCK_SCSI_DONE(np, flags); + NCR_UNLOCK_SCSI_DONE(done_list->host, flags); } } @@ -8649,9 +8649,9 @@ static void ncr53c8xx_timeout(unsigned long npref) NCR_UNLOCK_NCB(np, flags); if (done_list) { - NCR_LOCK_SCSI_DONE(np, flags); + NCR_LOCK_SCSI_DONE(done_list->host, flags); ncr_flush_done_cmds(done_list); - NCR_UNLOCK_SCSI_DONE(np, flags); + NCR_UNLOCK_SCSI_DONE(done_list->host, flags); } } diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 9cd871b0ceec..aede1a6a9420 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -155,11 +155,14 @@ static struct dev_info device_list[] = {"EMC", "SYMMETRIX", "*", BLIST_SPARSELUN}, {"CMD", "CRA-7280", "*", BLIST_SPARSELUN}, // CMD RAID Controller {"CNSI", "G7324", "*", BLIST_SPARSELUN}, // Chaparral G7324 RAID + {"CNSi", "G8324", "*", BLIST_SPARSELUN}, // Chaparral G8324 RAID {"Zzyzx", "RocketStor 500S", "*", BLIST_SPARSELUN}, {"Zzyzx", "RocketStor 2000", "*", BLIST_SPARSELUN}, {"SONY", "TSL", "*", BLIST_FORCELUN}, // DDS3 & DDS4 autoloaders {"DELL", "PERCRAID", "*", BLIST_FORCELUN}, {"HP", "NetRAID-4M", "*", BLIST_FORCELUN}, + {"ADAPTEC", "AACRAID", "*", BLIST_FORCELUN}, + {"ADAPTEC", "Adaptec 5400S", "*", BLIST_FORCELUN}, /* * Must be at end of list... diff --git a/drivers/scsi/sym53c8xx_comm.h b/drivers/scsi/sym53c8xx_comm.h index ec4f1cc41c4c..9fde4ab6b910 100644 --- a/drivers/scsi/sym53c8xx_comm.h +++ b/drivers/scsi/sym53c8xx_comm.h @@ -438,10 +438,10 @@ spinlock_t DRIVER_SMP_LOCK = SPIN_LOCK_UNLOCKED; #define NCR_LOCK_NCB(np, flags) spin_lock_irqsave(&np->smp_lock, flags) #define NCR_UNLOCK_NCB(np, flags) spin_unlock_irqrestore(&np->smp_lock, flags) -#define NCR_LOCK_SCSI_DONE(np, flags) \ - spin_lock_irqsave(&io_request_lock, flags) -#define NCR_UNLOCK_SCSI_DONE(np, flags) \ - spin_unlock_irqrestore(&io_request_lock, flags) +#define NCR_LOCK_SCSI_DONE(host, flags) \ + spin_lock_irqsave(&(host)->host_lock, flags) +#define NCR_UNLOCK_SCSI_DONE(host, flags) \ + spin_unlock_irqrestore(&((host)->host_lock), flags) #else @@ -452,8 +452,8 @@ spinlock_t DRIVER_SMP_LOCK = SPIN_LOCK_UNLOCKED; #define NCR_LOCK_NCB(np, flags) do { save_flags(flags); cli(); } while (0) #define NCR_UNLOCK_NCB(np, flags) do { restore_flags(flags); } while (0) -#define NCR_LOCK_SCSI_DONE(np, flags) do {;} while (0) -#define NCR_UNLOCK_SCSI_DONE(np, flags) do {;} while (0) +#define NCR_LOCK_SCSI_DONE(host, flags) do {;} while (0) +#define NCR_UNLOCK_SCSI_DONE(host, flags) do {;} while (0) #endif diff --git a/drivers/sound/ad1848.c b/drivers/sound/ad1848.c index 32655e4c1662..c778677958e8 100644 --- a/drivers/sound/ad1848.c +++ b/drivers/sound/ad1848.c @@ -134,7 +134,7 @@ static int timer_installed = -1; static int loaded; -static int ad_format_mask[10 /*devc->model */ ] = +static int ad_format_mask[13 /*devc->model */ ] = { 0, AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW, @@ -145,7 +145,10 @@ static int ad_format_mask[10 /*devc->model */ ] = AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW | AFMT_S16_BE | AFMT_IMA_ADPCM, AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW | AFMT_S16_BE | AFMT_IMA_ADPCM, AFMT_U8 | AFMT_S16_LE /* CS4235 */, - AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW /* Ensoniq Soundscape*/ + AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW /* Ensoniq Soundscape*/, + AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW | AFMT_S16_BE | AFMT_IMA_ADPCM, + AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW | AFMT_S16_BE | AFMT_IMA_ADPCM, + AFMT_U8 | AFMT_S16_LE | AFMT_MU_LAW | AFMT_A_LAW | AFMT_S16_BE | AFMT_IMA_ADPCM }; static ad1848_info adev_info[MAX_AUDIO_DEV]; @@ -2965,6 +2968,10 @@ static struct { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('Y','M','H'), ISAPNP_FUNCTION(0x0021), 1, 0, 0, 1, 1}, + {"Advanced Gravis InterWave Audio", + ISAPNP_VENDOR('G','R','V'), ISAPNP_DEVICE(0x0001), + ISAPNP_VENDOR('G','R','V'), ISAPNP_FUNCTION(0x0000), + 0, 0, 0, 1, 0}, {0} }; @@ -2977,6 +2984,8 @@ static struct isapnp_device_id id_table[] __devinitdata = { ISAPNP_VENDOR('C','S','C'), ISAPNP_FUNCTION(0x0100), 0 }, { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('Y','M','H'), ISAPNP_FUNCTION(0x0021), 0 }, + { ISAPNP_VENDOR('G','R','V'), ISAPNP_DEVICE(0x0001), + ISAPNP_VENDOR('G','R','V'), ISAPNP_FUNCTION(0x0000), 0 }, {0} }; diff --git a/drivers/sound/msnd.c b/drivers/sound/msnd.c index f273e3d78109..b80cdf908130 100644 --- a/drivers/sound/msnd.c +++ b/drivers/sound/msnd.c @@ -39,6 +39,7 @@ # include <linux/major.h> # include <linux/fs.h> # include <linux/sound.h> +# include <asm/segment.h> # include "sound_config.h" #else # include <linux/init.h> diff --git a/drivers/sound/os.h b/drivers/sound/os.h index d0c82ded1abb..1a66e3a8441d 100644 --- a/drivers/sound/os.h +++ b/drivers/sound/os.h @@ -25,6 +25,7 @@ #include <asm/page.h> #include <asm/system.h> #ifdef __alpha__ +#include <asm/segment.h> #endif #include <linux/vmalloc.h> #include <asm/uaccess.h> diff --git a/drivers/sound/sb_card.c b/drivers/sound/sb_card.c index 221214f4ec39..779036ab0712 100644 --- a/drivers/sound/sb_card.c +++ b/drivers/sound/sb_card.c @@ -378,6 +378,11 @@ static struct { 0,0,0,0, 0,1,1,-1}, {"Sound Blaster AWE 32", + ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0047), + ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), + 0,0,0,0, + 0,1,1,-1}, + {"Sound Blaster AWE 32", ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0048), ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0,0,0,0, diff --git a/drivers/usb/usbnet.c b/drivers/usb/usbnet.c index 033ad12eb0bc..9ca8765c792e 100644 --- a/drivers/usb/usbnet.c +++ b/drivers/usb/usbnet.c @@ -1577,7 +1577,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) struct nc_trailer *trailer = 0; #endif /* CONFIG_USB_NET1080 */ - flags = in_interrupt () ? GFP_ATOMIC : GFP_KERNEL; + flags = in_interrupt () ? GFP_ATOMIC : GFP_NOIO; /* might be used for nfs */ // some devices want funky USB-level framing, for // win32 driver (usually) and/or hardware quirks diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 037979f5fc2c..b04a2879c37c 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -21,6 +21,7 @@ #include <linux/kernel.h> #include <linux/major.h> #include <linux/slab.h> +#include <linux/mm.h> #include <linux/mman.h> #include <linux/tty.h> #include <linux/console.h> diff --git a/fs/devfs/base.c b/fs/devfs/base.c index ed95451a91b2..db6ec7adfd1a 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c @@ -517,6 +517,7 @@ 20010730 Richard Gooch <rgooch@atnf.csiro.au> Added DEVFSD_NOTIFY_DELETE event. 20010801 Richard Gooch <rgooch@atnf.csiro.au> + Removed #include <asm/segment.h>. v0.109 20010807 Richard Gooch <rgooch@atnf.csiro.au> Fixed inode table races by removing it and using diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 4b88182354f8..847c9a200ea4 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -29,6 +29,8 @@ #include <asm/uaccess.h> +static void ext2_sync_super(struct super_block *sb, + struct ext2_super_block *es); static char error_buf[1024]; @@ -36,13 +38,13 @@ void ext2_error (struct super_block * sb, const char * function, const char * fmt, ...) { va_list args; + struct ext2_super_block *es = EXT2_SB(sb)->s_es; if (!(sb->s_flags & MS_RDONLY)) { sb->u.ext2_sb.s_mount_state |= EXT2_ERROR_FS; - sb->u.ext2_sb.s_es->s_state = - cpu_to_le16(le16_to_cpu(sb->u.ext2_sb.s_es->s_state) | EXT2_ERROR_FS); - mark_buffer_dirty(sb->u.ext2_sb.s_sbh); - sb->s_dirt = 1; + es->s_state = + cpu_to_le16(le16_to_cpu(es->s_state) | EXT2_ERROR_FS); + ext2_sync_super(sb, es); } va_start (args, fmt); vsprintf (error_buf, fmt, args); @@ -125,8 +127,10 @@ void ext2_put_super (struct super_block * sb) int i; if (!(sb->s_flags & MS_RDONLY)) { - sb->u.ext2_sb.s_es->s_state = le16_to_cpu(sb->u.ext2_sb.s_mount_state); - mark_buffer_dirty(sb->u.ext2_sb.s_sbh); + struct ext2_super_block *es = EXT2_SB(sb)->s_es; + + es->s_state = le16_to_cpu(EXT2_SB(sb)->s_mount_state); + ext2_sync_super(sb, es); } db_count = EXT2_SB(sb)->s_gdb_count; for (i = 0; i < db_count; i++) @@ -306,13 +310,10 @@ static int ext2_setup_super (struct super_block * sb, (le32_to_cpu(es->s_lastcheck) + le32_to_cpu(es->s_checkinterval) <= CURRENT_TIME)) printk ("EXT2-fs warning: checktime reached, " "running e2fsck is recommended\n"); - es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT2_VALID_FS); if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) es->s_max_mnt_count = (__s16) cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); - es->s_mtime = cpu_to_le32(CURRENT_TIME); - mark_buffer_dirty(sb->u.ext2_sb.s_sbh); - sb->s_dirt = 1; + ext2_write_super(sb); if (test_opt (sb, DEBUG)) printk ("[EXT II FS %s, %s, bs=%lu, fs=%lu, gc=%lu, " "bpg=%lu, ipg=%lu, mo=%04lx]\n", @@ -659,6 +660,15 @@ static void ext2_commit_super (struct super_block * sb, sb->s_dirt = 0; } +static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es) +{ + es->s_wtime = cpu_to_le32(CURRENT_TIME); + mark_buffer_dirty(EXT2_SB(sb)->s_sbh); + ll_rw_block(WRITE, 1, &EXT2_SB(sb)->s_sbh); + wait_on_buffer(EXT2_SB(sb)->s_sbh); + sb->s_dirt = 0; +} + /* * In the second extended file system, it is not necessary to * write the super block since we use a mapping of the @@ -677,13 +687,14 @@ void ext2_write_super (struct super_block * sb) if (!(sb->s_flags & MS_RDONLY)) { es = sb->u.ext2_sb.s_es; - ext2_debug ("setting valid to 0\n"); - if (le16_to_cpu(es->s_state) & EXT2_VALID_FS) { - es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT2_VALID_FS); + ext2_debug ("setting valid to 0\n"); + es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & + ~EXT2_VALID_FS); es->s_mtime = cpu_to_le32(CURRENT_TIME); - } - ext2_commit_super (sb, es); + ext2_sync_super(sb, es); + } else + ext2_commit_super (sb, es); } sb->s_dirt = 0; } @@ -720,11 +731,7 @@ int ext2_remount (struct super_block * sb, int * flags, char * data) */ es->s_state = cpu_to_le16(sb->u.ext2_sb.s_mount_state); es->s_mtime = cpu_to_le32(CURRENT_TIME); - mark_buffer_dirty(sb->u.ext2_sb.s_sbh); - sb->s_dirt = 1; - ext2_commit_super (sb, es); - } - else { + } else { int ret; if ((ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))) { @@ -742,6 +749,7 @@ int ext2_remount (struct super_block * sb, int * flags, char * data) if (!ext2_setup_super (sb, es, 0)) sb->s_flags &= ~MS_RDONLY; } + ext2_sync_super(sb, es); return 0; } diff --git a/fs/ext3/Makefile b/fs/ext3/Makefile index c64318e79abc..68cb4861815c 100644 --- a/fs/ext3/Makefile +++ b/fs/ext3/Makefile @@ -9,7 +9,7 @@ O_TARGET := ext3.o -obj-y := acl.o balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ +obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ ioctl.o namei.o super.o symlink.o obj-m := $(O_TARGET) diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c deleted file mode 100644 index f77d42047b18..000000000000 --- a/fs/ext3/acl.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * linux/fs/ext3/acl.c - * - * Copyright (C) 1993, 1994, 1995 - * Remy Card (card@masi.ibp.fr) - * Laboratoire MASI - Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - */ - -#include <linux/fs.h> -#include <linux/sched.h> - - -/* - * This file will contain the Access Control Lists management for the - * second extended file system. - */ diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 339ba65333c1..e0ad97fe3712 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -32,7 +32,6 @@ #include <linux/quotaops.h> #include <linux/module.h> - /* * SEARCH_FROM_ZERO forces each block allocation to search from the start * of the filesystem. This is to force rapid reallocation of recently-freed @@ -715,6 +714,8 @@ err_out: * reachable from inode. * * akpm: `handle' can be NULL if create == 0. + * + * The BKL may not be held on entry here. Be sure to take it early. */ static int ext3_get_block_handle(handle_t *handle, struct inode *inode, @@ -1018,13 +1019,26 @@ static int ext3_prepare_write(struct file *file, struct page *page, ret = PTR_ERR(handle); goto out; } + unlock_kernel(); ret = block_prepare_write(page, from, to, ext3_get_block); + lock_kernel(); if (ret != 0) goto prepare_write_failed; - if (ext3_should_journal_data(inode)) + if (ext3_should_journal_data(inode)) { ret = walk_page_buffers(handle, page->buffers, from, to, NULL, do_journal_get_write_access); + if (ret) { + /* + * We're going to fail this prepare_write(), + * so commit_write() will not be called. + * We need to undo block_prepare_write()'s kmap(). + * AKPM: Do we need to clear PageUptodate? I don't + * think so. + */ + kunmap(page); + } + } prepare_write_failed: if (ret) ext3_journal_stop(handle, inode); @@ -1092,7 +1106,7 @@ static int ext3_commit_write(struct file *file, struct page *page, kunmap(page); if (pos > inode->i_size) inode->i_size = pos; - set_bit(EXT3_STATE_JDATA, &inode->u.ext3_i.i_state); + EXT3_I(inode)->i_state |= EXT3_STATE_JDATA; } else { if (ext3_should_order_data(inode)) { ret = walk_page_buffers(handle, page->buffers, @@ -1100,8 +1114,17 @@ static int ext3_commit_write(struct file *file, struct page *page, } /* Be careful here if generic_commit_write becomes a * required invocation after block_prepare_write. */ - if (ret == 0) + if (ret == 0) { ret = generic_commit_write(file, page, from, to); + } else { + /* + * block_prepare_write() was called, but we're not + * going to call generic_commit_write(). So we + * need to perform generic_commit_write()'s kunmap + * by hand. + */ + kunmap(page); + } } if (inode->i_size > inode->u.ext3_i.i_disksize) { inode->u.ext3_i.i_disksize = inode->i_size; @@ -1136,7 +1159,7 @@ static int ext3_bmap(struct address_space *mapping, long block) journal_t *journal; int err; - if (test_and_clear_bit(EXT3_STATE_JDATA, &inode->u.ext3_i.i_state)) { + if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) { /* * This is a REALLY heavyweight approach, but the use of * bmap on dirty files is expected to be extremely rare: @@ -1155,6 +1178,7 @@ static int ext3_bmap(struct address_space *mapping, long block) * everything they get. */ + EXT3_I(inode)->i_state &= ~EXT3_STATE_JDATA; journal = EXT3_JOURNAL(inode); journal_lock_updates(journal); err = journal_flush(journal); @@ -2195,7 +2219,7 @@ static int ext3_do_update_inode(handle_t *handle, /* If we are not tracking these fields in the in-memory inode, * then preserve them on disk, but still initialise them to zero * for new inodes. */ - if (inode->u.ext3_i.i_state & EXT3_STATE_NEW) { + if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) { raw_inode->i_faddr = 0; raw_inode->i_frag = 0; raw_inode->i_fsize = 0; @@ -2241,7 +2265,7 @@ static int ext3_do_update_inode(handle_t *handle, rc = ext3_journal_dirty_metadata(handle, bh); if (!err) err = rc; - inode->u.ext3_i.i_state &= ~EXT3_STATE_NEW; + EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW; out_brelse: brelse (bh); @@ -2325,12 +2349,20 @@ void ext3_write_inode(struct inode *inode, int wait) int ext3_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; - int error, rc; + int error, rc = 0; + const unsigned int ia_valid = attr->ia_valid; error = inode_change_ok(inode, attr); if (error) return error; - + + if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { + error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; + if (error) + return error; + } + if (attr->ia_valid & ATTR_SIZE && attr->ia_size < inode->i_size) { handle_t *handle; @@ -2348,7 +2380,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr) ext3_journal_stop(handle, inode); } - inode_setattr(inode, attr); + rc = inode_setattr(inode, attr); /* If inode_setattr's call to ext3_truncate failed to get a * transaction handle at all, we need to clean up the in-core @@ -2358,7 +2390,9 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr) err_out: ext3_std_error(inode->i_sb, error); - return 0; + if (!error) + error = rc; + return error; } @@ -2659,6 +2693,3 @@ int ext3_change_inode_journal_flag(struct inode *inode, int val) * here, in ext3_aops_journal_start() to ensure that the forthcoming "see if we * need to extend" test in ext3_prepare_write() succeeds. */ - - -MODULE_LICENSE("GPL"); diff --git a/fs/ext3/super.c b/fs/ext3/super.c index fd82ddc4f473..5a0282393f77 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -1250,8 +1250,11 @@ static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum) } journal = journal_init_inode(journal_inode); - if (!journal) + if (!journal) { + printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); iput(journal_inode); + } + return journal; } @@ -1343,7 +1346,7 @@ static int ext3_load_journal(struct super_block * sb, journal_t *journal; int journal_inum = le32_to_cpu(es->s_journal_inum); int journal_dev = le32_to_cpu(es->s_journal_dev); - int err; + int err = 0; int really_read_only; really_read_only = is_read_only(sb->s_dev); @@ -1393,9 +1396,10 @@ static int ext3_load_journal(struct super_block * sb, } if (!EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) - journal_wipe(journal, !really_read_only); + err = journal_wipe(journal, !really_read_only); + if (!err) + err = journal_load(journal); - err = journal_load(journal); if (err) { printk(KERN_ERR "EXT3-fs: error loading journal.\n"); journal_destroy(journal); @@ -1733,6 +1737,8 @@ static void __exit exit_ext3_fs(void) EXPORT_NO_SYMBOLS; +MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); +MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions"); MODULE_LICENSE("GPL"); module_init(init_ext3_fs) module_exit(exit_ext3_fs) diff --git a/fs/inflate_fs/inflate_syms.c b/fs/inflate_fs/inflate_syms.c index 67182fa45aa9..891b3bbf2582 100644 --- a/fs/inflate_fs/inflate_syms.c +++ b/fs/inflate_fs/inflate_syms.c @@ -19,3 +19,4 @@ EXPORT_SYMBOL(zlib_fs_inflateSync); EXPORT_SYMBOL(zlib_fs_inflateReset); EXPORT_SYMBOL(zlib_fs_adler32); EXPORT_SYMBOL(zlib_fs_inflateSyncPoint); +MODULE_LICENSE("GPL"); diff --git a/fs/intermezzo/file.c b/fs/intermezzo/file.c index 1a9eae8db572..8464b2618cd4 100644 --- a/fs/intermezzo/file.c +++ b/fs/intermezzo/file.c @@ -344,7 +344,7 @@ static ssize_t presto_file_write(struct file *file, const char *buf, size_t size << file->f_dentry->d_inode->i_sb->s_blocksize_bits); error = presto_reserve_space(fset->fset_cache, res_size); - CDEBUG(D_INODE, "Reserved %Ld for %d\n", res_size, size); + CDEBUG(D_INODE, "Reserved %Ld for %Zd\n", res_size, size); if ( error ) { EXIT; return -ENOSPC; @@ -397,7 +397,7 @@ static ssize_t presto_file_write(struct file *file, const char *buf, size_t size fops = filter_c2cffops(cache->cache_filter); res = fops->write(file, buf, size, off); if ( res != size ) { - CDEBUG(D_FILE, "file write returns short write: size %d, res %d\n", size, res); + CDEBUG(D_FILE, "file write returns short write: size %Zd, res %Zd\n", size, res); } if ( (res > 0) && fdata ) diff --git a/fs/intermezzo/journal.c b/fs/intermezzo/journal.c index 11013f39672e..df8f31533479 100644 --- a/fs/intermezzo/journal.c +++ b/fs/intermezzo/journal.c @@ -1076,7 +1076,7 @@ int presto_clear_lml_close(struct presto_file_set *fset, return 0; } - CDEBUG(D_JOURNAL, "reading prefix: off %ld, size %d\n", + CDEBUG(D_JOURNAL, "reading prefix: off %ld, size %Zd\n", (long)lml_offset, sizeof(record)); rc = presto_fread(fset->fset_lml.fd_file, (char *)&record, sizeof(record), &offset); diff --git a/fs/intermezzo/psdev.c b/fs/intermezzo/psdev.c index 7c08b39340fa..9fdfedc226bb 100644 --- a/fs/intermezzo/psdev.c +++ b/fs/intermezzo/psdev.c @@ -46,6 +46,7 @@ #include <linux/poll.h> #include <linux/init.h> #include <linux/list.h> +#include <linux/termios.h> #include <asm/io.h> #include <asm/system.h> #include <asm/poll.h> @@ -176,7 +177,7 @@ static ssize_t presto_psdev_write(struct file *file, const char *buf, /* move data into response buffer. */ if (req->rq_bufsize < count) { - printk("psdev_write: too much cnt: %d, cnt: %d, " + printk("psdev_write: too much cnt: %d, cnt: %Zd, " "opc: %d, uniq: %d.\n", req->rq_bufsize, count, hdr.opcode, hdr.unique); count = req->rq_bufsize; /* don't have more space! */ @@ -209,7 +210,7 @@ static ssize_t presto_psdev_read(struct file * file, char * buf, __FUNCTION__, kdevname(dev)); } - CDEBUG(D_PSDEV, "count %d\n", count); + CDEBUG(D_PSDEV, "count %Zd\n", count); if (list_empty(&(upccom->uc_pending))) { CDEBUG(D_UPCALL, "Empty pending list in read, not good\n"); return -EINVAL; @@ -228,7 +229,7 @@ static ssize_t presto_psdev_read(struct file * file, char * buf, } if (count < req->rq_bufsize) { - printk ("psdev_read: buffer too small, read %d of %d bytes\n", + printk ("psdev_read: buffer too small, read %Zd of %d bytes\n", count, req->rq_bufsize); } @@ -281,7 +282,7 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file, error = copy_from_user(&readmount, (void *)arg, sizeof(readmount)); if ( error ) { - printk("psdev: can't copy %d bytes from %p to %p\n", + printk("psdev: can't copy %Zd bytes from %p to %p\n", sizeof(readmount), (struct readmount *) arg, &readmount); EXIT; @@ -469,7 +470,7 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file, input.size = size; upccom->uc_pid = saved_pid; - CDEBUG(D_PSDEV, "get_kmlsize: size = %d\n", size); + CDEBUG(D_PSDEV, "get_kmlsize: size = %Zd\n", size); EXIT; return copy_to_user((char *)arg, &input, sizeof(input)); @@ -621,7 +622,7 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file, error = copy_from_user(&kopt, (void *)arg, sizeof(kopt)); if ( error ) { - printk("psdev: can't copyin %d bytes from %p to %p\n", + printk("psdev: can't copyin %Zd bytes from %p to %p\n", sizeof(kopt), (struct kopt *) arg, &kopt); EXIT; return error; @@ -1244,7 +1245,7 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file, default: CDEBUG(D_PSDEV, "bad ioctl 0x%x, \n", cmd); - CDEBUG(D_PSDEV, "valid are 0x%x - 0x%x, 0x%x - 0x%x \n", + CDEBUG(D_PSDEV, "valid are 0x%Zx - 0x%Zx, 0x%Zx - 0x%Zx \n", PRESTO_GETMOUNT, PRESTO_GET_KMLSIZE, PRESTO_VFS_SETATTR, PRESTO_VFS_IOPEN); EXIT; @@ -1571,8 +1572,8 @@ int lento_upcall(int minor, int bufsize, int *rep_size, union up_args *buffer, req->rq_opcode, jiffies - req->rq_posttime, req->rq_unique, req->rq_rep_size); CDEBUG(D_UPCALL, - "..process %d woken up by Lento for req at 0x%x, data at %x\n", - current->pid, (int)req, (int)req->rq_data); + "..process %d woken up by Lento for req at 0x%p, data at %p\n", + current->pid, req, req->rq_data); if (upc_commp->uc_pid) { /* i.e. Lento is still alive */ /* Op went through, interrupt or not we go on */ diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 045b74ce9a8e..29e96b885f62 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c @@ -47,7 +47,8 @@ void journal_commit_transaction(journal_t *journal) struct buffer_head *wbuf[64]; int bufs; int flags; - int blocknr; + int err; + unsigned long blocknr; char *tagp = NULL; journal_header_t *header; journal_block_tag_t *tag = NULL; @@ -352,6 +353,11 @@ sync_datalist_empty: jbd_debug(4, "JBD: get descriptor\n"); descriptor = journal_get_descriptor_buffer(journal); + if (!descriptor) { + __journal_abort_hard(journal); + continue; + } + bh = jh2bh(descriptor); jbd_debug(4, "JBD: got buffer %ld (%p)\n", bh->b_blocknr, bh->b_data); @@ -375,7 +381,14 @@ sync_datalist_empty: /* Where is the buffer to be written? */ - blocknr = journal_next_log_block(journal); + err = journal_next_log_block(journal, &blocknr); + /* If the block mapping failed, just abandon the buffer + and repeat this loop: we'll fall into the + refile-on-abort condition above. */ + if (err) { + __journal_abort_hard(journal); + continue; + } /* Bump b_count to prevent truncate from stumbling over the shadowed buffer! @@@ This can go if we ever get @@ -554,16 +567,20 @@ start_journal_io: jbd_debug(3, "JBD: commit phase 6\n"); + if (is_journal_aborted(journal)) + goto skip_commit; + /* Done it all: now write the commit record. We should have * cleaned up our previous buffers by now, so if we are in abort * mode we can now just skip the rest of the journal write * entirely. */ - if (is_journal_aborted(journal)) - goto skip_commit; - descriptor = journal_get_descriptor_buffer(journal); - + if (!descriptor) { + __journal_abort_hard(journal); + goto skip_commit; + } + /* AKPM: buglet - add `i' to tmp! */ for (i = 0; i < jh2bh(descriptor)->b_size; i += 512) { journal_header_t *tmp = diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 2b86b94c7d9a..cf381d4fad0f 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -70,7 +70,6 @@ EXPORT_SYMBOL(journal_load); EXPORT_SYMBOL(journal_destroy); EXPORT_SYMBOL(journal_recover); EXPORT_SYMBOL(journal_update_superblock); -EXPORT_SYMBOL(__journal_abort); EXPORT_SYMBOL(journal_abort); EXPORT_SYMBOL(journal_errno); EXPORT_SYMBOL(journal_ack_err); @@ -606,7 +605,7 @@ void log_wait_commit (journal_t *journal, tid_t tid) * Log buffer allocation routines: */ -unsigned long journal_next_log_block(journal_t *journal) +int journal_next_log_block(journal_t *journal, unsigned long *retp) { unsigned long blocknr; @@ -617,7 +616,7 @@ unsigned long journal_next_log_block(journal_t *journal) journal->j_free--; if (journal->j_head == journal->j_last) journal->j_head = journal->j_first; - return journal_bmap(journal, blocknr); + return journal_bmap(journal, blocknr, retp); } /* @@ -627,17 +626,28 @@ unsigned long journal_next_log_block(journal_t *journal) * this is a no-op. If needed, we can use j_blk_offset - everything is * ready. */ -unsigned long journal_bmap(journal_t *journal, unsigned long blocknr) +int journal_bmap(journal_t *journal, unsigned long blocknr, + unsigned long *retp) { + int err = 0; unsigned long ret; if (journal->j_inode) { ret = bmap(journal->j_inode, blocknr); - J_ASSERT(ret != 0); + if (ret) + *retp = ret; + else { + printk (KERN_ALERT __FUNCTION__ + ": journal block not found " + "at offset %lu on %s\n", + blocknr, bdevname(journal->j_dev)); + err = -EIO; + __journal_abort_soft(journal, err); + } } else { - ret = blocknr; /* +journal->j_blk_offset */ + *retp = blocknr; /* +journal->j_blk_offset */ } - return ret; + return err; } /* @@ -649,7 +659,13 @@ unsigned long journal_bmap(journal_t *journal, unsigned long blocknr) struct journal_head * journal_get_descriptor_buffer(journal_t *journal) { struct buffer_head *bh; - unsigned long blocknr = journal_next_log_block(journal); + unsigned long blocknr; + int err; + + err = journal_next_log_block(journal, &blocknr); + + if (err) + return NULL; bh = getblk(journal->j_dev, blocknr, journal->j_blocksize); bh->b_state |= (1 << BH_Dirty); @@ -747,7 +763,8 @@ journal_t * journal_init_inode (struct inode *inode) { struct buffer_head *bh; journal_t *journal = journal_init_common(); - int blocknr; + int err; + unsigned long blocknr; if (!journal) return NULL; @@ -757,13 +774,22 @@ journal_t * journal_init_inode (struct inode *inode) journal->j_inode = inode; jbd_debug(1, "journal %p: inode %s/%ld, size %Ld, bits %d, blksize %ld\n", - journal, bdevname(inode->i_dev), inode->i_ino, inode->i_size, + journal, bdevname(inode->i_dev), inode->i_ino, + (long long) inode->i_size, inode->i_sb->s_blocksize_bits, inode->i_sb->s_blocksize); journal->j_maxlen = inode->i_size >> inode->i_sb->s_blocksize_bits; journal->j_blocksize = inode->i_sb->s_blocksize; - blocknr = journal_bmap(journal, 0); + err = journal_bmap(journal, 0, &blocknr); + /* If that failed, give up */ + if (err) { + printk(KERN_ERR __FUNCTION__ ": Cannnot locate journal " + "superblock\n"); + kfree(journal); + return NULL; + } + bh = getblk(journal->j_dev, blocknr, journal->j_blocksize); J_ASSERT(bh != NULL); journal->j_sb_buffer = bh; @@ -772,6 +798,18 @@ journal_t * journal_init_inode (struct inode *inode) return journal; } +/* + * If the journal init or create aborts, we need to mark the journal + * superblock as being NULL to prevent the journal destroy from writing + * back a bogus superblock. + */ +static void journal_fail_superblock (journal_t *journal) +{ + struct buffer_head *bh = journal->j_sb_buffer; + brelse(bh); + journal->j_sb_buffer = NULL; +} + /* * Given a journal_t structure, initialise the various fields for * startup of a new journaling session. We use this both when creating @@ -817,14 +855,15 @@ static int journal_reset (journal_t *journal) int journal_create (journal_t *journal) { - int blocknr; + unsigned long blocknr; struct buffer_head *bh; journal_superblock_t *sb; - int i; + int i, err; if (journal->j_maxlen < JFS_MIN_JOURNAL_BLOCKS) { printk (KERN_ERR "Journal length (%d blocks) too short.\n", journal->j_maxlen); + journal_fail_superblock(journal); return -EINVAL; } @@ -841,7 +880,9 @@ int journal_create (journal_t *journal) have any blocks on disk beginning with JFS_MAGIC_NUMBER. */ jbd_debug(1, "JBD: Zeroing out journal blocks...\n"); for (i = 0; i < journal->j_maxlen; i++) { - blocknr = journal_bmap(journal, i); + err = journal_bmap(journal, i, &blocknr); + if (err) + return err; bh = getblk(journal->j_dev, blocknr, journal->j_blocksize); wait_on_buffer(bh); memset (bh->b_data, 0, journal->j_blocksize); @@ -851,6 +892,7 @@ int journal_create (journal_t *journal) mark_buffer_uptodate(bh, 1); __brelse(bh); } + sync_dev(journal->j_dev); jbd_debug(1, "JBD: journal cleared.\n"); @@ -915,7 +957,8 @@ static int journal_get_superblock(journal_t *journal) { struct buffer_head *bh; journal_superblock_t *sb; - + int err = -EIO; + bh = journal->j_sb_buffer; J_ASSERT(bh != NULL); @@ -925,16 +968,18 @@ static int journal_get_superblock(journal_t *journal) if (!buffer_uptodate(bh)) { printk (KERN_ERR "JBD: IO error reading journal superblock\n"); - return -EIO; + goto out; } } sb = journal->j_superblock; + err = -EINVAL; + if (sb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) || sb->s_blocksize != htonl(journal->j_blocksize)) { printk(KERN_WARNING "JBD: no valid journal superblock found\n"); - return -EINVAL; + goto out; } switch(ntohl(sb->s_header.h_blocktype)) { @@ -946,17 +991,21 @@ static int journal_get_superblock(journal_t *journal) break; default: printk(KERN_WARNING "JBD: unrecognised superblock format ID\n"); - return -EINVAL; + goto out; } if (ntohl(sb->s_maxlen) < journal->j_maxlen) journal->j_maxlen = ntohl(sb->s_maxlen); else if (ntohl(sb->s_maxlen) > journal->j_maxlen) { printk (KERN_WARNING "JBD: journal file too short\n"); - return -EINVAL; + goto out; } return 0; + +out: + journal_fail_superblock(journal); + return err; } /* @@ -1061,7 +1110,10 @@ void journal_destroy (journal_t *journal) /* We can now mark the journal as empty. */ journal->j_tail = 0; journal->j_tail_sequence = ++journal->j_transaction_sequence; - journal_update_superblock(journal, 1); + if (journal->j_sb_buffer) { + journal_update_superblock(journal, 1); + brelse(journal->j_sb_buffer); + } if (journal->j_inode) iput(journal->j_inode); @@ -1069,7 +1121,6 @@ void journal_destroy (journal_t *journal) journal_destroy_revoke(journal); unlock_journal(journal); - brelse(journal->j_sb_buffer); kfree(journal); MOD_DEC_USE_COUNT; } @@ -1356,11 +1407,16 @@ const char * journal_dev_name(journal_t *journal) * progress). */ -/* Quick version for internal journal use (doesn't lock the journal) */ -void __journal_abort (journal_t *journal) +/* Quick version for internal journal use (doesn't lock the journal). + * Aborts hard --- we mark the abort as occurred, but do _nothing_ else, + * and don't attempt to make any other journal updates. */ +void __journal_abort_hard (journal_t *journal) { transaction_t *transaction; + if (journal->j_flags & JFS_ABORT) + return; + printk (KERN_ERR "Aborting journal on device %s.\n", journal_dev_name(journal)); @@ -1370,23 +1426,27 @@ void __journal_abort (journal_t *journal) log_start_commit(journal, transaction); } -/* Full version for external use */ -void journal_abort (journal_t *journal, int errno) +/* Soft abort: record the abort error status in the journal superblock, + * but don't do any other IO. */ +void __journal_abort_soft (journal_t *journal, int errno) { - lock_journal(journal); - if (journal->j_flags & JFS_ABORT) - goto out; + return; if (!journal->j_errno) journal->j_errno = errno; - __journal_abort(journal); + __journal_abort_hard(journal); if (errno) journal_update_superblock(journal, 1); +} - out: +/* Full version for external use */ +void journal_abort (journal_t *journal, int errno) +{ + lock_journal(journal); + __journal_abort_soft(journal, errno); unlock_journal(journal); } diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index 491dc6cb6dc8..e8e416306aed 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c @@ -70,7 +70,8 @@ void journal_brelse_array(struct buffer_head *b[], int n) static int do_readahead(journal_t *journal, unsigned int start) { int err; - unsigned int max, nbufs, next, blocknr; + unsigned int max, nbufs, next; + unsigned long blocknr; struct buffer_head *bh; struct buffer_head * bufs[MAXBUF]; @@ -86,12 +87,11 @@ static int do_readahead(journal_t *journal, unsigned int start) nbufs = 0; for (next = start; next < max; next++) { - blocknr = journal_bmap(journal, next); + err = journal_bmap(journal, next, &blocknr); - if (!blocknr) { + if (err) { printk (KERN_ERR "JBD: bad block at offset %u\n", next); - err = -EIO; goto failed; } @@ -132,19 +132,20 @@ failed: static int jread(struct buffer_head **bhp, journal_t *journal, unsigned int offset) { - unsigned int blocknr; + int err; + unsigned long blocknr; struct buffer_head *bh; *bhp = NULL; J_ASSERT (offset < journal->j_maxlen); - blocknr = journal_bmap(journal, offset); + err = journal_bmap(journal, offset, &blocknr); - if (!blocknr) { + if (err) { printk (KERN_ERR "JBD: bad block at offset %u\n", offset); - return -EIO; + return err; } bh = getblk(journal->j_dev, blocknr, journal->j_blocksize); diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index 8feb8aae82a1..01b7684e9472 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c @@ -495,6 +495,8 @@ static void write_one_revoke_record(journal_t *journal, if (!descriptor) { descriptor = journal_get_descriptor_buffer(journal); + if (!descriptor) + return; header = (journal_header_t *) &jh2bh(descriptor)->b_data[0]; header->h_magic = htonl(JFS_MAGIC_NUMBER); header->h_blocktype = htonl(JFS_REVOKE_BLOCK); diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index a254c2ce3536..10b54892de6a 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c @@ -1058,21 +1058,6 @@ int journal_dirty_data (handle_t *handle, struct buffer_head *bh, int async) JBUFFER_TRACE(jh, "not on a transaction"); __journal_file_buffer(jh, handle->h_transaction, wanted_jlist); } - /* - * We need to mark the buffer dirty and refile it inside the lock to - * protect it from release by journal_try_to_free_buffer() - * - * We set ->b_flushtime to something small enough to typically keep - * kupdate away from the buffer. - * - * We don't need to do a balance_dirty() - __block_commit_write() - * does that. - */ - if (!async && !atomic_set_buffer_dirty(jh2bh(jh))) { - jh2bh(jh)->b_flushtime = - jiffies + journal->j_commit_interval + 1 * HZ; - refile_buffer(jh2bh(jh)); - } no_journal: spin_unlock(&journal_datalist_lock); if (need_brelse) { @@ -1604,8 +1589,6 @@ static int __journal_try_to_free_buffer(struct buffer_head *bh, assert_spin_locked(&journal_datalist_lock); - if (!buffer_jbd(bh)) - return 1; jh = bh2jh(bh); if (buffer_locked(bh) || buffer_dirty(bh)) { diff --git a/fs/minix/inode.c b/fs/minix/inode.c index b55585988875..42fd4f97ceb2 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -208,7 +208,7 @@ static struct super_block *minix_read_super(struct super_block *s, void *data, /* set up enough so that it can read an inode */ s->s_op = &minix_sops; root_inode = iget(s, MINIX_ROOT_INO); - if (!root_inode) + if (!root_inode || is_bad_inode(root_inode)) goto out_no_root; s->s_root = d_alloc_root(root_inode); @@ -347,8 +347,10 @@ static void V1_minix_read_inode(struct inode * inode) int i; raw_inode = minix_V1_raw_inode(inode->i_sb, inode->i_ino, &bh); - if (!raw_inode) + if (!raw_inode) { + make_bad_inode(inode); return; + } inode->i_mode = raw_inode->i_mode; inode->i_uid = (uid_t)raw_inode->i_uid; inode->i_gid = (gid_t)raw_inode->i_gid; @@ -372,8 +374,10 @@ static void V2_minix_read_inode(struct inode * inode) int i; raw_inode = minix_V2_raw_inode(inode->i_sb, inode->i_ino, &bh); - if (!raw_inode) + if (!raw_inode) { + make_bad_inode(inode); return; + } inode->i_mode = raw_inode->i_mode; inode->i_uid = (uid_t)raw_inode->i_uid; inode->i_gid = (gid_t)raw_inode->i_gid; diff --git a/fs/msdos/msdosfs_syms.c b/fs/msdos/msdosfs_syms.c index 7b578f00fe74..38b2e0d6c70a 100644 --- a/fs/msdos/msdosfs_syms.c +++ b/fs/msdos/msdosfs_syms.c @@ -40,3 +40,4 @@ static void __exit exit_msdos_fs(void) module_init(init_msdos_fs) module_exit(exit_msdos_fs) +MODULE_LICENSE("GPL"); diff --git a/fs/namespace.c b/fs/namespace.c index b9e023654882..093ed8ef6dcf 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -24,6 +24,7 @@ struct vfsmount *do_kern_mount(const char *type, int flags, char *name, void *data); int do_remount_sb(struct super_block *sb, int flags, void * data); void kill_super(struct super_block *sb); +int __init init_rootfs(void); static struct list_head *mount_hashtable; static int hash_mask, hash_bits; diff --git a/fs/sysv/ChangeLog b/fs/sysv/ChangeLog index 399e917d9d2a..5066d29b5101 100644 --- a/fs/sysv/ChangeLog +++ b/fs/sysv/ChangeLog @@ -1,3 +1,12 @@ +Sat Dec 15 2001 Christoph Hellwig <hch@caldera.de> + + * inode.c (sysv_read_inode): Mark inode as bad in case of failure. + * super.c (complete_read_super): Check for bad root inode. + +Wed Nov 21 2001 Andrew Morton <andrewm@uow.edu.au> + + * file.c (sysv_sync_file): Call fsync_inode_data_buffers. + Fri Oct 26 2001 Christoph Hellwig <hch@caldera.de> * dir.c, ialloc.c, namei.c, include/linux/sysv_fs_i.h: diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 6233aecba88a..d1ee3e89567d 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c @@ -152,13 +152,13 @@ static void sysv_read_inode(struct inode *inode) printk("Bad inode number on dev %s" ": %d is out of range\n", kdevname(inode->i_dev), ino); - return; + goto bad_inode; } raw_inode = sysv_raw_inode(sb, ino, &bh); if (!raw_inode) { printk("Major problem: unable to read inode from dev %s\n", bdevname(inode->i_dev)); - return; + goto bad_inode; } /* SystemV FS: kludge permissions if ino==SYSV_ROOT_INO ?? */ inode->i_mode = fs16_to_cpu(sb, raw_inode->i_mode); @@ -178,6 +178,11 @@ static void sysv_read_inode(struct inode *inode) rdev = (u16)fs32_to_cpu(sb, inode->u.sysv_i.i_data[0]); inode->u.sysv_i.i_dir_start_lookup = 0; sysv_set_inode(inode, rdev); + return; + +bad_inode: + make_bad_inode(inode); + return; } static struct buffer_head * sysv_update_inode(struct inode * inode) diff --git a/fs/sysv/super.c b/fs/sysv/super.c index 55ef24a7740a..3f856ead1dfc 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c @@ -323,7 +323,7 @@ static int complete_read_super(struct super_block *sb, int silent, int size) /* set up enough so that it can read an inode */ sb->s_op = &sysv_sops; root_inode = iget(sb,SYSV_ROOT_INO); - if (!root_inode) { + if (!root_inode || is_bad_inode(root_inode)) { printk("SysV FS: get root inode failed\n"); return 0; } diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 5d77d4c86fef..d2d009aeeb6c 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -486,13 +486,13 @@ void ufs_read_inode (struct inode * inode) if (inode->i_ino < UFS_ROOTINO || inode->i_ino > (uspi->s_ncg * uspi->s_ipg)) { ufs_warning (sb, "ufs_read_inode", "bad inode number (%lu)\n", inode->i_ino); - return; + goto bad_inode; } bh = sb_bread(sb, uspi->s_sbbase + ufs_inotofsba(inode->i_ino)); if (!bh) { ufs_warning (sb, "ufs_read_inode", "unable to read inode %lu\n", inode->i_ino); - return; + goto bad_inode; } ufs_inode = (struct ufs_inode *) (bh->b_data + sizeof(struct ufs_inode) * ufs_inotofsbo(inode->i_ino)); @@ -557,6 +557,11 @@ void ufs_read_inode (struct inode * inode) brelse (bh); UFSD(("EXIT\n")) + return; + +bad_inode: + make_bad_inode(inode); + return; } static int ufs_update_inode(struct inode * inode, int do_sync) diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 203b51af50b5..309f4b656eff 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -442,6 +442,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data, struct ufs_super_block_second * usb2; struct ufs_super_block_third * usb3; struct ufs_buffer_head * ubh; + struct inode *inode; unsigned block_size, super_block_size; unsigned flags; @@ -787,7 +788,13 @@ magic_found: fs32_to_cpu(sb, usb3->fs_u2.fs_44.fs_maxsymlinklen); sb->u.ufs_sb.s_flags = flags; - sb->s_root = d_alloc_root(iget(sb, UFS_ROOTINO)); + + inode = iget(sb, UFS_ROOTINO); + if (!inode || is_bad_inode(inode)) + goto failed; + sb->s_root = d_alloc_root(inode); + if (!sb->s_root) + goto dalloc_failed; /* @@ -800,6 +807,8 @@ magic_found: UFSD(("EXIT\n")) return(sb); +dalloc_failed: + iput(inode); failed: if (ubh) ubh_brelse_uspi (uspi); if (uspi) kfree (uspi); diff --git a/fs/vfat/vfatfs_syms.c b/fs/vfat/vfatfs_syms.c index 378c2edfdc93..2feb1222db34 100644 --- a/fs/vfat/vfatfs_syms.c +++ b/fs/vfat/vfatfs_syms.c @@ -33,3 +33,4 @@ static void __exit exit_vfat_fs(void) module_init(init_vfat_fs) module_exit(exit_vfat_fs) +MODULE_LICENSE("GPL"); diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h index 598edbdafebe..0cf51b706133 100644 --- a/include/asm-i386/cpufeature.h +++ b/include/asm-i386/cpufeature.h @@ -40,6 +40,7 @@ #define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */ #define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */ #define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */ +#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */ #define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */ #define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */ diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index 11bcb7f29e42..d3f23faa638a 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h @@ -81,6 +81,7 @@ #define MSR_K7_EVNTSEL0 0xC0010000 #define MSR_K7_PERFCTR0 0xC0010004 +#define MSR_K7_HWCR 0xC0010015 /* Centaur-Hauls/IDT defined MSRs. */ #define MSR_IDT_FCR1 0x107 diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index bc76210eabc0..ce81f42c9b08 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h @@ -57,6 +57,9 @@ extern unsigned long phys_cpu_present_map; extern unsigned long cpu_online_map; extern volatile unsigned long smp_invalidate_needed; extern int pic_mode; +extern int smp_num_siblings; +extern int cpu_sibling_map[]; + extern void smp_flush_tlb(void); extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); extern void smp_send_reschedule(int cpu); diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index f227747b2c58..db5de1462107 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h @@ -36,8 +36,8 @@ /* * The second extended file system version */ -#define EXT3FS_DATE "06 Nov 2001" -#define EXT3FS_VERSION "2.4-0.9.15" +#define EXT3FS_DATE "02 Dec 2001" +#define EXT3FS_VERSION "2.4-0.9.16" /* * Debug code @@ -577,10 +577,6 @@ struct ext3_dir_entry_2 { ~EXT3_DIR_ROUND) #ifdef __KERNEL__ - -/* Filesize hard limits for 64-bit file offsets */ -extern long long ext3_max_sizes[]; - /* * Describe an inode's exact location on disk and in memory */ @@ -603,9 +599,6 @@ struct ext3_iloc # define ATTRIB_NORET __attribute__((noreturn)) # define NORET_AND noreturn, -/* acl.c */ -extern int ext3_permission (struct inode *, int); - /* balloc.c */ extern int ext3_bg_has_super(struct super_block *sb, int group); extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); @@ -619,16 +612,10 @@ extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, unsigned int block_group, struct buffer_head ** bh); -/* bitmap.c */ -extern unsigned long ext3_count_free (struct buffer_head *, unsigned); - /* dir.c */ extern int ext3_check_dir_entry(const char *, struct inode *, struct ext3_dir_entry_2 *, struct buffer_head *, unsigned long); - -/* file.c */ - /* fsync.c */ extern int ext3_sync_file (struct file *, struct dentry *, int); @@ -638,9 +625,9 @@ extern void ext3_free_inode (handle_t *, struct inode *); extern struct inode * ext3_orphan_get (struct super_block *, ino_t); extern unsigned long ext3_count_free_inodes (struct super_block *); extern void ext3_check_inodes_bitmap (struct super_block *); +extern unsigned long ext3_count_free (struct buffer_head *, unsigned); /* inode.c */ - extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); @@ -654,13 +641,13 @@ extern int ext3_sync_inode (handle_t *, struct inode *); extern void ext3_discard_prealloc (struct inode *); extern void ext3_dirty_inode(struct inode *); extern int ext3_change_inode_journal_flag(struct inode *, int); +extern void ext3_truncate (struct inode *); /* ioctl.c */ extern int ext3_ioctl (struct inode *, struct file *, unsigned int, unsigned long); /* namei.c */ -extern struct inode_operations ext3_dir_inode_operations; extern int ext3_orphan_add(handle_t *, struct inode *); extern int ext3_orphan_del(handle_t *, struct inode *); @@ -684,9 +671,6 @@ extern int ext3_remount (struct super_block *, int *, char *); extern struct super_block * ext3_read_super (struct super_block *,void *,int); extern int ext3_statfs (struct super_block *, struct statfs *); -/* truncate.c */ -extern void ext3_truncate (struct inode *); - #define ext3_std_error(sb, errno) \ do { \ if ((errno)) \ @@ -705,10 +689,15 @@ extern struct file_operations ext3_dir_operations; extern struct inode_operations ext3_file_inode_operations; extern struct file_operations ext3_file_operations; +/* inode.c */ +extern struct address_space_operations ext3_aops; + +/* namei.c */ +extern struct inode_operations ext3_dir_inode_operations; + /* symlink.c */ extern struct inode_operations ext3_fast_symlink_inode_operations; -extern struct address_space_operations ext3_aops; #endif /* __KERNEL__ */ diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index 9e4002b52b51..88bb8a516bf6 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h @@ -196,9 +196,22 @@ __ext3_journal_dirty_metadata(const char *where, */ static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) { + journal_t *journal; + if (inode->i_sb->s_flags & MS_RDONLY) return ERR_PTR(-EROFS); - return journal_start(EXT3_JOURNAL(inode), nblocks); + + /* Special case here: if the journal has aborted behind our + * backs (eg. EIO in the commit thread), then we still need to + * take the FS itself readonly cleanly. */ + journal = EXT3_JOURNAL(inode); + if (is_journal_aborted(journal)) { + ext3_abort(inode->i_sb, __FUNCTION__, + "Detected aborted journal"); + return ERR_PTR(-EROFS); + } + + return journal_start(journal, nblocks); } static inline handle_t * diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 5de8528ef196..2cb980fbb6d5 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -221,7 +221,7 @@ void buffer_assertion_failure(struct buffer_head *bh); #endif #else -#define J_ASSERT(assert) +#define J_ASSERT(assert) do { } while (0) #endif /* JBD_ASSERTIONS */ enum jbd_state_bits { @@ -564,7 +564,7 @@ extern void __journal_clean_data_list(transaction_t *transaction); /* Log buffer allocation */ extern struct journal_head * journal_get_descriptor_buffer(journal_t *); -extern unsigned long journal_next_log_block(journal_t *); +int journal_next_log_block(journal_t *, unsigned long *); /* Commit management */ extern void journal_commit_transaction(journal_t *); @@ -664,15 +664,16 @@ extern int journal_load (journal_t *journal); extern void journal_destroy (journal_t *); extern int journal_recover (journal_t *journal); extern int journal_wipe (journal_t *, int); -extern int journal_skip_recovery (journal_t *); -extern void journal_update_superblock (journal_t *, int); -extern void __journal_abort (journal_t *); +extern int journal_skip_recovery (journal_t *); +extern void journal_update_superblock (journal_t *, int); +extern void __journal_abort_hard (journal_t *); +extern void __journal_abort_soft (journal_t *, int); extern void journal_abort (journal_t *, int); extern int journal_errno (journal_t *); extern void journal_ack_err (journal_t *); extern int journal_clear_err (journal_t *); -extern unsigned long journal_bmap(journal_t *journal, unsigned long blocknr); -extern int journal_force_commit(journal_t *journal); +extern int journal_bmap(journal_t *, unsigned long, unsigned long *); +extern int journal_force_commit(journal_t *); /* * journal_head management diff --git a/include/linux/sched.h b/include/linux/sched.h index 1c4c54498d60..e40bddbba7cd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -433,6 +433,7 @@ struct task_struct { #define PF_MEMALLOC 0x00000800 /* Allocating memory */ #define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */ #define PF_FREE_PAGES 0x00002000 /* per process page freeing */ +#define PF_NOIO 0x00004000 /* avoid generating further I/O */ #define PF_USEDFPU 0x00100000 /* task used FPU this quantum (SMP) */ diff --git a/kernel/sched.c b/kernel/sched.c index 757edd23d6b3..1de65396fee7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -265,6 +265,21 @@ send_now_idle: * a problem. */ if (tsk == idle_task(cpu)) { +#if defined(__i386__) && defined(CONFIG_SMP) + /* + * Check if two siblings are idle in the same + * physical package. Use them if found. + */ + if (smp_num_siblings == 2) { + if (cpu_curr(cpu_sibling_map[cpu]) == + idle_task(cpu_sibling_map[cpu])) { + oldest_idle = last_schedule(cpu); + target_tsk = tsk; + break; + } + + } +#endif if (last_schedule(cpu) < oldest_idle) { oldest_idle = last_schedule(cpu); target_tsk = tsk; diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 5aef0ff33926..281dfaec5f1e 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -5,7 +5,7 @@ * * PACKET - implements raw packet sockets. * - * Version: $Id: af_packet.c,v 1.57 2001/10/30 03:38:37 davem Exp $ + * Version: $Id: af_packet.c,v 1.58 2001/11/28 21:02:10 davem Exp $ * * Authors: Ross Biro, <bir7@leland.Stanford.Edu> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> @@ -1902,3 +1902,4 @@ static int __init packet_init(void) module_init(packet_init); module_exit(packet_exit); +MODULE_LICENSE("GPL"); diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 1139ca7bbb2e..b58338f52f06 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c @@ -75,6 +75,7 @@ #include <../drivers/net/syncppp.h> #else + #include <asm/segment.h> /* kernel <-> user copy */ #endif #define KMEM_SAFETYZONE 8 diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c index d90a2d0f4cc2..14cf0257f28c 100644 --- a/net/wanrouter/wanproc.c +++ b/net/wanrouter/wanproc.c @@ -40,6 +40,7 @@ #define PROC_STATS_FORMAT "%30s: %12lu\n" #else #define PROC_STATS_FORMAT "%30s: %12u\n" + #include <asm/segment.h> /* kernel <-> user copy */ #endif |
