Commit 9c2dd1d4 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.3.30

parent 0c7791db
......@@ -22,15 +22,15 @@
#include <linux/random.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/bitops.h>
#include <asm/machvec.h>
#include <asm/spinlock.h>
#include "proto.h"
#include "irq_impl.h"
#define vulp volatile unsigned long *
#define vuip volatile unsigned int *
......@@ -182,7 +182,8 @@ srm_device_interrupt(unsigned long vector, struct pt_regs * regs)
*/
static struct irqaction timer_irq = { NULL, 0, 0, NULL, NULL, NULL};
static struct irqaction *irq_action[NR_IRQS];
spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { [0 ... NR_IRQS-1] = {0,} };
static inline void
......@@ -230,12 +231,7 @@ enable_irq(unsigned int irq_nr)
int
check_irq(unsigned int irq)
{
struct irqaction **p;
p = irq_action + irq;
if (*p == NULL)
return 0;
return -EBUSY;
return irq_desc[irq].action ? -EBUSY : 0;
}
int
......@@ -253,7 +249,7 @@ request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
if (!handler)
return -EINVAL;
p = irq_action + irq;
p = &irq_desc[irq].action;
action = *p;
if (action) {
/* Can't share interrupts unless both agree to */
......@@ -314,14 +310,14 @@ free_irq(unsigned int irq, void *dev_id)
printk("Trying to free reserved IRQ %d\n", irq);
return;
}
for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) {
for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) {
if (action->dev_id != dev_id)
continue;
/* Found it - now free it */
save_and_cli(flags);
*p = action->next;
if (!irq[irq_action])
if (!irq_desc[irq].action)
mask_irq(irq);
restore_flags(flags);
kfree(action);
......@@ -344,7 +340,7 @@ int get_irq_list(char *buf)
#endif
for (i = 0; i < NR_IRQS; i++) {
action = irq_action[i];
action = irq_desc[i].action;
if (!action)
continue;
p += sprintf(p, "%3d: ",i);
......@@ -541,63 +537,6 @@ __global_restore_flags(unsigned long flags)
}
}
#undef INIT_STUCK
#define INIT_STUCK (1<<26)
#undef STUCK
#define STUCK \
if (!--stuck) { \
printk("irq_enter stuck (irq=%d, cpu=%d, global=%d)\n", \
irq, cpu, global_irq_holder); \
stuck = INIT_STUCK; \
}
#undef VERBOSE_IRQLOCK_DEBUGGING
void
irq_enter(int cpu, int irq)
{
#ifdef VERBOSE_IRQLOCK_DEBUGGING
extern void smp_show_backtrace_all_cpus(void);
#endif
int stuck = INIT_STUCK;
hardirq_enter(cpu, irq);
barrier();
while (spin_is_locked(&global_irq_lock)) {
if (cpu == global_irq_holder) {
int globl_locked = spin_is_locked(&global_irq_lock);
int globl_icount = atomic_read(&global_irq_count);
int local_count = local_irq_count(cpu);
/* It is very important that we load the state
variables before we do the first call to
printk() as printk() could end up changing
them... */
printk("CPU[%d]: where [%p] glocked[%d] gicnt[%d]"
" licnt[%d]\n",
cpu, previous_irqholder, globl_locked,
globl_icount, local_count);
#ifdef VERBOSE_IRQLOCK_DEBUGGING
printk("Performing backtrace on all CPUs,"
" write this down!\n");
smp_show_backtrace_all_cpus();
#endif
break;
}
STUCK;
barrier();
}
}
void
irq_exit(int cpu, int irq)
{
hardirq_exit(cpu, irq);
release_irqlock(cpu);
}
static void
show(char * str, void *where)
{
......@@ -698,12 +637,6 @@ synchronize_irq(void)
}
#endif
}
#else /* !__SMP__ */
#define irq_enter(cpu, irq) (++local_irq_count(cpu))
#define irq_exit(cpu, irq) (--local_irq_count(cpu))
#endif /* __SMP__ */
static void
......@@ -720,7 +653,7 @@ unexpected_irq(int irq, struct pt_regs * regs)
printk("PC = %016lx PS=%04lx\n", regs->pc, regs->ps);
printk("Expecting: ");
for (i = 0; i < ACTUAL_NR_IRQS; i++)
if ((action = irq_action[i]))
if ((action = irq_desc[i].action))
while (action->handler) {
printk("[%s:%d] ", action->name, i);
action = action->next;
......@@ -774,7 +707,7 @@ handle_irq(int irq, int ack, struct pt_regs * regs)
irq_enter(cpu, irq);
kstat.irqs[cpu][irq] += 1;
action = irq_action[irq];
action = irq_desc[irq].action;
/*
* For normal interrupts, we mask it out, and then ACK it.
......@@ -823,7 +756,7 @@ probe_irq_on(void)
if (!(PROBE_MASK & (1UL << i))) {
continue;
}
action = irq_action[i];
action = irq_desc[i].action;
if (!action) {
enable_irq(i);
irqs |= (1UL << i);
......
......@@ -57,11 +57,32 @@ quirk_isa_bridge(struct pci_dev *dev)
dev->class = PCI_CLASS_BRIDGE_ISA;
}
static void __init
quirk_vga_enable_rom(struct pci_dev *dev)
{
/* If it's a VGA, enable its BIOS ROM at C0000.
But if its a Cirrus 543x/544x DISABLE it, since
enabling ROM disables the memory... */
if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA &&
/* But if its a Cirrus 543x/544x DISABLE it */
(dev->vendor != PCI_VENDOR_ID_CIRRUS ||
(dev->device < 0x00a0) || (dev->device > 0x00ac)))
{
u32 reg;
pci_read_config_dword(dev, dev->rom_base_reg, &reg);
reg |= PCI_ROM_ADDRESS_ENABLE;
pci_write_config_dword(dev, dev->rom_base_reg, reg);
dev->resource[PCI_ROM_RESOURCE].flags |= PCI_ROM_ADDRESS_ENABLE;
}
}
struct pci_fixup pcibios_fixups[] __initdata = {
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375,
quirk_eisa_bridge },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378,
quirk_isa_bridge },
{ PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, quirk_vga_enable_rom },
{ 0 }
};
......@@ -71,7 +92,7 @@ struct pci_fixup pcibios_fixups[] __initdata = {
#define MB (1024*KB)
#define GB (1024*MB)
void __init
void
pcibios_align_resource(void *data, struct resource *res, unsigned long size)
{
struct pci_dev * dev = data;
......@@ -145,13 +166,13 @@ pcibios_align_resource(void *data, struct resource *res, unsigned long size)
static void __init
pcibios_assign_special(struct pci_dev * dev)
{
int i;
/* The first three resources of an IDE controler are often magic,
so leave them unchanged. This is true, for instance, of the
Contaq 82C693 as seen on SX164 and DP264. */
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE) {
int i;
/* Resource 1 of IDE controller is the address of HD_CMD
register which actually occupies a single byte (0x3f6
for ide0) in reported 0x3f4-3f7 range. We have to fix
......@@ -163,6 +184,16 @@ pcibios_assign_special(struct pci_dev * dev)
if (dev->resource[i].flags && dev->resource[i].start)
pci_claim_resource(dev, i);
}
/*
* We don't have code that will init the CYPRESS bridge correctly
* so we do the next best thing, and depend on the previous
* console code to do the right thing, and ignore it here... :-\
*/
else if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
for (i = 0; i < PCI_NUM_RESOURCES; i++)
if (dev->resource[i].flags && dev->resource[i].start)
pci_claim_resource(dev, i);
}
......
......@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/irq.h>
#include <asm/hwrpb.h>
#include <asm/ptrace.h>
......@@ -32,7 +33,6 @@
#include <asm/unistd.h>
#include "proto.h"
#include "irq_impl.h"
#define DEBUG_SMP 0
......@@ -47,8 +47,8 @@ struct cpuinfo_alpha cpu_data[NR_CPUS];
/* A collection of single bit ipi messages. */
static struct {
unsigned long bits __cacheline_aligned;
} ipi_data[NR_CPUS];
unsigned long bits ____cacheline_aligned;
} ipi_data[NR_CPUS] __cacheline_aligned;
enum ipi_message_type {
IPI_RESCHEDULE,
......@@ -56,7 +56,7 @@ enum ipi_message_type {
IPI_CPU_STOP,
};
spinlock_t kernel_flag __cacheline_aligned = SPIN_LOCK_UNLOCKED;
spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
/* Set to a secondary's cpuid when it comes online. */
static unsigned long smp_secondary_alive;
......
......@@ -27,7 +27,7 @@
#include <asm/core_cia.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -31,7 +31,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -298,7 +298,6 @@ struct alpha_machine_vector eb164_mv __initmv = {
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: cabriolet_map_irq,
pci_swizzle: common_swizzle,
};
......@@ -327,7 +326,6 @@ struct alpha_machine_vector eb66p_mv __initmv = {
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: eb66p_map_irq,
pci_swizzle: common_swizzle,
};
......@@ -356,7 +354,6 @@ struct alpha_machine_vector lx164_mv __initmv = {
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: alphapc164_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle,
};
......@@ -385,7 +382,6 @@ struct alpha_machine_vector pc164_mv __initmv = {
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: alphapc164_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -27,7 +27,7 @@
#include <asm/hwrpb.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -39,28 +39,30 @@
static void
dp264_update_irq_hw(unsigned long irq, unsigned long mask, int unmask_p)
{
if (irq >= 16) {
volatile unsigned long *csr;
volatile unsigned long *csr;
if (TSUNAMI_bootcpu < 2)
if (!TSUNAMI_bootcpu)
csr = &TSUNAMI_cchip->dim0.csr;
else
csr = &TSUNAMI_cchip->dim1.csr;
if (TSUNAMI_bootcpu < 2) {
if (!TSUNAMI_bootcpu)
csr = &TSUNAMI_cchip->dim0.csr;
else
if (TSUNAMI_bootcpu == 2)
csr = &TSUNAMI_cchip->dim2.csr;
else
csr = &TSUNAMI_cchip->dim3.csr;
*csr = ~mask;
mb();
*csr;
csr = &TSUNAMI_cchip->dim1.csr;
} else {
if (TSUNAMI_bootcpu == 2)
csr = &TSUNAMI_cchip->dim2.csr;
else
csr = &TSUNAMI_cchip->dim3.csr;
}
*csr = ~mask;
mb();
*csr;
if (irq < 16) {
if (irq >= 8)
outb(mask >> 8, 0xA1); /* ISA PIC2 */
else
outb(mask, 0x21); /* ISA PIC1 */
}
else if (irq >= 8)
outb(mask >> 8, 0xA1); /* ISA PIC2 */
else
outb(mask, 0x21); /* ISA PIC1 */
}
static void
......@@ -274,8 +276,19 @@ dp264_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
struct pci_controler *hose = dev->sysdata;
int irq = COMMON_TABLE_LOOKUP;
if (irq > 0)
if (irq > 0) {
irq += 16 * hose->index;
} else {
/* ??? The Contaq IDE controler on the ISA bridge uses
"legacy" interrupts 14 and 15. I don't know if anything
can wind up at the same slot+pin on hose1, so we'll
just have to trust whatever value the console might
have assigned. */
u8 irq8;
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq8);
irq = irq8;
}
return irq;
}
......
......@@ -28,7 +28,7 @@
#include <asm/core_lca.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -212,7 +212,6 @@ struct alpha_machine_vector eb66_mv __initmv = {
init_irq: eb64p_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: eb64p_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -29,7 +29,7 @@
#include <asm/hwrpb.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -28,7 +28,7 @@
#include <asm/pgtable.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "machvec_impl.h"
......
......@@ -25,7 +25,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -28,7 +28,7 @@
#include <asm/core_cia.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -223,7 +223,6 @@ struct alpha_machine_vector mikasa_primo_mv __initmv = {
init_irq: mikasa_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: mikasa_map_irq,
pci_swizzle: common_swizzle,
};
......
......@@ -45,7 +45,7 @@
#include <asm/hwrpb.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -29,7 +29,7 @@
#include <asm/core_cia.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -283,7 +283,6 @@ struct alpha_machine_vector noritake_primo_mv __initmv = {
init_irq: noritake_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: noritake_map_irq,
pci_swizzle: noritake_swizzle,
};
......
......@@ -25,7 +25,7 @@
#include <asm/core_mcpcia.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -26,7 +26,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -26,7 +26,7 @@
#include <asm/core_polaris.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -26,7 +26,7 @@
#include <asm/core_t2.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -283,7 +283,6 @@ struct alpha_machine_vector sable_gamma_mv __initmv = {
init_irq: sable_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: sable_map_irq,
pci_swizzle: common_swizzle,
......
......@@ -30,7 +30,7 @@
#include <asm/core_lca.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......@@ -359,7 +359,6 @@ struct alpha_machine_vector avanti_mv __initmv = {
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
......@@ -392,7 +391,6 @@ struct alpha_machine_vector noname_mv __initmv = {
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
......@@ -434,7 +432,6 @@ struct alpha_machine_vector p2k_mv __initmv = {
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: p2k_map_irq,
pci_swizzle: common_swizzle,
......@@ -467,7 +464,6 @@ struct alpha_machine_vector xl_mv __initmv = {
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
......
......@@ -26,7 +26,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -25,7 +25,7 @@
#include <asm/core_cia.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
......
......@@ -40,7 +40,7 @@
#include <linux/timex.h>
#include "proto.h"
#include "irq_impl.h"
#include <asm/hw_irq.h>
extern rwlock_t xtime_lock;
extern volatile unsigned long lost_ticks; /* kernel/sched.c */
......
......@@ -425,7 +425,7 @@ static int loop_set_fd(struct loop_device *lo, kdev_t dev, unsigned int arg)
lo->lo_flags |= LO_FLAGS_READ_ONLY;
set_device_ro(dev, 1);
} else {
invalidate_inode_pages (inode);
vmtruncate (inode, 0);
set_device_ro(dev, 0);
}
......
......@@ -32,10 +32,10 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/cache.h>
#include <net/sock.h>
#include <asm/system.h>
#include <asm/cache.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
......
......@@ -16,8 +16,7 @@
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <asm/cache.h>
#include <linux/cache.h>
#define DEBUG_CONFIG 0
......@@ -271,7 +270,7 @@ pci_set_bus_ranges(void)
pbus_set_ranges(bus, NULL);
}
static void
static void __init
pdev_fixup_irq(struct pci_dev *dev,
u8 (*swizzle)(struct pci_dev *, u8 *),
int (*map_irq)(struct pci_dev *, u8, u8))
......
......@@ -32,6 +32,7 @@
/*****************************************************************************/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/string.h>
......
......@@ -786,110 +786,113 @@ static inline void dquot_decr_blocks(struct dquot *dquot, unsigned long number)
dquot->dq_flags |= DQ_MOD;
}
static inline char need_print_warning(short type, uid_t initiator, struct dquot *dquot)
static inline int need_print_warning(struct dquot *dquot, int flag)
{
switch (type) {
switch (dquot->dq_type) {
case USRQUOTA:
return(initiator == dquot->dq_id);
return current->fsuid == dquot->dq_id && !(dquot->dq_flags & flag);
case GRPQUOTA:
return(initiator == dquot->dq_id);
return in_group_p(dquot->dq_id) && !(dquot->dq_flags & flag);
}
return(0);
return 0;
}
static inline char ignore_hardlimit(struct dquot *dquot, uid_t initiator)
static void print_warning(struct dquot *dquot, int flag, char *fmtstr, ...)
{
return(initiator == 0 && dquot->dq_mnt->mnt_dquot.rsquash[dquot->dq_type] == 0);
va_list args;
if (!need_print_warning(dquot, flag))
return;
va_start(args, fmtstr);
vsprintf(quotamessage, fmtstr, args);
va_end(args);
tty_write_message(current->tty, quotamessage);
dquot->dq_flags |= flag;
}
static int check_idq(struct dquot *dquot, short type, u_long inodes, uid_t initiator,
struct tty_struct *tty)
static inline char ignore_hardlimit(struct dquot *dquot)
{
return capable(CAP_SYS_RESOURCE) && !dquot->dq_mnt->mnt_dquot.rsquash[dquot->dq_type];
}
static int check_idq(struct dquot *dquot, u_long inodes)
{
short type = dquot->dq_type;
if (inodes <= 0 || dquot->dq_flags & DQ_FAKE)
return(QUOTA_OK);
return QUOTA_OK;
if (dquot->dq_ihardlimit &&
(dquot->dq_curinodes + inodes) > dquot->dq_ihardlimit &&
!ignore_hardlimit(dquot, initiator)) {
if ((dquot->dq_flags & DQ_INODES) == 0 &&
need_print_warning(type, initiator, dquot)) {
sprintf(quotamessage, "%s: write failed, %s file limit reached\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
tty_write_message(tty, quotamessage);
dquot->dq_flags |= DQ_INODES;
}
return(NO_QUOTA);
!ignore_hardlimit(dquot)) {
print_warning(dquot, DQ_INODES, "%s: write failed, %s file limit reached\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
return NO_QUOTA;
}
if (dquot->dq_isoftlimit &&
(dquot->dq_curinodes + inodes) > dquot->dq_isoftlimit &&
dquot->dq_itime && CURRENT_TIME >= dquot->dq_itime &&
!ignore_hardlimit(dquot, initiator)) {
if (need_print_warning(type, initiator, dquot)) {
sprintf(quotamessage, "%s: warning, %s file quota exceeded too long.\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
tty_write_message(tty, quotamessage);
}
return(NO_QUOTA);
!ignore_hardlimit(dquot)) {
print_warning(dquot, DQ_INODES, "%s: warning, %s file quota exceeded too long.\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
return NO_QUOTA;
}
if (dquot->dq_isoftlimit &&
(dquot->dq_curinodes + inodes) > dquot->dq_isoftlimit &&
dquot->dq_itime == 0) {
if (need_print_warning(type, initiator, dquot)) {
sprintf(quotamessage, "%s: warning, %s file quota exceeded\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
tty_write_message(tty, quotamessage);
}
print_warning(dquot, 0, "%s: warning, %s file quota exceeded\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
dquot->dq_itime = CURRENT_TIME + dquot->dq_mnt->mnt_dquot.inode_expire[type];
}
return(QUOTA_OK);
return QUOTA_OK;
}
static int check_bdq(struct dquot *dquot, short type, u_long blocks, uid_t initiator,
struct tty_struct *tty, char warn)
static int check_bdq(struct dquot *dquot, u_long blocks, char prealloc)
{
short type = dquot->dq_type;
if (blocks <= 0 || dquot->dq_flags & DQ_FAKE)
return(QUOTA_OK);
return QUOTA_OK;
if (dquot->dq_bhardlimit &&
(dquot->dq_curblocks + blocks) > dquot->dq_bhardlimit &&
!ignore_hardlimit(dquot, initiator)) {
if (warn && (dquot->dq_flags & DQ_BLKS) == 0 &&
need_print_warning(type, initiator, dquot)) {
sprintf(quotamessage, "%s: write failed, %s disk limit reached.\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
tty_write_message(tty, quotamessage);
dquot->dq_flags |= DQ_BLKS;
}
return(NO_QUOTA);
!ignore_hardlimit(dquot)) {
if (!prealloc)
print_warning(dquot, DQ_BLKS, "%s: write failed, %s disk limit reached.\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
return NO_QUOTA;
}
if (dquot->dq_bsoftlimit &&
(dquot->dq_curblocks + blocks) > dquot->dq_bsoftlimit &&
dquot->dq_btime && CURRENT_TIME >= dquot->dq_btime &&
!ignore_hardlimit(dquot, initiator)) {
if (warn && need_print_warning(type, initiator, dquot)) {
sprintf(quotamessage, "%s: write failed, %s disk quota exceeded too long.\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
tty_write_message(tty, quotamessage);
}
return(NO_QUOTA);
!ignore_hardlimit(dquot)) {
if (!prealloc)
print_warning(dquot, DQ_BLKS, "%s: write failed, %s disk quota exceeded too long.\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
return NO_QUOTA;
}
if (dquot->dq_bsoftlimit &&
(dquot->dq_curblocks + blocks) > dquot->dq_bsoftlimit &&
dquot->dq_btime == 0) {
if (warn && need_print_warning(type, initiator, dquot)) {
sprintf(quotamessage, "%s: warning, %s disk quota exceeded\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
tty_write_message(tty, quotamessage);
if (!prealloc) {
print_warning(dquot, 0, "%s: warning, %s disk quota exceeded\n",
dquot->dq_mnt->mnt_dirname, quotatypes[type]);
dquot->dq_btime = CURRENT_TIME + dquot->dq_mnt->mnt_dquot.block_expire[type];
}
dquot->dq_btime = CURRENT_TIME + dquot->dq_mnt->mnt_dquot.block_expire[type];
else
/*
* We don't allow preallocation to exceed softlimit so exceeding will
* be always printed
*/
return NO_QUOTA;
}
return(QUOTA_OK);
return QUOTA_OK;
}
/*
......@@ -1102,11 +1105,9 @@ void dquot_drop(struct inode *inode)
/*
* Note: this is a blocking operation.
*/
int dquot_alloc_block(const struct inode *inode, unsigned long number, uid_t initiator,
char warn)
int dquot_alloc_block(const struct inode *inode, unsigned long number, char warn)
{
int cnt;
struct tty_struct *tty = current->tty;
struct dquot *dquot[MAXQUOTAS];
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
......@@ -1114,7 +1115,7 @@ int dquot_alloc_block(const struct inode *inode, unsigned long number, uid_t ini
if (dquot[cnt] == NODQUOT)
continue;
lock_dquot(dquot[cnt]);
if (check_bdq(dquot[cnt], cnt, number, initiator, tty, warn))
if (check_bdq(dquot[cnt], number, warn))
goto put_all;
}
......@@ -1140,10 +1141,9 @@ int dquot_alloc_block(const struct inode *inode, unsigned long number, uid_t ini
/*
* Note: this is a blocking operation.
*/
int dquot_alloc_inode(const struct inode *inode, unsigned long number, uid_t initiator)
int dquot_alloc_inode(const struct inode *inode, unsigned long number)
{
int cnt;
struct tty_struct *tty = current->tty;
struct dquot *dquot[MAXQUOTAS];
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
......@@ -1151,7 +1151,7 @@ int dquot_alloc_inode(const struct inode *inode, unsigned long number, uid_t ini
if (dquot[cnt] == NODQUOT)
continue;
lock_dquot(dquot[cnt]);
if (check_idq(dquot[cnt], cnt, number, initiator, tty))
if (check_idq(dquot[cnt], number))
goto put_all;
}
......@@ -1213,13 +1213,12 @@ void dquot_free_inode(const struct inode *inode, unsigned long number)
*
* Note: this is a blocking operation.
*/
int dquot_transfer(struct dentry *dentry, struct iattr *iattr, uid_t initiator)
int dquot_transfer(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry -> d_inode;
unsigned long blocks;
struct dquot *transfer_from[MAXQUOTAS];
struct dquot *transfer_to[MAXQUOTAS];
struct tty_struct *tty = current->tty;
short cnt, disc;
int error = -EDQUOT;
......@@ -1293,8 +1292,8 @@ int dquot_transfer(struct dentry *dentry, struct iattr *iattr, uid_t initiator)
* invalidated or locked...
*/
if (!transfer_to[cnt]->dq_mnt || !transfer_from[cnt]->dq_mnt ||
check_idq(transfer_to[cnt], cnt, 1, initiator, tty) == NO_QUOTA ||
check_bdq(transfer_to[cnt], cnt, blocks, initiator, tty, 0) == NO_QUOTA) {
check_idq(transfer_to[cnt], 1) == NO_QUOTA ||
check_bdq(transfer_to[cnt], blocks, 0) == NO_QUOTA) {
cnt++;
goto put_all;
}
......@@ -1458,9 +1457,9 @@ int quota_off(kdev_t dev, short type)
static inline int check_quotafile_size(loff_t size)
{
ulong blocks = size >> BLOCK_SIZE_BITS;
size_t off = size & ~(BLOCK_SIZE - 1);
size_t off = size & (BLOCK_SIZE - 1);
return !((blocks % sizeof(struct dqblk) + off % sizeof(struct dqblk)) % sizeof(struct dqblk));
return !(((blocks % sizeof(struct dqblk)) * BLOCK_SIZE + off % sizeof(struct dqblk)) % sizeof(struct dqblk));
}
int quota_on(kdev_t dev, short type, char *path)
......@@ -1555,7 +1554,7 @@ asmlinkage long sys_quotactl(int cmd, const char *special, int id, caddr_t addr)
break;
case Q_GETQUOTA:
if (((type == USRQUOTA && current->euid != id) ||
(type == GRPQUOTA && in_group_p(id))) &&
(type == GRPQUOTA && in_egroup_p(id))) &&
!capable(CAP_SYS_RESOURCE))
goto out;
break;
......
......@@ -10,6 +10,4 @@
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
#endif
......@@ -28,8 +28,8 @@ extern int __local_irq_count;
#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
#define hardirq_endlock(cpu) ((void) 0)
#define hardirq_enter(cpu, irq) (local_irq_count(cpu)++)
#define hardirq_exit(cpu, irq) (local_irq_count(cpu)--)
#define irq_enter(cpu, irq) (local_irq_count(cpu)++)
#define irq_exit(cpu, irq) (local_irq_count(cpu)--)
#define synchronize_irq() barrier()
......@@ -52,13 +52,16 @@ static inline void release_irqlock(int cpu)
}
}
static inline void hardirq_enter(int cpu, int irq)
static inline void irq_enter(int cpu, int irq)
{
++local_irq_count(cpu);
atomic_inc(&global_irq_count);
while (spin_is_locked(&global_irq_lock))
barrier();
}
static inline void hardirq_exit(int cpu, int irq)
static inline void irq_exit(int cpu, int irq)
{
atomic_dec(&global_irq_count);
--local_irq_count(cpu);
......@@ -66,11 +69,10 @@ static inline void hardirq_exit(int cpu, int irq)
static inline int hardirq_trylock(int cpu)
{
return (!atomic_read(&global_irq_count)
&& !spin_is_locked(&global_irq_lock));
return !local_irq_count(cpu) && !spin_is_locked(&global_irq_lock);
}
#define hardirq_endlock(cpu) ((void)0)
#define hardirq_endlock(cpu) do { } while (0)
extern void synchronize_irq(void);
......
#ifndef _ALPHA_HW_IRQ_H
#define _ALPHA_HW_IRQ_H
/*
* linux/arch/alpha/kernel/irq.h
*
......@@ -85,3 +87,5 @@ static inline void alpha_do_profile (unsigned long pc)
atomic_inc((atomic_t *)&prof_buffer[pc]);
}
}
#endif
......@@ -67,9 +67,6 @@ extern void disable_irq(unsigned int);
extern void disable_irq_nosync(unsigned int);
extern void enable_irq(unsigned int);
extern void irq_enter(int cpu, int irq);
extern void irq_exit(int cpu, int irq);
struct pt_regs;
extern void (*perf_irq)(unsigned long, struct pt_regs *);
......
......@@ -11,16 +11,4 @@
#define L1_CACHE_BYTES 16
#endif
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#ifdef MODULE
#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
#else
#define __cacheline_aligned \
__attribute__((__aligned__(L1_CACHE_BYTES), \
__section__(".data.cacheline_aligned")))
#endif
#endif
......@@ -17,8 +17,8 @@ extern unsigned int local_irq_count[NR_CPUS];
#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0)
#define hardirq_endlock(cpu) do { } while (0)
#define hardirq_enter(cpu) (local_irq_count[cpu]++)
#define hardirq_exit(cpu) (local_irq_count[cpu]--)
#define irq_enter(cpu, irq) (local_irq_count[cpu]++)
#define irq_exit(cpu, irq) (local_irq_count[cpu]--)
#define synchronize_irq() barrier()
......@@ -39,13 +39,17 @@ static inline void release_irqlock(int cpu)
}
}
static inline void hardirq_enter(int cpu)
static inline void irq_enter(int cpu, int irq)
{
++local_irq_count[cpu];
atomic_inc(&global_irq_count);
while (test_bit(0,&global_irq_lock)) {
/* nothing */;
}
}
static inline void hardirq_exit(int cpu)
static inline void irq_exit(int cpu, int irq)
{
atomic_dec(&global_irq_count);
--local_irq_count[cpu];
......
......@@ -40,7 +40,8 @@
* the 4 pgd entries internally, so there is no extra memory
* load on TLB miss, despite one more level of indirection.
*/
#define pgd_none(x) (pgd_val(x) == 1ULL)
#define EMPTY_PGD (__pa(empty_zero_page) + 1)
#define pgd_none(x) (pgd_val(x) == EMPTY_PGD)
extern inline int pgd_bad(pgd_t pgd) { return 0; }
extern inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); }
......@@ -59,7 +60,7 @@ extern inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); }
*/
extern inline void __pgd_clear (pgd_t * pgd)
{
set_pgd(pgd, __pgd(1ULL));
set_pgd(pgd, __pgd(EMPTY_PGD));
}
extern inline void pgd_clear (pgd_t * pgd)
......
......@@ -37,6 +37,13 @@ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3"
__asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))
#endif
/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
*/
extern unsigned long empty_zero_page[1024];
#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page))
#endif /* !__ASSEMBLY__ */
/*
......@@ -144,13 +151,6 @@ __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))
/* page table for 0-4MB for everybody */
extern unsigned long pg0[1024];
/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
*/
extern unsigned long empty_zero_page[1024];
#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page))
/*
* Handling allocation failures during page table setup.
*/
......
......@@ -145,7 +145,7 @@ extern inline void __set_64bit (unsigned long long * ptr,
__asm__ __volatile__ (
"1: movl (%0), %%eax;
movl 4(%0), %%edx;
lock; cmpxchg8b (%0);
cmpxchg8b (%0);
jnz 1b"
:: "D"(ptr),
"b"(low),
......
......@@ -6,7 +6,7 @@
#include <asm/pgtable.h>
#include <asm/dma.h>
#include <asm/cache.h>
#include <linux/cache.h>
#include <linux/init.h>
/*
......
#ifndef __LINUX_CACHE_H
#define __LINUX_CACHE_H
#include <asm/cache.h>
#ifndef L1_CACHE_ALIGN
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#endif
#ifndef SMP_CACHE_BYTES
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#endif
#ifndef ____cacheline_aligned
#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
#endif
#ifndef __cacheline_aligned
#ifdef MODULE
#define __cacheline_aligned ____cacheline_aligned
#else
#define __cacheline_aligned \
__attribute__((__aligned__(SMP_CACHE_BYTES), \
__section__(".data.cacheline_aligned")))
#endif
#endif /* __cacheline_aligned */
#endif /* __LINUX_CACHE_H */
......@@ -18,10 +18,10 @@
#include <linux/list.h>
#include <linux/dcache.h>
#include <linux/stat.h>
#include <linux/cache.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
#include <asm/cache.h>
struct poll_table_struct;
......@@ -674,11 +674,11 @@ struct super_operations {
struct dquot_operations {
void (*initialize) (struct inode *, short);
void (*drop) (struct inode *);
int (*alloc_block) (const struct inode *, unsigned long, uid_t, char);
int (*alloc_inode) (const struct inode *, unsigned long, uid_t);
int (*alloc_block) (const struct inode *, unsigned long, char);
int (*alloc_inode) (const struct inode *, unsigned long);
void (*free_block) (const struct inode *, unsigned long);
void (*free_inode) (const struct inode *, unsigned long);
int (*transfer) (struct dentry *, struct iattr *, uid_t);
int (*transfer) (struct dentry *, struct iattr *);
};
struct file_system_type {
......
......@@ -42,7 +42,7 @@ typedef struct {
independent code */
struct irqaction *action; /* IRQ action list */
unsigned int depth; /* Disable depth for nested irq disables */
} irq_desc_t;
} ____cacheline_aligned irq_desc_t;
#include <asm/hw_irq.h> /* the arch dependent stuff */
......@@ -52,27 +52,6 @@ extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
extern spinlock_t irq_controller_lock;
extern int setup_irq(unsigned int , struct irqaction * );
#ifdef __SMP__
#include <asm/atomic.h>
static inline void irq_enter(int cpu, unsigned int irq)
{
hardirq_enter(cpu);
while (test_bit(0,&global_irq_lock)) {
/* nothing */;
}
}
static inline void irq_exit(int cpu, unsigned int irq)
{
hardirq_exit(cpu);
}
#else
#define irq_enter(cpu, irq) (++local_irq_count[cpu])
#define irq_exit(cpu, irq) (--local_irq_count[cpu])
#endif
extern hw_irq_controller no_irq_type; /* needed in every arch ? */
#endif /* __asm_h */
......
......@@ -44,8 +44,8 @@
/*
* Convert diskblocks to blocks and the other way around.
*/
#define dbtob(num) (num << 10)
#define btodb(num) (num >> 10)
#define dbtob(num) (num << BLOCK_SIZE_BITS)
#define btodb(num) (num >> BLOCK_SIZE_BITS)
/*
* Convert count of filesystem blocks to diskquota blocks, meant
......
......@@ -23,16 +23,13 @@ extern void invalidate_dquots(kdev_t dev, short type);
extern int quota_off(kdev_t dev, short type);
extern int sync_dquots(kdev_t dev, short type);
extern int dquot_alloc_block(const struct inode *inode, unsigned long number,
uid_t initiator, char warn);
extern int dquot_alloc_inode(const struct inode *inode, unsigned long number,
uid_t initiator);
extern int dquot_alloc_block(const struct inode *inode, unsigned long number, char prealloc);
extern int dquot_alloc_inode(const struct inode *inode, unsigned long number);
extern void dquot_free_block(const struct inode *inode, unsigned long number);
extern void dquot_free_inode(const struct inode *inode, unsigned long number);
extern int dquot_transfer(struct dentry *dentry, struct iattr *iattr,
uid_t initiator);
extern int dquot_transfer(struct dentry *dentry, struct iattr *iattr);
/*
* Operations supported for diskquotas.
......@@ -54,8 +51,7 @@ extern __inline__ void DQUOT_DROP(struct inode *inode)
extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
{
if (sb->dq_op) {
if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize),
current->fsuid, 0) == NO_QUOTA)
if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 1) == NO_QUOTA)
return 1;
}
return 0;
......@@ -64,8 +60,7 @@ extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct
extern __inline__ int DQUOT_ALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr)
{
if (sb->dq_op) {
if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize),
current->fsuid, 1) == NO_QUOTA)
if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 0) == NO_QUOTA)
return 1;
}
return 0;
......@@ -75,7 +70,7 @@ extern __inline__ int DQUOT_ALLOC_INODE(struct super_block *sb, struct inode *in
{
if (sb->dq_op) {
sb->dq_op->initialize (inode, -1);
if (sb->dq_op->alloc_inode (inode, 1, current->fsuid))
if (sb->dq_op->alloc_inode (inode, 1))
return 1;
}
inode->i_flags |= S_QUOTA;
......@@ -100,7 +95,7 @@ extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr)
if (dentry->d_inode->i_sb->dq_op) {
dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1);
error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr, current->fsuid);
error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr);
} else {
error = notify_change(dentry, iattr);
}
......
......@@ -513,6 +513,7 @@ extern void FASTCALL(wake_up_process(struct task_struct * tsk));
#define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE)
extern int in_group_p(gid_t);
extern int in_egroup_p(gid_t);
extern void flush_signals(struct task_struct *);
extern void flush_signal_handlers(struct task_struct *);
......
......@@ -12,7 +12,7 @@
typedef struct kmem_cache_s kmem_cache_t;
#include <linux/mm.h>
#include <asm/cache.h>
#include <linux/cache.h>
/* flags for kmem_cache_alloc() */
#define SLAB_BUFFER GFP_BUFFER
......
......@@ -355,7 +355,7 @@ extern asmlinkage long sys_sysctl(struct __sysctl_args *args)
}
/* Like in_group_p, but testing against egid, not fsgid */
static int in_egroup_p(gid_t grp)
int in_egroup_p(gid_t grp)
{
if (grp != current->egid) {
int i = current->ngroups;
......
......@@ -303,7 +303,6 @@ int shrink_mmap(int priority, int gfp_mask)
/* is it a page-cache page? */
if (page->mapping) {
dispose = &old;
if (!pgcache_under_min())
{
remove_page_from_inode_queue(page);
......
......@@ -55,16 +55,23 @@ This send_actor is for use with do_generic_file_read (ie sendfile())
It sends the data to the socket indicated by desc->buf.
*/
static int sock_send_actor(read_descriptor_t * desc, const char *area, unsigned long size)
static int sock_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
{
int written;
unsigned long kaddr;
unsigned long count = desc->count;
struct socket *sock = (struct socket *) desc->buf;
mm_segment_t old_fs;
if (size > count)
size = count;
written = SendBuffer_async(sock,(char *)area,size);
old_fs = get_fs();
set_fs(KERNEL_DS);
kaddr = kmap(page);
written = SendBuffer_async(sock,(char *)kaddr + offset,size);
kunmap(page);
set_fs(old_fs);
if (written < 0) {
desc->error = written;
written = 0;
......
......@@ -50,6 +50,10 @@ Userspace
*
****************************************************************/
static int errno;
#define __KERNEL_SYSCALLS__
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -176,9 +180,6 @@ static int MainDaemon(void *cpu_pointer)
static int CountBuf[CONFIG_KHTTPD_NUMCPU];
static int errno;
inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options);
/*
......
......@@ -54,7 +54,7 @@
# Change a lot of places to call set_x_info uniformly.
# Take out message about preparing version (old sound driver cruft).
#
# 13 Dec 1998, Riley H Williams (rhw@bigfoot.com)
# 13 Dec 1998, Riley H Williams <rhw@memalpha.cx>
# When an error occurs, actually display the error message as well as
# our comments thereon.
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment