diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 17:17:53 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 17:17:53 +0000 |
commit | b2ad5f821b1381492d792ca10b1eb7a107b48f14 (patch) | |
tree | 954a648692e7da983db1d2470953705f6a729264 /include | |
parent | c9c06167e7933d93a6e396174c68abf242294abb (diff) |
Merge with Linux 2.4.0-prerelease. Big Makefile rewrite, test your
Makefiles.
Diffstat (limited to 'include')
91 files changed, 1165 insertions, 907 deletions
diff --git a/include/asm-alpha/mmu.h b/include/asm-alpha/mmu.h new file mode 100644 index 000000000..3dc127779 --- /dev/null +++ b/include/asm-alpha/mmu.h @@ -0,0 +1,7 @@ +#ifndef __ALPHA_MMU_H +#define __ALPHA_MMU_H + +/* The alpha MMU context is one "unsigned long" bitmap per CPU */ +typedef unsigned long mm_context_t[NR_CPUS]; + +#endif diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h index 219b8bd4e..492d29b7c 100644 --- a/include/asm-alpha/mmu_context.h +++ b/include/asm-alpha/mmu_context.h @@ -11,7 +11,6 @@ #include <asm/system.h> #include <asm/machvec.h> - /* * Force a context reload. This is needed when we change the page * table pointer or when we update the ASN of the current process. @@ -93,12 +92,7 @@ extern unsigned long last_asn; #endif /* CONFIG_SMP */ #define WIDTH_HARDWARE_ASN 8 -#ifdef CONFIG_SMP -#define WIDTH_THIS_PROCESSOR 5 -#else -#define WIDTH_THIS_PROCESSOR 0 -#endif -#define ASN_FIRST_VERSION (1UL << (WIDTH_THIS_PROCESSOR + WIDTH_HARDWARE_ASN)) +#define ASN_FIRST_VERSION (1UL << WIDTH_HARDWARE_ASN) #define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1) /* @@ -137,19 +131,24 @@ __EXTERN_INLINE void ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, struct task_struct *next, long cpu) { - /* Check if our ASN is of an older version, or on a different CPU, - and thus invalid. */ - /* ??? If we have two threads on different cpus, we'll continually - fight over the context. Find a way to record a per-mm, per-cpu - value for the asn. */ + /* Check if our ASN is of an older version, and thus invalid. */ + unsigned long asn; + unsigned long mmc; - unsigned long asn = cpu_last_asn(cpu); - unsigned long mmc = next_mm->context; - +#ifdef CONFIG_SMP + cpu_data[cpu].asn_lock = 1; + barrier(); +#endif + asn = cpu_last_asn(cpu); + mmc = next_mm->context[cpu]; if ((mmc ^ asn) & ~HARDWARE_ASN_MASK) { mmc = __get_new_mm_context(next_mm, cpu); - next_mm->context = mmc; + next_mm->context[cpu] = mmc; } +#ifdef CONFIG_SMP + else + cpu_data[cpu].need_new_asn = 1; +#endif /* Always update the PCB ASN. Another thread may have allocated a new mm->context (via flush_tlb_mm) without the ASN serial @@ -179,6 +178,23 @@ ev4_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, extern void __load_new_mm_context(struct mm_struct *); +#ifdef CONFIG_SMP +#define check_mmu_context() \ +do { \ + int cpu = smp_processor_id(); \ + cpu_data[cpu].asn_lock = 0; \ + barrier(); \ + if (cpu_data[cpu].need_new_asn) { \ + struct mm_struct * mm = current->active_mm; \ + cpu_data[cpu].need_new_asn = 0; \ + if (!mm->context[cpu]) \ + __load_new_mm_context(mm); \ + } \ +} while(0) +#else +#define check_mmu_context() do { } while(0) +#endif + __EXTERN_INLINE void ev5_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm) { @@ -208,7 +224,10 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm) extern inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) { - mm->context = 0; + int i; + + for (i = 0; i < smp_num_cpus; i++) + mm->context[cpu_logical_map(i)] = 0; tsk->thread.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; return 0; } diff --git a/include/asm-alpha/pgalloc.h b/include/asm-alpha/pgalloc.h index dd09a2eec..7e377bdfd 100644 --- a/include/asm-alpha/pgalloc.h +++ b/include/asm-alpha/pgalloc.h @@ -38,29 +38,6 @@ extern void __load_new_mm_context(struct mm_struct *); extern void smp_imb(void); #endif -/* We need to flush the userspace icache after setting breakpoints in - ptrace. I don't think it's needed in do_swap_page, or do_no_page, - but I don't know how to get rid of it either. - - Instead of indiscriminately using imb, take advantage of the fact - that icache entries are tagged with the ASN and load a new mm context. */ -/* ??? Ought to use this in arch/alpha/kernel/signal.c too. */ - -#ifndef CONFIG_SMP -static inline void -flush_icache_page(struct vm_area_struct *vma, struct page *page) -{ - if (vma->vm_flags & VM_EXEC) { - struct mm_struct *mm = vma->vm_mm; - mm->context = 0; - if (current->active_mm == mm) - __load_new_mm_context(mm); - } -} -#else -extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); -#endif - /* * Use a few helper functions to hide the ugly broken ASN @@ -83,8 +60,38 @@ ev5_flush_tlb_current(struct mm_struct *mm) static inline void flush_tlb_other(struct mm_struct *mm) { - mm->context = 0; + long * mmc = &mm->context[smp_processor_id()]; + /* + * Check it's not zero first to avoid cacheline ping pong when + * possible. + */ + if (*mmc) + *mmc = 0; +} + +/* We need to flush the userspace icache after setting breakpoints in + ptrace. I don't think it's needed in do_swap_page, or do_no_page, + but I don't know how to get rid of it either. + + Instead of indiscriminately using imb, take advantage of the fact + that icache entries are tagged with the ASN and load a new mm context. */ +/* ??? Ought to use this in arch/alpha/kernel/signal.c too. */ + +#ifndef CONFIG_SMP +static inline void +flush_icache_page(struct vm_area_struct *vma, struct page *page) +{ + if (vma->vm_flags & VM_EXEC) { + struct mm_struct *mm = vma->vm_mm; + if (current->active_mm == mm) + __load_new_mm_context(mm); + else + mm->context[smp_processor_id()] = 0; + } } +#else +extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); +#endif /* * Flush just one page in the current TLB set. @@ -140,7 +147,7 @@ ev5_flush_tlb_current_page(struct mm_struct * mm, */ static inline void flush_tlb(void) { - flush_tlb_current(current->mm); + flush_tlb_current(current->active_mm); } /* @@ -170,10 +177,10 @@ static inline void flush_tlb_all(void) */ static inline void flush_tlb_mm(struct mm_struct *mm) { - if (mm != current->mm) - flush_tlb_other(mm); - else + if (mm == current->active_mm) flush_tlb_current(mm); + else + flush_tlb_other(mm); } /* @@ -189,10 +196,10 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, { struct mm_struct * mm = vma->vm_mm; - if (mm != current->mm) - flush_tlb_other(mm); - else + if (mm == current->active_mm) flush_tlb_current_page(mm, vma, addr); + else + flush_tlb_other(mm); } /* diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 81427025c..49f228f3f 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -124,7 +124,6 @@ extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) unsigned long get_wchan(struct task_struct *p); diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h index 44ec5e8ea..6331af6f2 100644 --- a/include/asm-alpha/smp.h +++ b/include/asm-alpha/smp.h @@ -26,6 +26,8 @@ __hard_smp_processor_id(void) struct cpuinfo_alpha { unsigned long loops_per_sec; unsigned long last_asn; + int need_new_asn; + int asn_lock; unsigned long *pgd_cache; unsigned long *pte_cache; unsigned long pgtable_cache_sz; diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 6d34c5472..3a8c9385d 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -125,6 +125,7 @@ do { \ current = (next); \ pcbb = virt_to_phys(¤t->thread); \ (last) = alpha_switch_to(pcbb, (prev)); \ + check_mmu_context(); \ } while (0) extern struct task_struct* alpha_switch_to(unsigned long, struct task_struct*); diff --git a/include/asm-arm/mmu.h b/include/asm-arm/mmu.h new file mode 100644 index 000000000..784ff2708 --- /dev/null +++ b/include/asm-arm/mmu.h @@ -0,0 +1,7 @@ +#ifndef __ARM_MMU_H +#define __ARM_MMU_H + +/* The ARM doesn't have a mmu context */ +typedef struct { } mm_context_t; + +#endif diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index f84c5d2d3..537d7ec12 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -109,7 +109,6 @@ extern void release_thread(struct task_struct *); /* Copy and release all segment info associated with a VM */ #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) unsigned long get_wchan(struct task_struct *p); diff --git a/include/asm-i386/delay.h b/include/asm-i386/delay.h index 2166c4c6d..c7d218492 100644 --- a/include/asm-i386/delay.h +++ b/include/asm-i386/delay.h @@ -7,12 +7,14 @@ * Delay routines calling functions in arch/i386/lib/delay.c */ +extern void __bad_udelay(void); + extern void __udelay(unsigned long usecs); extern void __const_udelay(unsigned long usecs); extern void __delay(unsigned long loops); #define udelay(n) (__builtin_constant_p(n) ? \ - __const_udelay((n) * 0x10c6ul) : \ + ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ __udelay(n)) #endif /* defined(_I386_DELAY_H) */ diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h index 667ad58f3..bcfa2c65c 100644 --- a/include/asm-i386/desc.h +++ b/include/asm-i386/desc.h @@ -82,7 +82,7 @@ extern inline void clear_LDT(void) extern inline void load_LDT (struct mm_struct *mm) { int cpu = smp_processor_id(); - void *segments = mm->segments; + void *segments = mm->context.segments; int count = LDT_ENTRIES; if (!segments) { diff --git a/include/asm-i386/mmu.h b/include/asm-i386/mmu.h new file mode 100644 index 000000000..6114bcc08 --- /dev/null +++ b/include/asm-i386/mmu.h @@ -0,0 +1,12 @@ +#ifndef __i386_MMU_H +#define __i386_MMU_H + +/* + * The i386 doesn't have a mmu context, but + * we put the segment information here. + */ +typedef struct { + void *segments; +} mm_context_t; + +#endif diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h index 0c201e1d2..cdfb99b4d 100644 --- a/include/asm-i386/mmu_context.h +++ b/include/asm-i386/mmu_context.h @@ -33,7 +33,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str /* * Re-load LDT if necessary */ - if (prev->segments != next->segments) + if (prev->context.segments != next->context.segments) load_LDT(next); #ifdef CONFIG_SMP cpu_tlbstate[cpu].state = TLBSTATE_OK; diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 5d7d5717a..bf32a7449 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -284,7 +284,7 @@ static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return p static inline int ptep_test_and_clear_dirty(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); } static inline int ptep_test_and_clear_young(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); } static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, ptep); } -static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_RW, ptep); } +static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_DIRTY, ptep); } /* * Conversion functions: convert a page and protection to a page entry, diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index a03dd0027..21296d961 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -47,7 +47,7 @@ struct cpuinfo_x86 { int fdiv_bug; int f00f_bug; int coma_bug; - unsigned long loops_per_sec; + unsigned long loops_per_jiffy; unsigned long *pgd_quick; unsigned long *pmd_quick; unsigned long *pte_quick; @@ -430,7 +430,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ extern void copy_segments(struct task_struct *p, struct mm_struct * mm); extern void release_segments(struct mm_struct * mm); -extern void forget_segments(void); /* * Return saved PC of a blocked thread. diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index 67347daea..906845849 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -511,7 +511,7 @@ do { \ " stosb\n" \ " popl %%eax\n" \ " incl %0\n" \ - " jmp 2b\n" \ + " jmp 3b\n" \ ".previous\n" \ ".section __ex_table,\"a\"\n" \ " .align 4\n" \ diff --git a/include/asm-ia64/mmu.h b/include/asm-ia64/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-ia64/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 37a8c2ba4..2fb8e357f 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h @@ -378,7 +378,6 @@ extern int kernel_thread (int (*fn)(void *), void *arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) /* Get wait channel for task P. */ extern unsigned long get_wchan (struct task_struct *p); diff --git a/include/asm-m68k/contregs.h b/include/asm-m68k/contregs.h new file mode 100644 index 000000000..1e233e7d1 --- /dev/null +++ b/include/asm-m68k/contregs.h @@ -0,0 +1,4 @@ +#ifndef _M68K_CONTREGS_H +#define _M68K_CONTREGS_H +#include <asm-sparc/contregs.h> +#endif /* _M68K_CONTREGS_H */ diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h index b350911c6..afcb9b22b 100644 --- a/include/asm-m68k/dvma.h +++ b/include/asm-m68k/dvma.h @@ -14,18 +14,28 @@ #ifdef CONFIG_SUN3 /* sun3 dvma page support */ -/* memory and pmegs reserved for dvma */ +#define DVMA_RESERVED_PMEGS 2 /* 256k of dvma */ + +/* memory and pmegs potentially reserved for dvma */ #define DVMA_PMEG_START 10 #define DVMA_PMEG_END 16 #define DVMA_START 0xff00000 #define DVMA_END 0xffe0000 #define DVMA_SIZE (DVMA_END-DVMA_START) +/* empirical kludge -- dvma regions only seem to work right on 0x10000 + byte boundries */ +#define DVMA_REGION_SIZE 0x10000 +#define DVMA_ALIGN(addr) (((addr)+DVMA_REGION_SIZE-1) & \ + ~(DVMA_REGION_SIZE-1)) + + /* virt <-> phys conversions */ #define sun3_dvma_vtop(x) ((unsigned long)(x) & 0xffffff) #define sun3_dvma_ptov(x) ((unsigned long)(x) | 0xf000000) - -void *sun3_dvma_malloc(int len); + +extern void sun3_dvma_init(void); +extern void *sun3_dvma_malloc(int len); #else /* Sun3x */ /* Structure to describe the current status of DMA registers on the Sparc */ diff --git a/include/asm-m68k/fbio.h b/include/asm-m68k/fbio.h new file mode 100644 index 000000000..c17edf8c7 --- /dev/null +++ b/include/asm-m68k/fbio.h @@ -0,0 +1 @@ +#include <asm-sparc/fbio.h> diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h index 8a1e6a445..615e0df01 100644 --- a/include/asm-m68k/hardirq.h +++ b/include/asm-m68k/hardirq.h @@ -2,6 +2,7 @@ #define __M68K_HARDIRQ_H #include <linux/threads.h> +#include <linux/cache.h> /* entry.S is sensitive to the offsets of these fields */ typedef struct { diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h index 5ef14f29e..2031774a5 100644 --- a/include/asm-m68k/ide.h +++ b/include/asm-m68k/ide.h @@ -50,28 +50,21 @@ #define MAX_HWIFS 4 /* same as the other archs */ #endif -int q40ide_default_irq(q40ide_ioreg_t); static __inline__ int ide_default_irq(ide_ioreg_t base) { - if (MACH_IS_Q40) - return q40ide_default_irq((q40ide_ioreg_t) base); - else return 0; + return 0; } -int q40ide_default_io_base(int); - static __inline__ ide_ioreg_t ide_default_io_base(int index) { - if (MACH_IS_Q40) - return (ide_ioreg_t)q40ide_default_io_base(index); - else return 0; + return 0; } /* * Can we do this in a generic manner?? */ -void q40_ide_init_hwif_ports (hw_regs_t *hw, q40ide_ioreg_t data_port, q40ide_ioreg_t ctrl_port, int *irq); + /* * Set up a hw structure for a specified data port, control port and IRQ. @@ -79,10 +72,6 @@ void q40_ide_init_hwif_ports (hw_regs_t *hw, q40ide_ioreg_t data_port, q40ide_io */ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq) { -#ifdef CONFIG_Q40 - if (MACH_IS_Q40) - return q40_ide_init_hwif_ports(hw, (q40ide_ioreg_t) data_port, (q40ide_ioreg_t) ctrl_port, irq); -#endif if (data_port || ctrl_port) printk("ide_init_hwif_ports: must not be called\n"); } diff --git a/include/asm-m68k/idprom.h b/include/asm-m68k/idprom.h new file mode 100644 index 000000000..4349eaf3c --- /dev/null +++ b/include/asm-m68k/idprom.h @@ -0,0 +1,8 @@ +#ifndef _M68K_IDPROM_H +#define _M68K_IDPROM_H +#include <asm-sparc/idprom.h> + +/* Sun3: in control space */ +#define SUN3_IDPROM_BASE 0x00000000 + +#endif /* !(_M68K_IDPROM_H) */ diff --git a/include/asm-m68k/intersil.h b/include/asm-m68k/intersil.h index e039ea320..ea2a5b572 100644 --- a/include/asm-m68k/intersil.h +++ b/include/asm-m68k/intersil.h @@ -11,7 +11,7 @@ #define INTERSIL_24H_MODE 0x04 /* bit 3 */ -#define INTESIL_STOP 0x00 +#define INTERSIL_STOP 0x00 #define INTERSIL_RUN 0x08 /* bit 4 */ diff --git a/include/asm-m68k/kbio.h b/include/asm-m68k/kbio.h new file mode 100644 index 000000000..e1fbf8fba --- /dev/null +++ b/include/asm-m68k/kbio.h @@ -0,0 +1 @@ +#include <asm-sparc/kbio.h> diff --git a/include/asm-m68k/mmu.h b/include/asm-m68k/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-m68k/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h index 003933fae..0e7dcd886 100644 --- a/include/asm-m68k/mmu_context.h +++ b/include/asm-m68k/mmu_context.h @@ -3,15 +3,16 @@ #include <linux/config.h> +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu) +{ +} + #ifndef CONFIG_SUN3 #include <asm/setup.h> #include <asm/page.h> #include <asm/pgalloc.h> -static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu) -{ -} extern inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) { @@ -105,8 +106,6 @@ extern inline void activate_mm(struct mm_struct *prev_mm, extern unsigned long get_free_context(struct mm_struct *mm); extern void clear_context(unsigned long context); -extern unsigned char ctx_next_to_die; -extern unsigned char ctx_live[SUN3_CONTEXTS_NUM]; /* set the context for a new task to unmapped */ static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) @@ -123,28 +122,12 @@ static inline void get_mmu_context(struct mm_struct *mm) mm->context = get_free_context(mm); } -#if 0 -/* we used to clear the context after the process exited. we still - should, things are faster that way... but very unstable. so just - clear out a context next time we need a new one.. consider this a - FIXME. */ - /* flush context if allocated... */ static inline void destroy_context(struct mm_struct *mm) { if(mm->context != SUN3_INVALID_CONTEXT) clear_context(mm->context); } -#else -/* mark this context as dropped and set it for next death */ -static inline void destroy_context(struct mm_struct *mm) -{ - if(mm->context != SUN3_INVALID_CONTEXT) { - ctx_next_to_die = mm->context; - ctx_live[mm->context] = 0; - } -} -#endif static inline void activate_context(struct mm_struct *mm) { diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 1bba1277f..0ad99a7f8 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h @@ -111,7 +111,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) /* * Free current thread data structures etc.. diff --git a/include/asm-m68k/semaphore-helper.h b/include/asm-m68k/semaphore-helper.h index 0ae0b9705..aa38ab88e 100644 --- a/include/asm-m68k/semaphore-helper.h +++ b/include/asm-m68k/semaphore-helper.h @@ -19,6 +19,10 @@ static inline void wake_one_more(struct semaphore * sem) atomic_inc(&sem->waking); } +#ifndef CONFIG_RMW_INSNS +extern spinlock_t semaphore_wake_lock; +#endif + static inline int waking_non_zero(struct semaphore *sem) { int ret; diff --git a/include/asm-m68k/vuid_event.h b/include/asm-m68k/vuid_event.h new file mode 100644 index 000000000..52ecb521a --- /dev/null +++ b/include/asm-m68k/vuid_event.h @@ -0,0 +1,4 @@ +#ifndef _M68K_VUID_EVENT_H +#define _M68K_VUID_EVENT_H +#include <asm-sparc/vuid_event.h> +#endif diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h index 7628fe4a8..840e868a1 100644 --- a/include/asm-mips/delay.h +++ b/include/asm-mips/delay.h @@ -1,17 +1,18 @@ -/* $Id: delay.h,v 1.2 1999/01/04 16:09:20 ralf Exp $ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1994 by Waldorf Electronics - * Copyright (C) 1995 - 1998 by Ralf Baechle + * Copyright (C) 1995 - 1998, 2001 by Ralf Baechle */ #ifndef _ASM_DELAY_H #define _ASM_DELAY_H #include <linux/config.h> +extern unsigned long loops_per_sec; + extern __inline__ void __delay(unsigned long loops) { diff --git a/include/asm-mips/mmu.h b/include/asm-mips/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-mips/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-mips64/delay.h b/include/asm-mips64/delay.h index 28b7b7b07..3d474e233 100644 --- a/include/asm-mips64/delay.h +++ b/include/asm-mips64/delay.h @@ -12,6 +12,8 @@ #include <linux/config.h> +extern unsigned long loops_per_sec; + extern __inline__ void __delay(unsigned long loops) { diff --git a/include/asm-mips64/mmu.h b/include/asm-mips64/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-mips64/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-parisc/mmu.h b/include/asm-parisc/mmu.h index c311f8ae7..f078f0df0 100644 --- a/include/asm-parisc/mmu.h +++ b/include/asm-parisc/mmu.h @@ -6,6 +6,10 @@ #define _PARISC_MMU_H_ #ifndef __ASSEMBLY__ + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + /* Hardware Page Table Entry */ typedef struct _PTE { unsigned long v:1; /* Entry is valid */ diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h index 406366292..12ae777a5 100644 --- a/include/asm-parisc/processor.h +++ b/include/asm-parisc/processor.h @@ -312,7 +312,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) extern inline unsigned long get_wchan(struct task_struct *p) { diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index 2fe5cfe71..3efe39d00 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h @@ -6,6 +6,9 @@ #ifndef _PPC_MMU_H_ #define _PPC_MMU_H_ +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + #include <linux/config.h> #ifndef __ASSEMBLY__ diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index cfd49807e..5908d7f32 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -675,7 +675,6 @@ static inline unsigned long thread_saved_pc(struct thread_struct *t) #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) unsigned long get_wchan(struct task_struct *p); diff --git a/include/asm-s390/mmu.h b/include/asm-s390/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-s390/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 5cb89c8a3..4629c822b 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h @@ -127,8 +127,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(nr, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) - /* * Return saved PC of a blocked thread. used in kernel/sched diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-sh/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index 38d8dbe7c..8c4ba40d8 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h @@ -154,7 +154,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(p, mm) do { } while(0) #define release_segments(mm) do { } while(0) -#define forget_segments() do { } while (0) /* * FPU lazy state save handling. diff --git a/include/asm-sparc/contregs.h b/include/asm-sparc/contregs.h index 1657f7d0b..3e4f5075e 100644 --- a/include/asm-sparc/contregs.h +++ b/include/asm-sparc/contregs.h @@ -8,23 +8,27 @@ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ -/* 4=sun4 (as in sun4 sysmaint student book), c=sun4c (according to davem) */ +/* 3=sun3 + 4=sun4 (as in sun4 sysmaint student book) + c=sun4c (according to davem) */ -#define AC_IDPROM 0x00000000 /* 4 ID PROM, R/O, byte, 32 bytes */ -#define AC_CONTEXT 0x30000000 /* 4c current mmu-context */ -#define AC_SENABLE 0x40000000 /* 4c system dvma/cache/reset enable reg */ -#define AC_UDVMA_ENB 0x50000000 /* 4 Not used on Sun boards, byte */ -#define AC_BUS_ERROR 0x60000000 /* 4 Not cleared on read, byte. */ +#define AC_IDPROM 0x00000000 /* 34 ID PROM, R/O, byte, 32 bytes */ +#define AC_PAGEMAP 0x10000000 /* 3 Pagemap R/W, long */ +#define AC_SEGMAP 0x20000000 /* 3 Segment map, byte */ +#define AC_CONTEXT 0x30000000 /* 34c current mmu-context */ +#define AC_SENABLE 0x40000000 /* 34c system dvma/cache/reset enable reg*/ +#define AC_UDVMA_ENB 0x50000000 /* 34 Not used on Sun boards, byte */ +#define AC_BUS_ERROR 0x60000000 /* 34 Not cleared on read, byte. */ #define AC_SYNC_ERR 0x60000000 /* c fault type */ #define AC_SYNC_VA 0x60000004 /* c fault virtual address */ #define AC_ASYNC_ERR 0x60000008 /* c asynchronous fault type */ #define AC_ASYNC_VA 0x6000000c /* c async fault virtual address */ -#define AC_LEDS 0x70000000 /* 4 Zero turns on LEDs, byte */ -#define AC_CACHETAGS 0x80000000 /* 4c direct access to the VAC tags */ -#define AC_CACHEDDATA 0x90000000 /* c direct access to the VAC data */ +#define AC_LEDS 0x70000000 /* 34 Zero turns on LEDs, byte */ +#define AC_CACHETAGS 0x80000000 /* 34c direct access to the VAC tags */ +#define AC_CACHEDDATA 0x90000000 /* 3 c direct access to the VAC data */ #define AC_UDVMA_MAP 0xD0000000 /* 4 Not used on Sun boards, byte */ #define AC_VME_VECTOR 0xE0000000 /* 4 For non-Autovector VME, byte */ -#define AC_BOOT_SCC 0xF0000000 /* 4 bypass to access Zilog 8530. byte. */ +#define AC_BOOT_SCC 0xF0000000 /* 34 bypass to access Zilog 8530. byte.*/ /* s=Swift, h=Ross_HyperSPARC, v=TI_Viking, t=Tsunami, r=Ross_Cypress */ #define AC_M_PCR 0x0000 /* shv Processor Control Reg */ diff --git a/include/asm-sparc/mmu.h b/include/asm-sparc/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-sparc/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h index 41b96727a..2be6f36f0 100644 --- a/include/asm-sparc/processor.h +++ b/include/asm-sparc/processor.h @@ -153,12 +153,8 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -#define copy_segments(__tsk, __mm) \ - if((__tsk) == current && \ - (__mm) != NULL) \ - flush_user_windows() +#define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) #define get_wchan(__TSK) \ ({ extern void scheduling_functions_start_here(void); \ diff --git a/include/asm-sparc64/mmu.h b/include/asm-sparc64/mmu.h new file mode 100644 index 000000000..ccd36d266 --- /dev/null +++ b/include/asm-sparc64/mmu.h @@ -0,0 +1,7 @@ +#ifndef __MMU_H +#define __MMU_H + +/* Default "unsigned long" context */ +typedef unsigned long mm_context_t; + +#endif diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index 562cf4ba8..f26dd254d 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -220,7 +220,6 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) -#define forget_segments() do { } while (0) #define get_wchan(__TSK) \ ({ extern void scheduling_functions_start_here(void); \ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 7a045f033..ff1dcaf45 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -28,6 +28,8 @@ #include <linux/wait.h> #endif /* __KERNEL__ */ +u64 acpi_get_rsdp_ptr(void); + /* * System sleep states */ @@ -64,10 +66,13 @@ typedef int acpi_dstate_t; #define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */ #define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */ #define ACPI_RSDT_SIG 0x54445352 /* 'RSDT' */ -#define ACPI_FACP_SIG 0x50434146 /* 'FACP' */ +#define ACPI_FADT_SIG 0x50434146 /* 'FACP' */ #define ACPI_DSDT_SIG 0x54445344 /* 'DSDT' */ #define ACPI_FACS_SIG 0x53434146 /* 'FACS' */ +#define ACPI_SIG_LEN 4 +#define ACPI_FADT_SIGNATURE "FACP" + /* PM1_STS/EN flags */ #define ACPI_TMR 0x0001 #define ACPI_BM 0x0010 @@ -90,19 +95,20 @@ typedef int acpi_dstate_t; #define ACPI_SLP_TYP_SHIFT 10 /* PM_TMR masks */ -#define ACPI_TMR_MASK 0x00ffffff -#define ACPI_TMR_HZ 3580000 /* 3.58 MHz */ +#define ACPI_TMR_VAL_EXT 0x00000100 +#define ACPI_TMR_MASK 0x00ffffff +#define ACPI_TMR_HZ 3580000 /* 3.58 MHz */ /* strangess to avoid integer overflow */ -#define ACPI_uS_TO_TMR_TICKS(val) \ +#define ACPI_MICROSEC_TO_TMR_TICKS(val) \ (((val) * (ACPI_TMR_HZ / 10000)) / 100) -#define ACPI_TMR_TICKS_TO_uS(ticks) \ +#define ACPI_TMR_TICKS_TO_MICROSEC(ticks) \ (((ticks) * 100) / (ACPI_TMR_HZ / 10000)) /* PM2_CNT flags */ #define ACPI_ARB_DIS 0x01 -/* FACP flags */ +/* FADT flags */ #define ACPI_WBINVD 0x00000001 #define ACPI_WBINVD_FLUSH 0x00000002 #define ACPI_PROC_C1 0x00000004 @@ -114,9 +120,9 @@ typedef int acpi_dstate_t; #define ACPI_TMR_VAL_EXT 0x00000100 #define ACPI_DCK_CAP 0x00000200 -/* FACP BOOT_ARCH flags */ -#define FACP_BOOT_ARCH_LEGACY_DEVICES 0x0001 -#define FACP_BOOT_ARCH_KBD_CONTROLLER 0x0002 +/* FADT BOOT_ARCH flags */ +#define FADT_BOOT_ARCH_LEGACY_DEVICES 0x0001 +#define FADT_BOOT_ARCH_KBD_CONTROLLER 0x0002 /* FACS flags */ #define ACPI_S4BIOS 0x00000001 @@ -131,77 +137,6 @@ typedef int acpi_dstate_t; #define ACPI_MAX_P_LVL3_LAT 1000 #define ACPI_INFINITE_LAT (~0UL) -struct acpi_rsdp { - __u32 signature[2]; - __u8 checksum; - __u8 oem[6]; - __u8 reserved; - __u32 rsdt; -} __attribute__ ((packed)); - -struct acpi_table { - __u32 signature; - __u32 length; - __u8 rev; - __u8 checksum; - __u8 oem[6]; - __u8 oem_table[8]; - __u32 oem_rev; - __u32 creator; - __u32 creator_rev; -} __attribute__ ((packed)); - -struct acpi_facp { - struct acpi_table hdr; - __u32 facs; - __u32 dsdt; - __u8 int_model; - __u8 reserved; - __u16 sci_int; - __u32 smi_cmd; - __u8 acpi_enable; - __u8 acpi_disable; - __u8 s4bios_req; - __u8 reserved2; - __u32 pm1a_evt; - __u32 pm1b_evt; - __u32 pm1a_cnt; - __u32 pm1b_cnt; - __u32 pm2_cnt; - __u32 pm_tmr; - __u32 gpe0; - __u32 gpe1; - __u8 pm1_evt_len; - __u8 pm1_cnt_len; - __u8 pm2_cnt_len; - __u8 pm_tm_len; - __u8 gpe0_len; - __u8 gpe1_len; - __u8 gpe1_base; - __u8 reserved3; - __u16 p_lvl2_lat; - __u16 p_lvl3_lat; - __u16 flush_size; - __u16 flush_stride; - __u8 duty_offset; - __u8 duty_width; - __u8 day_alarm; - __u8 mon_alarm; - __u8 century; - __u16 boot_arch; - __u8 reserved6; - __u32 flags; -} __attribute__ ((packed)); - -struct acpi_facs { - __u32 signature; - __u32 length; - __u32 hw_signature; - __u32 fw_wake_vector; - __u32 global_lock; - __u32 flags; -} __attribute__ ((packed)); - /* * Sysctl declarations */ @@ -213,9 +148,8 @@ enum enum { - ACPI_FACP = 1, + ACPI_FADT = 1, ACPI_DSDT, - ACPI_FACS, ACPI_PM1_ENABLE, ACPI_GPE_ENABLE, ACPI_GPE_LEVEL, @@ -232,71 +166,12 @@ enum ACPI_S1_SLP_TYP, ACPI_S5_SLP_TYP, ACPI_SLEEP, + ACPI_FACS, + ACPI_XSDT, + ACPI_PMTIMER, + ACPI_BATTERY, }; #define ACPI_SLP_TYP_DISABLED (~0UL) -/* - * PIIX4-specific ACPI info (for systems with PIIX4 but no ACPI tables) - */ - -#define ACPI_PIIX4_INT_MODEL 0x00 -#define ACPI_PIIX4_SCI_INT 0x0009 - -#define ACPI_PIIX4_SMI_CMD 0x00b2 -#define ACPI_PIIX4_ACPI_ENABLE 0xf0 -#define ACPI_PIIX4_ACPI_DISABLE 0xf1 -#define ACPI_PIIX4_S4BIOS_REQ 0xf2 - -#define ACPI_PIIX4_PM1_EVT 0x0000 -#define ACPI_PIIX4_PM1_CNT 0x0004 -#define ACPI_PIIX4_S0_MASK (0x0005 << 10) -#define ACPI_PIIX4_S1_MASK (0x0004 << 10) -#define ACPI_PIIX4_S2_MASK (0x0003 << 10) -#define ACPI_PIIX4_S3_MASK (0x0002 << 10) -#define ACPI_PIIX4_S4_MASK (0x0001 << 10) -#define ACPI_PIIX4_S5_MASK (0x0000 << 10) -#define ACPI_PIIX4_PM_TMR 0x0008 -#define ACPI_PIIX4_GPE0 0x000c -#define ACPI_PIIX4_P_BLK 0x0010 - -#define ACPI_PIIX4_PM1_EVT_LEN 0x04 -#define ACPI_PIIX4_PM1_CNT_LEN 0x02 -#define ACPI_PIIX4_PM_TM_LEN 0x04 -#define ACPI_PIIX4_GPE0_LEN 0x04 - -#define ACPI_PIIX4_PM2_CNT 0x0022 -#define ACPI_PIIX4_PM2_CNT_LEN 0x01 - -#define ACPI_PIIX4_PMREGMISC 0x80 -#define ACPI_PIIX4_PMIOSE 0x01 - -/* - * VIA-specific ACPI info (for systems with VT82C586B but no ACPI tables) - */ - -#define ACPI_VIA_INT_MODEL 0x00 - -#define ACPI_VIA_SMI_CMD 0x002f -#define ACPI_VIA_ACPI_ENABLE 0xa1 -#define ACPI_VIA_ACPI_DISABLE 0xa0 - -#define ACPI_VIA_PM1_EVT 0x0000 -#define ACPI_VIA_PM1_CNT 0x0004 -#define ACPI_VIA_PM_TMR 0x0008 -#define ACPI_VIA_GPE0 0x0020 -#define ACPI_VIA_P_BLK 0x0010 - -#define ACPI_VIA_PM1_EVT_LEN 0x04 -#define ACPI_VIA_PM1_CNT_LEN 0x02 -#define ACPI_VIA_PM_TM_LEN 0x04 -#define ACPI_VIA_GPE0_LEN 0x04 - -#define ACPI_VIA_DUTY_OFFSET 1 -#define ACPI_VIA_DUTY_WIDTH 3 - -#define ACPI_VIA_DAY_ALARM 0x7d -#define ACPI_VIA_MON_ALARM 0x7e -#define ACPI_VIA_CENTURY 0x7f - #endif /* _LINUX_ACPI_H */ diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h index 99df46b37..a9d0af58a 100644 --- a/include/linux/agp_backend.h +++ b/include/linux/agp_backend.h @@ -47,6 +47,7 @@ enum chipset_type { INTEL_I810, INTEL_I815, INTEL_I840, + INTEL_I850, VIA_GENERIC, VIA_VP3, VIA_MVP3, diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h index a79f45bc3..18787f9b2 100644 --- a/include/linux/atm_tcp.h +++ b/include/linux/atm_tcp.h @@ -65,6 +65,7 @@ struct atm_tcp_ops { int (*attach)(struct atm_vcc *vcc,int itf); int (*create_persistent)(int itf); int (*remove_persistent)(int itf); + struct module *owner; }; extern struct atm_tcp_ops atm_tcp_ops; diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index d169bf7f2..ef8931cd7 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -375,6 +375,7 @@ struct atmdev_ops { /* only send is required */ void (*free_rx_skb)(struct atm_vcc *vcc, struct sk_buff *skb); /* @@@ temporary hack */ int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page); + struct module *owner; }; diff --git a/include/linux/blk.h b/include/linux/blk.h index eb4d603e7..11db342a3 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -163,6 +163,14 @@ static void floppy_off(unsigned int nr); #define DEVICE_INTR do_st #define DEVICE_NR(device) (MINOR(device) & 0x7f) +#elif (MAJOR_NR == OSST_MAJOR) + +#define DEVICE_NAME "onstream" +#define DEVICE_INTR do_osst +#define DEVICE_NR(device) (MINOR(device) & 0x7f) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == SCSI_CDROM_MAJOR) #define DEVICE_NAME "CD-ROM" @@ -328,7 +336,7 @@ static void floppy_off(unsigned int nr); #define DEVICE_OFF(device) do {} while (0) #endif -#if (MAJOR_NR != SCSI_TAPE_MAJOR) +#if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR) #if !defined(IDE_DRIVER) #ifndef CURRENT diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 77808a7a3..7d59238dd 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -280,7 +280,9 @@ struct cdrom_generic_command int stat; struct request_sense *sense; unsigned char data_direction; - void *reserved[3]; + int quiet; + int timeout; + void *reserved[1]; }; diff --git a/include/linux/delay.h b/include/linux/delay.h index e1cf03d69..0454b786d 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h @@ -4,10 +4,10 @@ /* * Copyright (C) 1993 Linus Torvalds * - * Delay routines, using a pre-computed "loops_per_second" value. + * Delay routines, using a pre-computed "loops_per_jiffy" value. */ -extern unsigned long loops_per_sec; +extern unsigned long loops_per_jiffy; #include <asm/delay.h> diff --git a/include/linux/dtlk.h b/include/linux/dtlk.h index 07a6b82bc..2896d9011 100644 --- a/include/linux/dtlk.h +++ b/include/linux/dtlk.h @@ -27,7 +27,7 @@ #define DTLK_CLEAR 0x18 /* stops speech */ -#define DTLK_MAX_RETRIES (loops_per_sec/10000) +#define DTLK_MAX_RETRIES (loops_per_jiffy/(10000/HZ)) /* TTS Port Status Flags */ #define TTS_READABLE 0x80 /* mask for bit which is nonzero if a diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index dd9fdcfaf..63922d2c0 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -429,11 +429,23 @@ struct ext2_super_block { */ #define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ - ( EXT2_SB(sb)->s_feature_compat & (mask) ) + ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) #define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ - ( EXT2_SB(sb)->s_feature_ro_compat & (mask) ) + ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ - ( EXT2_SB(sb)->s_feature_incompat & (mask) ) + ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) +#define EXT2_SET_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) +#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) +#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) +#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) +#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) +#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \ + EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) #define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 @@ -524,7 +536,8 @@ struct ext2_dir_entry_2 { extern int ext2_permission (struct inode *, int); /* balloc.c */ -extern int ext2_group_sparse(int group); +extern int ext2_bg_has_super(struct super_block *sb, int group); +extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group); extern int ext2_new_block (const struct inode *, unsigned long, __u32 *, __u32 *, int *); extern void ext2_free_blocks (const struct inode *, unsigned long, @@ -584,6 +597,7 @@ extern NORET_TYPE void ext2_panic (struct super_block *, const char *, __attribute__ ((NORET_AND format (printf, 3, 4))); extern void ext2_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); +extern void ext2_update_dynamic_rev (struct super_block *sb); extern void ext2_put_super (struct super_block *); extern void ext2_write_super (struct super_block *); extern int ext2_remount (struct super_block *, int *, char *); diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h index 69b35b7f7..2e72dfbef 100644 --- a/include/linux/ext2_fs_sb.h +++ b/include/linux/ext2_fs_sb.h @@ -35,7 +35,7 @@ struct ext2_sb_info { unsigned long s_blocks_per_group;/* Number of blocks in a group */ unsigned long s_inodes_per_group;/* Number of inodes in a group */ unsigned long s_itb_per_group; /* Number of inode table blocks per group */ - unsigned long s_db_per_group; /* Number of descriptor blocks per group */ + unsigned long s_gdb_count; /* Number of group descriptor blocks */ unsigned long s_desc_per_block; /* Number of group descriptors per block */ unsigned long s_groups_count; /* Number of groups in the fs */ struct buffer_head * s_sbh; /* Buffer containing the super block */ @@ -56,9 +56,6 @@ struct ext2_sb_info { int s_desc_per_block_bits; int s_inode_size; int s_first_ino; - int s_feature_compat; - int s_feature_incompat; - int s_feature_ro_compat; }; #endif /* _LINUX_EXT2_FS_SB */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 2ef374aa1..8032db992 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -283,6 +283,7 @@ extern void set_bh_page(struct buffer_head *bh, struct page *page, unsigned long #include <linux/efs_fs_i.h> #include <linux/coda_fs_i.h> #include <linux/romfs_fs_i.h> +#include <linux/shmem_fs.h> #include <linux/smb_fs_i.h> #include <linux/hfs_fs_i.h> #include <linux/adfs_fs_i.h> @@ -362,10 +363,12 @@ struct address_space_operations { }; struct address_space { - struct list_head pages; /* list of pages */ - unsigned long nrpages; /* number of pages */ + struct list_head clean_pages; /* list of clean pages */ + struct list_head dirty_pages; /* list of dirty pages */ + struct list_head locked_pages; /* list of locked pages */ + unsigned long nrpages; /* number of total pages */ struct address_space_operations *a_ops; /* methods */ - void *host; /* owner: inode, block_device */ + struct inode *host; /* owner: inode, block_device */ struct vm_area_struct *i_mmap; /* list of private mappings */ struct vm_area_struct *i_mmap_shared; /* list of shared mappings */ spinlock_t i_shared_lock; /* and spinlock protecting it */ @@ -441,6 +444,7 @@ struct inode { struct ufs_inode_info ufs_i; struct efs_inode_info efs_i; struct romfs_inode_info romfs_i; + struct shmem_inode_info shmem_i; struct coda_inode_info coda_i; struct smb_inode_info smbfs_i; struct hfs_inode_info hfs_i; @@ -459,11 +463,12 @@ struct inode { /* Inode state bits.. */ #define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */ #define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */ -#define I_LOCK 4 -#define I_FREEING 8 -#define I_CLEAR 16 +#define I_DIRTY_PAGES 4 /* Data-related inode changes pending */ +#define I_LOCK 8 +#define I_FREEING 16 +#define I_CLEAR 32 -#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC) +#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) extern void __mark_inode_dirty(struct inode *, int); static inline void mark_inode_dirty(struct inode *inode) @@ -478,6 +483,12 @@ static inline void mark_inode_dirty_sync(struct inode *inode) __mark_inode_dirty(inode, I_DIRTY_SYNC); } +static inline void mark_inode_dirty_pages(struct inode *inode) +{ + if (inode && !(inode->i_state & I_DIRTY_PAGES)) + __mark_inode_dirty(inode, I_DIRTY_PAGES); +} + struct fown_struct { int pid; /* pid or -pgrp where SIGIO should be sent */ uid_t uid, euid; /* uid/euid of process setting the owner */ @@ -685,6 +696,7 @@ struct super_block { struct affs_sb_info affs_sb; struct ufs_sb_info ufs_sb; struct efs_sb_info efs_sb; + struct shmem_sb_info shmem_sb; struct romfs_sb_info romfs_sb; struct smb_sb_info smbfs_sb; struct hfs_sb_info hfs_sb; @@ -1061,6 +1073,8 @@ extern int fsync_dev(kdev_t); extern int fsync_inode_buffers(struct inode *); extern int osync_inode_buffers(struct inode *); extern int inode_has_buffers(struct inode *); +extern void filemap_fdatasync(struct address_space *); +extern void filemap_fdatawait(struct address_space *); extern void sync_supers(kdev_t); extern int bmap(struct inode *, int); extern int notify_change(struct dentry *, struct iattr *); diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index c90f838a4..cc8951800 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h @@ -92,7 +92,7 @@ void gs_stop(struct tty_struct *tty); void gs_start(struct tty_struct *tty); void gs_hangup(struct tty_struct *tty); void gs_do_softint(void *private_); -int block_til_ready(void *port, struct file *filp); +int gs_block_til_ready(void *port, struct file *filp); void gs_close(struct tty_struct *tty, struct file *filp); void gs_set_termios (struct tty_struct * tty, struct termios * old_termios); diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h index 39ed2adfa..4d9ef78e0 100644 --- a/include/linux/i2c-dev.h +++ b/include/linux/i2c-dev.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: i2c-dev.h,v 1.7 2000/02/15 17:57:27 frodo Exp $ */ +/* $Id: i2c-dev.h,v 1.8 2000/08/12 16:37:15 mds Exp $ */ #ifndef I2C_DEV_H #define I2C_DEV_H @@ -162,6 +162,20 @@ extern inline __s32 i2c_smbus_write_block_data(int file, __u8 command, I2C_SMBUS_BLOCK_DATA, &data); } +extern inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, + __u8 length, __u8 *values) +{ + union i2c_smbus_data data; + int i; + if (length > 32) + length = 32; + for (i = 1; i <= length; i++) + data.block[i] = values[i-1]; + data.block[0] = length; + return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, + I2C_SMBUS_I2C_BLOCK_DATA, &data); +} + #endif /* ndef __KERNEL__ */ #endif diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 9c123fa48..b5793e818 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ -/* $Id: i2c-id.h,v 1.16 2000/04/03 18:57:42 frodo Exp $ */ +/* $Id: i2c-id.h,v 1.25 2000/10/12 07:27:29 simon Exp $ */ #ifndef I2C_ID_H #define I2C_ID_H @@ -71,6 +71,20 @@ #define I2C_DRIVERID_PCF8583 25 /* real time clock */ #define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */ #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ +#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ +#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ +#define I2C_DRIVERID_DPL3518 30 /* Dolby decoder chip */ +#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */ +#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ +#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */ + +#define I2C_DRIVERID_SBATT 34 /* Smart Battery Device */ +#define I2C_DRIVERID_SBS 35 /* SB System Manager */ +#define I2C_DRIVERID_VES1893 36 /* VLSI DVB-S decoder */ +#define I2C_DRIVERID_VES1820 37 /* VLSI DVB-C decoder */ +#define I2C_DRIVERID_SAA7113 38 /* video decoder */ +#define I2C_DRIVERID_TDA8444 39 /* octuple 6-bit DAC */ + #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ #define I2C_DRIVERID_EXP1 0xF1 @@ -94,6 +108,11 @@ #define I2C_ALGO_SMBUS 0x040000 #define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */ #define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */ +#define I2C_ALGO_ACB 0x070000 /* ACCESS.bus algorithm */ + +#define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */ + +#define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */ #define I2C_ALGO_EXP 0x800000 /* experimental */ @@ -128,6 +147,12 @@ #define I2C_HW_P_ISA 0x01 /* generic ISA Bus inteface card */ #define I2C_HW_P_ELEK 0x02 /* Elektor ISA Bus inteface card */ +/* --- ACPI Embedded controller algorithms */ +#define I2C_HW_ACPI_EC 0x00 + +/* --- MPC8xx PowerPC adapters */ +#define I2C_HW_MPC8XX_EPON 0x00 /* Eponymous MPC8xx I2C adapter */ + /* --- SMBus only adapters */ #define I2C_HW_SMBUS_PIIX4 0x00 #define I2C_HW_SMBUS_ALI15X3 0x01 @@ -136,6 +161,7 @@ #define I2C_HW_SMBUS_I801 0x04 #define I2C_HW_SMBUS_AMD756 0x05 #define I2C_HW_SMBUS_SIS5595 0x06 +#define I2C_HW_SMBUS_ALI1535 0x07 /* --- ISA pseudo-adapter */ #define I2C_HW_ISA 0x00 diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 4043c0353..4a9eb86c8 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -23,7 +23,7 @@ /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and Frodo Looijaard <frodol@dds.nl> */ -/* $Id: i2c.h,v 1.40 2000/07/19 19:55:45 frodo Exp $ */ +/* $Id: i2c.h,v 1.42 2000/09/06 20:14:06 frodo Exp $ */ #ifndef I2C_H #define I2C_H @@ -120,6 +120,9 @@ extern s32 i2c_smbus_read_block_data(struct i2c_client * client, extern s32 i2c_smbus_write_block_data(struct i2c_client * client, u8 command, u8 length, u8 *values); +extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, + u8 command, u8 length, + u8 *values); /* @@ -436,12 +439,13 @@ union i2c_smbus_data { /* SMBus transaction types (size parameter in the above functions) Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ -#define I2C_SMBUS_QUICK 0 -#define I2C_SMBUS_BYTE 1 -#define I2C_SMBUS_BYTE_DATA 2 -#define I2C_SMBUS_WORD_DATA 3 -#define I2C_SMBUS_PROC_CALL 4 -#define I2C_SMBUS_BLOCK_DATA 5 +#define I2C_SMBUS_QUICK 0 +#define I2C_SMBUS_BYTE 1 +#define I2C_SMBUS_BYTE_DATA 2 +#define I2C_SMBUS_WORD_DATA 3 +#define I2C_SMBUS_PROC_CALL 4 +#define I2C_SMBUS_BLOCK_DATA 5 +#define I2C_SMBUS_I2C_BLOCK_DATA 6 /* ----- commands for the ioctl like i2c_command call: diff --git a/include/linux/init.h b/include/linux/init.h index 6ef5b4c78..8ffe2aeef 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -65,7 +65,7 @@ extern struct kernel_param __setup_start, __setup_end; #define __setup(str, fn) \ static char __setup_str_##fn[] __initdata = str; \ - static struct kernel_param __setup_##fn __initsetup = { __setup_str_##fn, fn } + static struct kernel_param __setup_##fn __attribute__((unused)) __initsetup = { __setup_str_##fn, fn } #endif /* __ASSEMBLY__ */ diff --git a/include/linux/ixjuser.h b/include/linux/ixjuser.h index 2aca5e2c8..5310a15e0 100644 --- a/include/linux/ixjuser.h +++ b/include/linux/ixjuser.h @@ -568,16 +568,16 @@ typedef struct { /****************************************************************************** * -* The DAA Analog GAIN sets 2 parameters at one time, the recieve gain (AGRR), +* The DAA Analog GAIN sets 2 parameters at one time, the receive gain (AGRR), * and the transmit gain (AGX). OR together the components and pass them * as the parameter to IXJCTL_DAA_AGAIN. The default setting is both at 0dB. * ******************************************************************************/ #define IXJCTL_DAA_AGAIN _IOW ('q', 0xD2, int) -#define AGRR00DB 0x00 // Analog gain in recieve direction 0dB -#define AGRR3_5DB 0x10 // Analog gain in recieve direction 3.5dB -#define AGRR06DB 0x30 // Analog gain in recieve direction 6dB +#define AGRR00DB 0x00 // Analog gain in receive direction 0dB +#define AGRR3_5DB 0x10 // Analog gain in receive direction 3.5dB +#define AGRR06DB 0x30 // Analog gain in receive direction 6dB #define AGX00DB 0x00 // Analog gain in transmit direction 0dB #define AGX_6DB 0x04 // Analog gain in transmit direction -6dB diff --git a/include/linux/lvm.h b/include/linux/lvm.h index 2600a75a1..7b4ff94f9 100644 --- a/include/linux/lvm.h +++ b/include/linux/lvm.h @@ -1,12 +1,14 @@ /* + * include/linux/lvm.h * kernel/lvm.h + * tools/lib/lvm.h * - * Copyright (C) 1997 - 2000 Heinz Mauelshagen, Germany + * Copyright (C) 1997 - 2000 Heinz Mauelshagen, Sistina Software * * February-November 1997 * May-July 1998 * January-March,July,September,October,Dezember 1999 - * January 2000 + * January,February,July,November 2000 * * lvm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,6 +51,12 @@ * 08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit * 01/01/2000 - extended lv_v2 core structure by wait_queue member * 12/02/2000 - integrated Andrea Arcagnelli's snapshot work + * 18/02/2000 - seperated user and kernel space parts by + * #ifdef them with __KERNEL__ + * 08/03/2000 - implemented cluster/shared bits for vg_access + * 26/06/2000 - implemented snapshot persistency and resizing support + * 02/11/2000 - added hash table size member to lv structure + * 12/11/2000 - removed unneeded timestamp definitions * */ @@ -56,7 +64,11 @@ #ifndef _LVM_H_INCLUDE #define _LVM_H_INCLUDE -#define _LVM_H_VERSION "LVM 0.8final (15/2/2000)" +#define _LVM_KERNEL_H_VERSION "LVM 0.9 (13/11/2000)" + +#include <linux/config.h> +#include <linux/version.h> +#include <endian.h> /* * preprocessor definitions @@ -64,8 +76,9 @@ /* if you like emergency reset code in the driver */ #define LVM_TOTAL_RESET +#ifdef __KERNEL__ #define LVM_GET_INODE -#undef LVM_HD_NAME +#undef LVM_HD_NAME /* display nice names in /proc/partitions */ /* lots of debugging output (see driver source) #define DEBUG_LVM_GET_INFO @@ -79,37 +92,50 @@ #define DEBUG_LVM_BLK_OPEN #define DEBUG_KFREE */ - -#include <linux/version.h> +#endif /* #ifdef __KERNEL__ */ #ifndef __KERNEL__ -#define ____NOT_KERNEL____ #define __KERNEL__ -#endif #include <linux/kdev_t.h> -#ifdef ____NOT_KERNEL____ -#undef ____NOT_KERNEL____ +#include <linux/list.h> #undef __KERNEL__ -#endif +#else +#include <linux/kdev_t.h> +#include <linux/list.h> +#endif /* #ifndef __KERNEL__ */ +#include <asm/types.h> #include <linux/major.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION ( 2, 3 ,0) +#ifdef __KERNEL__ #include <linux/spinlock.h> -#else -#include <asm/spinlock.h> -#endif - #include <asm/semaphore.h> +#endif /* #ifdef __KERNEL__ */ + #include <asm/page.h> #if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR) #error Bad include/linux/major.h - LVM MAJOR undefined #endif +#ifdef BLOCK_SIZE +#undef BLOCK_SIZE +#endif + +#ifdef CONFIG_ARCH_S390 +#define BLOCK_SIZE 4096 +#else +#define BLOCK_SIZE 1024 +#endif + +#ifndef SECTOR_SIZE +#define SECTOR_SIZE 512 +#endif #define LVM_STRUCT_VERSION 1 /* structure version */ +#define LVM_DIR_PREFIX "/dev/" + #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif @@ -119,26 +145,33 @@ /* set the default structure version */ #if ( LVM_STRUCT_VERSION == 1) -#define pv_t pv_v1_t -#define lv_t lv_v2_t -#define vg_t vg_v1_t -#define pv_disk_t pv_disk_v1_t -#define lv_disk_t lv_disk_v1_t -#define vg_disk_t vg_disk_v1_t -#define lv_exception_t lv_v2_exception_t +#define pv_t pv_v2_t +#define lv_t lv_v4_t +#define vg_t vg_v3_t +#define pv_disk_t pv_disk_v2_t +#define lv_disk_t lv_disk_v3_t +#define vg_disk_t vg_disk_v2_t +#define lv_block_exception_t lv_block_exception_v1_t +#define lv_COW_table_disk_t lv_COW_table_disk_v1_t #endif + /* - * i/o protocoll version + * i/o protocol version * * defined here for the driver and defined seperate in the - * user land LVM parts + * user land tools/lib/liblvm.h * */ -#define LVM_DRIVER_IOP_VERSION 6 +#define LVM_DRIVER_IOP_VERSION 10 #define LVM_NAME "lvm" +#define LVM_GLOBAL "global" +#define LVM_DIR "lvm" +#define LVM_VG_SUBDIR "VGs" +#define LVM_LV_SUBDIR "LVs" +#define LVM_PV_SUBDIR "PVs" /* * VG/LV indexing macros @@ -216,11 +249,12 @@ #define LVM_TIMESTAMP_DISK_SIZE 512L /* reserved for timekeeping */ /* name list of physical volumes on disk */ -#define LVM_PV_NAMELIST_DISK_BASE ( LVM_TIMESTAMP_DISK_BASE + \ +#define LVM_PV_UUIDLIST_DISK_BASE ( LVM_TIMESTAMP_DISK_BASE + \ LVM_TIMESTAMP_DISK_SIZE) /* now for the dynamically calculated parts of the VGDA */ -#define LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + sizeof ( lv_t) * b) +#define LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + \ + sizeof ( lv_disk_t) * b) #define LVM_DISK_SIZE(pv) ( (pv)->pe_on_disk.base + \ (pv)->pe_on_disk.size) #define LVM_PE_DISK_OFFSET(pe, pv) ( pe * pv->pe_size + \ @@ -250,21 +284,21 @@ * Should be a sufficient spectrum ;*) */ -/* This is the usable size of disk_pe_t.le_num !!! v v */ +/* This is the usable size of pe_disk_t.le_num !!! v v */ #define LVM_PE_T_MAX ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2) -#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( long long) 2*1024*1024*1024 ? ( long long) 2*1024*1024*1024 : ( long long) LVM_PE_T_MAX * (a)->pe_size) -#define LVM_MIN_PE_SIZE ( 8L * 2) /* 8 KB in sectors */ -#define LVM_MAX_PE_SIZE ( 16L * 1024L * 1024L * 2) /* 16GB in sectors */ -#define LVM_DEFAULT_PE_SIZE ( 4096L * 2) /* 4 MB in sectors */ +#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( long long) 1024*1024/SECTOR_SIZE*1024*1024 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024 : ( long long) LVM_PE_T_MAX * (a)->pe_size) +#define LVM_MIN_PE_SIZE ( 8192L / SECTOR_SIZE) /* 8 KB in sectors */ +#define LVM_MAX_PE_SIZE ( 16L * 1024L * 1024L / SECTOR_SIZE * 1024) /* 16GB in sectors */ +#define LVM_DEFAULT_PE_SIZE ( 4096L * 1024 / SECTOR_SIZE) /* 4 MB in sectors */ #define LVM_DEFAULT_STRIPE_SIZE 16L /* 16 KB */ -#define LVM_MIN_STRIPE_SIZE ( PAGE_SIZE>>9) /* PAGESIZE in sectors */ -#define LVM_MAX_STRIPE_SIZE ( 512L * 2) /* 512 KB in sectors */ +#define LVM_MIN_STRIPE_SIZE ( PAGE_SIZE>>9) /* PAGESIZE in sectors */ +#define LVM_MAX_STRIPE_SIZE ( 512L * 1024 / SECTOR_SIZE) /* 512 KB in sectors */ #define LVM_MAX_STRIPES 128 /* max # of stripes */ -#define LVM_MAX_SIZE ( 1024LU * 1024 * 1024 * 2) /* 1TB[sectors] */ +#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024) /* 1TB[sectors] */ #define LVM_MAX_MIRRORS 2 /* future use */ -#define LVM_MIN_READ_AHEAD 0 /* minimum read ahead sectors */ -#define LVM_MAX_READ_AHEAD 256 /* maximum read ahead sectors */ +#define LVM_MIN_READ_AHEAD 2 /* minimum read ahead sectors */ +#define LVM_MAX_READ_AHEAD 120 /* maximum read ahead sectors */ #define LVM_MAX_LV_IO_TIMEOUT 60 /* seconds I/O timeout (future use) */ #define LVM_PARTITION 0xfe /* LVM partition id */ #define LVM_NEW_PARTITION 0x8e /* new LVM partition id (10/09/1999) */ @@ -279,6 +313,64 @@ #define TRUE 1 +#define LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv) ( \ + vg->pe_size / lv->lv_chunk_size) + +#define LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg, lv) ( \ +{ \ + int COW_table_entries_per_PE; \ + int COW_table_chunks_per_PE; \ +\ + COW_table_entries_per_PE = LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv); \ + COW_table_chunks_per_PE = ( COW_table_entries_per_PE * sizeof(lv_COW_table_disk_t) / SECTOR_SIZE + lv->lv_chunk_size - 1) / lv->lv_chunk_size; \ + COW_table_entries_per_PE - COW_table_chunks_per_PE;}) + + +/* to disk and to core data conversion macros */ +#if __BYTE_ORDER == __BIG_ENDIAN + +#define LVM_TO_CORE16(x) ( \ + ((uint16_t)((((uint16_t)(x) & 0x00FFU) << 8) | \ + (((uint16_t)(x) & 0xFF00U) >> 8)))) + +#define LVM_TO_DISK16(x) LVM_TO_CORE16(x) + +#define LVM_TO_CORE32(x) ( \ + ((uint32_t)((((uint32_t)(x) & 0x000000FFU) << 24) | \ + (((uint32_t)(x) & 0x0000FF00U) << 8))) \ + (((uint32_t)(x) & 0x00FF0000U) >> 8))) \ + (((uint32_t)(x) & 0xFF000000U) >> 24)))) + +#define LVM_TO_DISK32(x) LVM_TO_CORE32(x) + +#define LVM_TO_CORE64(x) \ + ((uint64_t)((((uint64_t)(x) & 0x00000000000000FFULL) << 56) | \ + (((uint64_t)(x) & 0x000000000000FF00ULL) << 40) | \ + (((uint64_t)(x) & 0x0000000000FF0000ULL) << 24) | \ + (((uint64_t)(x) & 0x00000000FF000000ULL) << 8) | \ + (((uint64_t)(x) & 0x000000FF00000000ULL) >> 8) | \ + (((uint64_t)(x) & 0x0000FF0000000000ULL) >> 24) | \ + (((uint64_t)(x) & 0x00FF000000000000ULL) >> 40) | \ + (((uint64_t)(x) & 0xFF00000000000000ULL) >> 56))) + +#define LVM_TO_DISK64(x) LVM_TO_CORE64(x) + +#elif __BYTE_ORDER == __LITTLE_ENDIAN + +#define LVM_TO_CORE16(x) x +#define LVM_TO_DISK16(x) x +#define LVM_TO_CORE32(x) x +#define LVM_TO_DISK32(x) x +#define LVM_TO_CORE64(x) x +#define LVM_TO_DISK64(x) x + +#else + +#error "__BYTE_ORDER must be defined as __LITTLE_ENDIAN or __BIG_ENDIAN" + +#endif /* #if __BYTE_ORDER == __BIG_ENDIAN */ + + /* * ioctls */ @@ -294,6 +386,7 @@ #define VG_STATUS_GET_NAMELIST _IOWR ( 0xfe, 0x07, 1) #define VG_SET_EXTENDABLE _IOW ( 0xfe, 0x08, 1) +#define VG_RENAME _IOW ( 0xfe, 0x09, 1) /* logical volume */ @@ -315,6 +408,14 @@ #define LE_REMAP _IOW ( 0xfe, 0x2b, 1) +#define LV_SNAPSHOT_USE_RATE _IOWR ( 0xfe, 0x2c, 1) + +#define LV_STATUS_BYDEV _IOWR ( 0xfe, 0x2e, 1) + +#define LV_RENAME _IOW ( 0xfe, 0x2f, 1) + +#define LV_BMAP _IOWR ( 0xfe, 0x30, 1) + /* physical volume */ #define PV_STATUS _IOWR ( 0xfe, 0x40, 1) @@ -347,6 +448,8 @@ #define VG_READ 0x01 /* vg_access */ #define VG_WRITE 0x02 /* " */ +#define VG_CLUSTERED 0x04 /* " */ +#define VG_SHARED 0x08 /* " */ /* logical volume */ #define LV_ACTIVE 0x01 /* lv_status */ @@ -376,34 +479,36 @@ */ #define NAME_LEN 128 /* don't change!!! */ -#define UUID_LEN 16 /* don't change!!! */ - -/* remap physical sector/rdev pairs */ -typedef struct -{ - struct list_head hash; - ulong rsector_org; - kdev_t rdev_org; - ulong rsector_new; - kdev_t rdev_new; -} lv_block_exception_t; - +#define UUID_LEN 32 /* don't change!!! */ + +/* copy on write tables in disk format */ +typedef struct { + uint64_t pv_org_number; + uint64_t pv_org_rsector; + uint64_t pv_snap_number; + uint64_t pv_snap_rsector; +} lv_COW_table_disk_v1_t; + +/* remap physical sector/rdev pairs including hash */ +typedef struct { + struct list_head hash; + ulong rsector_org; + kdev_t rdev_org; + ulong rsector_new; + kdev_t rdev_new; +} lv_block_exception_v1_t; /* disk stored pe information */ -typedef struct - { - uint16_t lv_num; - uint16_t le_num; - } -disk_pe_t; +typedef struct { + uint16_t lv_num; + uint16_t le_num; +} pe_disk_t; /* disk stored PV, VG, LV and PE size and offset information */ -typedef struct - { - uint32_t base; - uint32_t size; - } -lvm_disk_data_t; +typedef struct { + uint32_t base; + uint32_t size; +} lvm_disk_data_t; /* @@ -411,95 +516,104 @@ lvm_disk_data_t; */ /* core */ -typedef struct - { - uint8_t id[2]; /* Identifier */ - uint16_t version; /* HM lvm version */ - lvm_disk_data_t pv_on_disk; - lvm_disk_data_t vg_on_disk; - lvm_disk_data_t pv_namelist_on_disk; - lvm_disk_data_t lv_on_disk; - lvm_disk_data_t pe_on_disk; - uint8_t pv_name[NAME_LEN]; - uint8_t vg_name[NAME_LEN]; - uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ - kdev_t pv_dev; - uint32_t pv_number; - uint32_t pv_status; - uint32_t pv_allocatable; - uint32_t pv_size; /* HM */ - uint32_t lv_cur; - uint32_t pe_size; - uint32_t pe_total; - uint32_t pe_allocated; - uint32_t pe_stale; /* for future use */ - - disk_pe_t *pe; /* HM */ - struct inode *inode; /* HM */ - } -pv_v1_t; +typedef struct { + char id[2]; /* Identifier */ + unsigned short version; /* HM lvm version */ + lvm_disk_data_t pv_on_disk; + lvm_disk_data_t vg_on_disk; + lvm_disk_data_t pv_namelist_on_disk; + lvm_disk_data_t lv_on_disk; + lvm_disk_data_t pe_on_disk; + char pv_name[NAME_LEN]; + char vg_name[NAME_LEN]; + char system_id[NAME_LEN]; /* for vgexport/vgimport */ + kdev_t pv_dev; + uint pv_number; + uint pv_status; + uint pv_allocatable; + uint pv_size; /* HM */ + uint lv_cur; + uint pe_size; + uint pe_total; + uint pe_allocated; + uint pe_stale; /* for future use */ + pe_disk_t *pe; /* HM */ + struct inode *inode; /* HM */ +} pv_v1_t; -/* disk */ -typedef struct - { - uint8_t id[2]; /* Identifier */ - uint16_t version; /* HM lvm version */ - lvm_disk_data_t pv_on_disk; - lvm_disk_data_t vg_on_disk; - lvm_disk_data_t pv_namelist_on_disk; - lvm_disk_data_t lv_on_disk; - lvm_disk_data_t pe_on_disk; - uint8_t pv_name[NAME_LEN]; - uint8_t vg_name[NAME_LEN]; - uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ - uint32_t pv_major; - uint32_t pv_number; - uint32_t pv_status; - uint32_t pv_allocatable; - uint32_t pv_size; /* HM */ - uint32_t lv_cur; - uint32_t pe_size; - uint32_t pe_total; - uint32_t pe_allocated; - } -pv_disk_v1_t; +/* core */ +typedef struct { + char id[2]; /* Identifier */ + unsigned short version; /* HM lvm version */ + lvm_disk_data_t pv_on_disk; + lvm_disk_data_t vg_on_disk; + lvm_disk_data_t pv_uuidlist_on_disk; + lvm_disk_data_t lv_on_disk; + lvm_disk_data_t pe_on_disk; + char pv_name[NAME_LEN]; + char vg_name[NAME_LEN]; + char system_id[NAME_LEN]; /* for vgexport/vgimport */ + kdev_t pv_dev; + uint pv_number; + uint pv_status; + uint pv_allocatable; + uint pv_size; /* HM */ + uint lv_cur; + uint pe_size; + uint pe_total; + uint pe_allocated; + uint pe_stale; /* for future use */ + pe_disk_t *pe; /* HM */ + struct inode *inode; /* HM */ + char pv_uuid[UUID_LEN+1]; +} pv_v2_t; -/* - * Structure Physical Volume (PV) Version 2 (future!) - */ +/* disk */ +typedef struct { + uint8_t id[2]; /* Identifier */ + uint16_t version; /* HM lvm version */ + lvm_disk_data_t pv_on_disk; + lvm_disk_data_t vg_on_disk; + lvm_disk_data_t pv_namelist_on_disk; + lvm_disk_data_t lv_on_disk; + lvm_disk_data_t pe_on_disk; + uint8_t pv_name[NAME_LEN]; + uint8_t vg_name[NAME_LEN]; + uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ + uint32_t pv_major; + uint32_t pv_number; + uint32_t pv_status; + uint32_t pv_allocatable; + uint32_t pv_size; /* HM */ + uint32_t lv_cur; + uint32_t pe_size; + uint32_t pe_total; + uint32_t pe_allocated; +} pv_disk_v1_t; -typedef struct - { - uint8_t id[2]; /* Identifier */ - uint16_t version; /* HM lvm version */ - lvm_disk_data_t pv_on_disk; - lvm_disk_data_t vg_on_disk; - lvm_disk_data_t pv_uuid_on_disk; - lvm_disk_data_t lv_on_disk; - lvm_disk_data_t pe_on_disk; - uint8_t pv_name[NAME_LEN]; - uint8_t vg_name[NAME_LEN]; - uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ - kdev_t pv_dev; - uint32_t pv_number; - uint32_t pv_status; - uint32_t pv_allocatable; - uint32_t pv_size; /* HM */ - uint32_t lv_cur; - uint32_t pe_size; - uint32_t pe_total; - uint32_t pe_allocated; - uint32_t pe_stale; /* for future use */ - disk_pe_t *pe; /* HM */ - struct inode *inode; /* HM */ - /* delta to version 1 starts here */ - uint8_t pv_uuid[UUID_LEN]; - uint32_t pv_atime; /* PV access time */ - uint32_t pv_ctime; /* PV creation time */ - uint32_t pv_mtime; /* PV modification time */ - } -pv_v2_t; +/* disk */ +typedef struct { + uint8_t id[2]; /* Identifier */ + uint16_t version; /* HM lvm version */ + lvm_disk_data_t pv_on_disk; + lvm_disk_data_t vg_on_disk; + lvm_disk_data_t pv_uuidlist_on_disk; + lvm_disk_data_t lv_on_disk; + lvm_disk_data_t pe_on_disk; + uint8_t pv_uuid[NAME_LEN]; + uint8_t vg_name[NAME_LEN]; + uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ + uint32_t pv_major; + uint32_t pv_number; + uint32_t pv_status; + uint32_t pv_allocatable; + uint32_t pv_size; /* HM */ + uint32_t lv_cur; + uint32_t pe_size; + uint32_t pe_total; + uint32_t pe_allocated; +} pv_disk_v2_t; /* @@ -507,325 +621,256 @@ pv_v2_t; */ /* core PE information */ -typedef struct - { - kdev_t dev; - uint32_t pe; /* to be changed if > 2TB */ - uint32_t reads; - uint32_t writes; - } -pe_t; - -typedef struct - { - uint8_t lv_name[NAME_LEN]; - kdev_t old_dev; - kdev_t new_dev; - ulong old_pe; - ulong new_pe; - } -le_remap_req_t; - - - -/* - * Structure Logical Volume (LV) Version 1 - */ - -/* disk */ -typedef struct - { - uint8_t lv_name[NAME_LEN]; - uint8_t vg_name[NAME_LEN]; - uint32_t lv_access; - uint32_t lv_status; - uint32_t lv_open; /* HM */ - uint32_t lv_dev; /* HM */ - uint32_t lv_number; /* HM */ - uint32_t lv_mirror_copies; /* for future use */ - uint32_t lv_recovery; /* " */ - uint32_t lv_schedule; /* " */ - uint32_t lv_size; - uint32_t dummy; - uint32_t lv_current_le; /* for future use */ - uint32_t lv_allocated_le; - uint32_t lv_stripes; - uint32_t lv_stripesize; - uint32_t lv_badblock; /* for future use */ - uint32_t lv_allocation; - uint32_t lv_io_timeout; /* for future use */ - uint32_t lv_read_ahead; /* HM, for future use */ - } -lv_disk_v1_t; - +typedef struct { + kdev_t dev; + ulong pe; /* to be changed if > 2TB */ + ulong reads; + ulong writes; +} pe_t; + +typedef struct { + char lv_name[NAME_LEN]; + kdev_t old_dev; + kdev_t new_dev; + ulong old_pe; + ulong new_pe; +} le_remap_req_t; + +typedef struct lv_bmap { + ulong lv_block; + dev_t lv_dev; +} lv_bmap_t; /* - * Structure Logical Volume (LV) Version 2 + * Structure Logical Volume (LV) Version 3 */ /* core */ -typedef struct lv_v2 - { - uint8_t lv_name[NAME_LEN]; - uint8_t vg_name[NAME_LEN]; - uint32_t lv_access; - uint32_t lv_status; - uint32_t lv_open; /* HM */ - kdev_t lv_dev; /* HM */ - uint32_t lv_number; /* HM */ - uint32_t lv_mirror_copies; /* for future use */ - uint32_t lv_recovery; /* " */ - uint32_t lv_schedule; /* " */ - uint32_t lv_size; - pe_t *lv_current_pe; /* HM */ - uint32_t lv_current_le; /* for future use */ - uint32_t lv_allocated_le; - uint32_t lv_stripes; - uint32_t lv_stripesize; - uint32_t lv_badblock; /* for future use */ - uint32_t lv_allocation; - uint32_t lv_io_timeout; /* for future use */ - uint32_t lv_read_ahead; - - /* delta to version 1 starts here */ - struct lv_v2 *lv_snapshot_org; - struct lv_v2 *lv_snapshot_prev; - struct lv_v2 *lv_snapshot_next; - lv_block_exception_t *lv_block_exception; - uint8_t __unused; - uint32_t lv_remap_ptr; - uint32_t lv_remap_end; - uint32_t lv_chunk_size; - uint32_t lv_snapshot_minor; - struct kiobuf * lv_iobuf; - struct semaphore lv_snapshot_sem; - struct list_head * lv_snapshot_hash_table; - unsigned long lv_snapshot_hash_mask; -} lv_v2_t; +typedef struct lv_v4 { + char lv_name[NAME_LEN]; + char vg_name[NAME_LEN]; + uint lv_access; + uint lv_status; + uint lv_open; /* HM */ + kdev_t lv_dev; /* HM */ + uint lv_number; /* HM */ + uint lv_mirror_copies; /* for future use */ + uint lv_recovery; /* " */ + uint lv_schedule; /* " */ + uint lv_size; + pe_t *lv_current_pe; /* HM */ + uint lv_current_le; /* for future use */ + uint lv_allocated_le; + uint lv_stripes; + uint lv_stripesize; + uint lv_badblock; /* for future use */ + uint lv_allocation; + uint lv_io_timeout; /* for future use */ + uint lv_read_ahead; + + /* delta to version 1 starts here */ + struct lv_v4 *lv_snapshot_org; + struct lv_v4 *lv_snapshot_prev; + struct lv_v4 *lv_snapshot_next; + lv_block_exception_t *lv_block_exception; + uint lv_remap_ptr; + uint lv_remap_end; + uint lv_chunk_size; + uint lv_snapshot_minor; +#ifdef __KERNEL__ + struct kiobuf *lv_iobuf; + struct semaphore lv_snapshot_sem; + struct list_head *lv_snapshot_hash_table; + ulong lv_snapshot_hash_table_size; + ulong lv_snapshot_hash_mask; + struct page *lv_COW_table_page; + wait_queue_head_t lv_snapshot_wait; + int lv_snapshot_use_rate; + void *vg; +#else + char dummy[200]; +#endif +} lv_v4_t; /* disk */ -typedef struct - { - uint8_t lv_name[NAME_LEN]; - uint8_t vg_name[NAME_LEN]; - uint32_t lv_access; - uint32_t lv_status; - uint32_t lv_open; /* HM */ - uint32_t lv_dev; /* HM */ - uint32_t lv_number; /* HM */ - uint32_t lv_mirror_copies; /* for future use */ - uint32_t lv_recovery; /* " */ - uint32_t lv_schedule; /* " */ - uint32_t lv_size; - uint32_t dummy; - uint32_t lv_current_le; /* for future use */ - uint32_t lv_allocated_le; - uint32_t lv_stripes; - uint32_t lv_stripesize; - uint32_t lv_badblock; /* for future use */ - uint32_t lv_allocation; - uint32_t lv_io_timeout; /* for future use */ - uint32_t lv_read_ahead; /* HM, for future use */ - } -lv_disk_v2_t; - +typedef struct { + uint8_t lv_name[NAME_LEN]; + uint8_t vg_name[NAME_LEN]; + uint32_t lv_access; + uint32_t lv_status; + uint32_t lv_open; /* HM */ + uint32_t lv_dev; /* HM */ + uint32_t lv_number; /* HM */ + uint32_t lv_mirror_copies; /* for future use */ + uint32_t lv_recovery; /* " */ + uint32_t lv_schedule; /* " */ + uint32_t lv_size; + uint32_t lv_snapshot_minor;/* minor number of original */ + uint16_t lv_chunk_size; /* chunk size of snapshot */ + uint16_t dummy; + uint32_t lv_allocated_le; + uint32_t lv_stripes; + uint32_t lv_stripesize; + uint32_t lv_badblock; /* for future use */ + uint32_t lv_allocation; + uint32_t lv_io_timeout; /* for future use */ + uint32_t lv_read_ahead; /* HM */ +} lv_disk_v3_t; /* * Structure Volume Group (VG) Version 1 */ -typedef struct - { - uint8_t vg_name[NAME_LEN]; /* volume group name */ - uint32_t vg_number; /* volume group number */ - uint32_t vg_access; /* read/write */ - uint32_t vg_status; /* active or not */ - uint32_t lv_max; /* maximum logical volumes */ - uint32_t lv_cur; /* current logical volumes */ - uint32_t lv_open; /* open logical volumes */ - uint32_t pv_max; /* maximum physical volumes */ - uint32_t pv_cur; /* current physical volumes FU */ - uint32_t pv_act; /* active physical volumes */ - uint32_t dummy; /* was obsolete max_pe_per_pv */ - uint32_t vgda; /* volume group descriptor arrays FU */ - uint32_t pe_size; /* physical extent size in sectors */ - uint32_t pe_total; /* total of physical extents */ - uint32_t pe_allocated; /* allocated physical extents */ - uint32_t pvg_total; /* physical volume groups FU */ - struct proc_dir_entry *proc; - pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */ - lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */ - } -vg_v1_t; - -typedef struct - { - uint8_t vg_name[NAME_LEN]; /* volume group name */ - uint32_t vg_number; /* volume group number */ - uint32_t vg_access; /* read/write */ - uint32_t vg_status; /* active or not */ - uint32_t lv_max; /* maximum logical volumes */ - uint32_t lv_cur; /* current logical volumes */ - uint32_t lv_open; /* open logical volumes */ - uint32_t pv_max; /* maximum physical volumes */ - uint32_t pv_cur; /* current physical volumes FU */ - uint32_t pv_act; /* active physical volumes */ - uint32_t dummy; - uint32_t vgda; /* volume group descriptor arrays FU */ - uint32_t pe_size; /* physical extent size in sectors */ - uint32_t pe_total; /* total of physical extents */ - uint32_t pe_allocated; /* allocated physical extents */ - uint32_t pvg_total; /* physical volume groups FU */ - } -vg_disk_v1_t; - -/* - * Structure Volume Group (VG) Version 2 - */ - -typedef struct - { - uint8_t vg_name[NAME_LEN]; /* volume group name */ - uint32_t vg_number; /* volume group number */ - uint32_t vg_access; /* read/write */ - uint32_t vg_status; /* active or not */ - uint32_t lv_max; /* maximum logical volumes */ - uint32_t lv_cur; /* current logical volumes */ - uint32_t lv_open; /* open logical volumes */ - uint32_t pv_max; /* maximum physical volumes */ - uint32_t pv_cur; /* current physical volumes FU */ - uint32_t pv_act; /* future: active physical volumes */ - uint32_t max_pe_per_pv; /* OBSOLETE maximum PE/PV */ - uint32_t vgda; /* volume group descriptor arrays FU */ - uint32_t pe_size; /* physical extent size in sectors */ - uint32_t pe_total; /* total of physical extents */ - uint32_t pe_allocated; /* allocated physical extents */ - uint32_t pvg_total; /* physical volume groups FU */ - struct proc_dir_entry *proc; - pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */ - lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */ - /* delta to version 1 starts here */ - uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */ - time_t vg_atime; /* VG access time */ - time_t vg_ctime; /* VG creation time */ - time_t vg_mtime; /* VG modification time */ - } -vg_v2_t; - +/* core */ +typedef struct { + char vg_name[NAME_LEN]; /* volume group name */ + uint vg_number; /* volume group number */ + uint vg_access; /* read/write */ + uint vg_status; /* active or not */ + uint lv_max; /* maximum logical volumes */ + uint lv_cur; /* current logical volumes */ + uint lv_open; /* open logical volumes */ + uint pv_max; /* maximum physical volumes */ + uint pv_cur; /* current physical volumes FU */ + uint pv_act; /* active physical volumes */ + uint dummy; /* was obsolete max_pe_per_pv */ + uint vgda; /* volume group descriptor arrays FU */ + uint pe_size; /* physical extent size in sectors */ + uint pe_total; /* total of physical extents */ + uint pe_allocated; /* allocated physical extents */ + uint pvg_total; /* physical volume groups FU */ + struct proc_dir_entry *proc; + pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */ + lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */ +} vg_v1_t; + +typedef struct { + char vg_name[NAME_LEN]; /* volume group name */ + uint vg_number; /* volume group number */ + uint vg_access; /* read/write */ + uint vg_status; /* active or not */ + uint lv_max; /* maximum logical volumes */ + uint lv_cur; /* current logical volumes */ + uint lv_open; /* open logical volumes */ + uint pv_max; /* maximum physical volumes */ + uint pv_cur; /* current physical volumes FU */ + uint pv_act; /* active physical volumes */ + uint dummy; /* was obsolete max_pe_per_pv */ + uint vgda; /* volume group descriptor arrays FU */ + uint pe_size; /* physical extent size in sectors */ + uint pe_total; /* total of physical extents */ + uint pe_allocated; /* allocated physical extents */ + uint pvg_total; /* physical volume groups FU */ + struct proc_dir_entry *proc; + pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */ + lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */ + char vg_uuid[UUID_LEN+1]; /* volume group UUID */ +#ifdef __KERNEL__ + struct proc_dir_entry *vg_dir_pde; + struct proc_dir_entry *lv_subdir_pde; + struct proc_dir_entry *pv_subdir_pde; +#else + char dummy1[200]; +#endif +} vg_v3_t; -/* - * Timekeeping structure on disk (0.7 feature) - * - * Holds several timestamps for start/stop time of non - * atomic VGDA disk i/o operations - * - */ -typedef struct - { - uint32_t seconds; /* seconds since the epoch */ - uint32_t jiffies; /* micro timer */ - } -lvm_time_t; - -#define TIMESTAMP_ID_SIZE 2 -typedef struct - { - uint8_t id[TIMESTAMP_ID_SIZE]; /* Identifier */ - lvm_time_t pv_vg_lv_pe_io_begin; - lvm_time_t pv_vg_lv_pe_io_end; - lvm_time_t pv_io_begin; - lvm_time_t pv_io_end; - lvm_time_t vg_io_begin; - lvm_time_t vg_io_end; - lvm_time_t lv_io_begin; - lvm_time_t lv_io_end; - lvm_time_t pe_io_begin; - lvm_time_t pe_io_end; - lvm_time_t pe_move_io_begin; - lvm_time_t pe_move_io_end; - uint8_t dummy[LVM_TIMESTAMP_DISK_SIZE - - TIMESTAMP_ID_SIZE - - 12 * sizeof (lvm_time_t)]; - /* ATTENTION ^^ */ - } -timestamp_disk_t; - -/* same on disk and in core so far */ -typedef timestamp_disk_t timestamp_t; - -/* function identifiers for timestamp actions */ -typedef enum - { - PV_VG_LV_PE_IO_BEGIN, - PV_VG_LV_PE_IO_END, - PV_IO_BEGIN, - PV_IO_END, - VG_IO_BEGIN, - VG_IO_END, - LV_IO_BEGIN, - LV_IO_END, - PE_IO_BEGIN, - PE_IO_END, - PE_MOVE_IO_BEGIN, - PE_MOVE_IO_END - } -ts_fct_id_t; +/* disk */ +typedef struct { + uint8_t vg_name[NAME_LEN]; /* volume group name */ + uint32_t vg_number; /* volume group number */ + uint32_t vg_access; /* read/write */ + uint32_t vg_status; /* active or not */ + uint32_t lv_max; /* maximum logical volumes */ + uint32_t lv_cur; /* current logical volumes */ + uint32_t lv_open; /* open logical volumes */ + uint32_t pv_max; /* maximum physical volumes */ + uint32_t pv_cur; /* current physical volumes FU */ + uint32_t pv_act; /* active physical volumes */ + uint32_t dummy; + uint32_t vgda; /* volume group descriptor arrays FU */ + uint32_t pe_size; /* physical extent size in sectors */ + uint32_t pe_total; /* total of physical extents */ + uint32_t pe_allocated; /* allocated physical extents */ + uint32_t pvg_total; /* physical volume groups FU */ +} vg_disk_v1_t; + +typedef struct { + uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */ + uint8_t vg_name_dummy[NAME_LEN-UUID_LEN]; /* rest of v1 VG name */ + uint32_t vg_number; /* volume group number */ + uint32_t vg_access; /* read/write */ + uint32_t vg_status; /* active or not */ + uint32_t lv_max; /* maximum logical volumes */ + uint32_t lv_cur; /* current logical volumes */ + uint32_t lv_open; /* open logical volumes */ + uint32_t pv_max; /* maximum physical volumes */ + uint32_t pv_cur; /* current physical volumes FU */ + uint32_t pv_act; /* active physical volumes */ + uint32_t dummy; + uint32_t vgda; /* volume group descriptor arrays FU */ + uint32_t pe_size; /* physical extent size in sectors */ + uint32_t pe_total; /* total of physical extents */ + uint32_t pe_allocated; /* allocated physical extents */ + uint32_t pvg_total; /* physical volume groups FU */ +} vg_disk_v2_t; /* * Request structures for ioctls */ -/* Request structure PV_STATUS */ -typedef struct - { - char pv_name[NAME_LEN]; - pv_t *pv; - } -pv_status_req_t, pv_change_req_t; +/* Request structure PV_STATUS_BY_NAME... */ +typedef struct { + char pv_name[NAME_LEN]; + pv_t *pv; +} pv_status_req_t, pv_change_req_t; /* Request structure PV_FLUSH */ -typedef struct - { - char pv_name[NAME_LEN]; - } -pv_flush_req_t; +typedef struct { + char pv_name[NAME_LEN]; + kdev_t pv_dev; +} pv_flush_req_t; /* Request structure PE_MOVE */ -typedef struct - { - enum - { - LOCK_PE, UNLOCK_PE - } - lock; - struct - { - kdev_t lv_dev; - kdev_t pv_dev; - uint32_t pv_offset; - } - data; - } -pe_lock_req_t; +typedef struct { + enum { + LOCK_PE, UNLOCK_PE + } lock; + struct { + kdev_t lv_dev; + kdev_t pv_dev; + ulong pv_offset; + } data; +} pe_lock_req_t; /* Request structure LV_STATUS_BYNAME */ -typedef struct - { - char lv_name[NAME_LEN]; - lv_t *lv; - } -lv_status_byname_req_t, lv_req_t; +typedef struct { + char lv_name[NAME_LEN]; + lv_t *lv; +} lv_status_byname_req_t, lv_req_t; /* Request structure LV_STATUS_BYINDEX */ -typedef struct - { - ulong lv_index; - lv_t *lv; - } -lv_status_byindex_req_t; - -#endif /* #ifndef _LVM_H_INCLUDE */ +typedef struct { + ulong lv_index; + lv_t *lv; + /* Transfer size because user space and kernel space differ */ + ushort size; +} lv_status_byindex_req_t; + +/* Request structure LV_STATUS_BYDEV... */ +typedef struct { + dev_t dev; + pv_t *lv; +} lv_status_bydev_req_t; + + +/* Request structure LV_SNAPSHOT_USE_RATE */ +typedef struct { + int block; + int rate; +} lv_snapshot_use_rate_req_t; + +#endif /* #ifndef _LVM_H_INCLUDE */ diff --git a/include/linux/major.h b/include/linux/major.h index 372e1841a..405e9f8ac 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -154,6 +154,8 @@ #define MSR_MAJOR 202 #define CPUID_MAJOR 203 +#define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ + /* * Tests for SCSI devices. */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 37bc9a4a1..245201241 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -120,24 +120,10 @@ extern pgprot_t protection_map[16]; struct vm_operations_struct { void (*open)(struct vm_area_struct * area); void (*close)(struct vm_area_struct * area); - void (*unmap)(struct vm_area_struct *area, unsigned long, size_t); - void (*protect)(struct vm_area_struct *area, unsigned long, size_t, unsigned int newprot); - int (*sync)(struct vm_area_struct *area, unsigned long, size_t, unsigned int flags); struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int write_access); - struct page * (*wppage)(struct vm_area_struct * area, unsigned long address, struct page * page); - int (*swapout)(struct page *, struct file *); }; /* - * A swap entry has to fit into a "unsigned long", as - * the entry is hidden in the "index" field of the - * swapper address space. - */ -typedef struct { - unsigned long val; -} swp_entry_t; - -/* * Try to keep the most commonly accessed fields in single cache lines * here (16 bytes or greater). This ordering should be particularly * beneficial on 32-bit processors. @@ -185,7 +171,6 @@ typedef struct page { #define PG_arch_1 30 #define PG_reserved 31 - /* Make it prettier to test the above... */ #define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags) #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) @@ -196,6 +181,15 @@ typedef struct page { #define PageLocked(page) test_bit(PG_locked, &(page)->flags) #define LockPage(page) set_bit(PG_locked, &(page)->flags) #define TryLockPage(page) test_and_set_bit(PG_locked, &(page)->flags) + +extern void __set_page_dirty(struct page *); + +static inline void set_page_dirty(struct page * page) +{ + if (!test_and_set_bit(PG_dirty, &page->flags)) + __set_page_dirty(page); +} + /* * The first mb is necessary to safely close the critical section opened by the * TryLockPage(), the second mb is necessary to enforce ordering between @@ -390,7 +384,9 @@ extern void show_free_areas_node(pg_data_t *pgdat); extern void clear_page_tables(struct mm_struct *, unsigned long, int); -extern int map_zero_setup(struct vm_area_struct *); +struct page * shmem_nopage(struct vm_area_struct * vma, unsigned long address, int no_share); +struct file *shmem_file_setup(char * name, loff_t size); +extern int shmem_zero_setup(struct vm_area_struct *); extern void zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size); extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma); @@ -419,7 +415,6 @@ extern void swapin_readahead(swp_entry_t); /* mmap.c */ extern void lock_vma_mappings(struct vm_area_struct *); extern void unlock_vma_mappings(struct vm_area_struct *); -extern void merge_segments(struct mm_struct *, unsigned long, unsigned long); extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void __insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void build_mmap_avl(struct mm_struct *); @@ -454,7 +449,6 @@ extern unsigned long page_unuse(struct page *); extern void truncate_inode_pages(struct address_space *, loff_t); /* generic vm_area_ops exported for stackable file systems */ -extern int filemap_swapout(struct page *, struct file *); extern int filemap_sync(struct vm_area_struct *, unsigned long, size_t, unsigned int); extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int); diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index 705169800..f7f8ad01f 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h @@ -5,6 +5,7 @@ #ifndef __LINUX_MTD_MAP_H__ #define __LINUX_MTD_MAP_H__ +#include <linux/config.h> #include <linux/types.h> #include <linux/mtd/mtd.h> #include <linux/malloc.h> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 708f4f203..a703b853e 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -6,6 +6,7 @@ #ifdef __KERNEL__ +#include <linux/config.h> #include <linux/version.h> #include <linux/types.h> #include <linux/mtd/compatmac.h> diff --git a/include/linux/mtio.h b/include/linux/mtio.h index c794ed898..8b0f4aa64 100644 --- a/include/linux/mtio.h +++ b/include/linux/mtio.h @@ -105,6 +105,8 @@ struct mtget { #define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */ #define MT_ISDDS1 0x51 /* DDS device without partitions */ #define MT_ISDDS2 0x52 /* DDS device with partitions */ +#define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0) + and SCSI emulated (DI, DP, USB) */ #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ @@ -134,6 +136,7 @@ struct mt_tape_info { {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ + {MT_ISONSTREAM_SC, "OnStream SC-, DI-, DP-, or USB tape drive"}, \ {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ {0, NULL} \ diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 2f37a4b19..833242aa7 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -33,8 +33,8 @@ struct nfs_page { unsigned long wb_timeout; /* when to read/write/commit */ unsigned int wb_offset, /* Offset of read/write */ wb_bytes, /* Length of request */ - wb_count, /* reference count */ - wb_flags; + wb_count; /* reference count */ + unsigned long wb_flags; struct nfs_writeverf wb_verf; /* Commit cookie */ }; diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 9d2082f44..cf2ea8584 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -67,6 +67,8 @@ extern inline unsigned long _page_hashfn(struct address_space * mapping, unsigne #define page_hash(mapping,index) (page_hash_table+_page_hashfn(mapping,index)) +extern struct page * __find_get_page(struct address_space *mapping, + unsigned long offset, struct page **hash); extern struct page * __find_lock_page (struct address_space * mapping, unsigned long index, struct page **hash); extern void lock_page(struct page *page); @@ -78,34 +80,6 @@ extern void __add_page_to_hash_queue(struct page * page, struct page **p); extern void add_to_page_cache(struct page * page, struct address_space *mapping, unsigned long index); extern void add_to_page_cache_locked(struct page * page, struct address_space *mapping, unsigned long index); -extern inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long index) -{ - __add_page_to_hash_queue(page, page_hash(inode->i_mapping,index)); -} - -extern inline void add_page_to_inode_queue(struct address_space *mapping, struct page * page) -{ - struct list_head *head = &mapping->pages; - - if (!mapping->nrpages++) { - if (!list_empty(head)) - BUG(); - } else { - if (list_empty(head)) - BUG(); - } - list_add(&page->list, head); - page->mapping = mapping; -} - -extern inline void remove_page_from_inode_queue(struct page * page) -{ - struct address_space * mapping = page->mapping; - - mapping->nrpages--; - list_del(&page->list); -} - extern void ___wait_on_page(struct page *); extern inline void wait_on_page(struct page * page) diff --git a/include/linux/pci.h b/include/linux/pci.h index d98a3a01a..a78410716 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -681,6 +681,7 @@ extern int pci_pci_problems; #define PCIPCI_FAIL 1 #define PCIPCI_TRITON 2 #define PCIPCI_NATOMA 4 +#define PCIPCI_VIAETBF 8 #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 60aef94ee..2b2a461b8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1218,6 +1218,9 @@ #define PCI_VENDOR_ID_3WARE 0x13C1 #define PCI_DEVICE_ID_3WARE_1000 0x1000 +#define PCI_VENDOR_ID_ABOCOM 0x13D1 +#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 + #define PCI_VENDOR_ID_CMEDIA 0x13f6 #define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 #define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 8c260c63d..b98eb998e 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -350,6 +350,7 @@ do { \ if (condition) \ break; \ spin_unlock_irq(&lock); \ + run_task_queue(&tq_disk); \ schedule(); \ spin_lock_irq(&lock); \ } \ diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index dd5ad01ae..d46dbd512 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h @@ -4,72 +4,167 @@ #include <linux/raid/md.h> #include <linux/raid/xor.h> -struct disk_info { - kdev_t dev; - int operational; - int number; - int raid_disk; - int write_only; - int spare; - int used_slot; -}; - +/* + * + * Each stripe contains one buffer per disc. Each buffer can be in + * one of a number of states determined by bh_state. Changes between + * these states happen *almost* exclusively under a per-stripe + * spinlock. Some very specific changes can happen in b_end_io, and + * these are not protected by the spin lock. + * + * The bh_state bits that are used to represent these states are: + * BH_Uptodate, BH_Lock + * + * State Empty == !Uptodate, !Lock + * We have no data, and there is no active request + * State Want == !Uptodate, Lock + * A read request is being submitted for this block + * State Dirty == Uptodate, Lock + * Some new data is in this buffer, and it is being written out + * State Clean == Uptodate, !Lock + * We have valid data which is the same as on disc + * + * The possible state transitions are: + * + * Empty -> Want - on read or write to get old data for parity calc + * Empty -> Dirty - on compute_parity to satisfy write/sync request.(RECONSTRUCT_WRITE) + * Empty -> Clean - on compute_block when computing a block for failed drive + * Want -> Empty - on failed read + * Want -> Clean - on successful completion of read request + * Dirty -> Clean - on successful completion of write request + * Dirty -> Clean - on failed write + * Clean -> Dirty - on compute_parity to satisfy write/sync (RECONSTRUCT or RMW) + * + * The Want->Empty, Want->Clean, Dirty->Clean, transitions + * all happen in b_end_io at interrupt time. + * Each sets the Uptodate bit before releasing the Lock bit. + * This leaves one multi-stage transition: + * Want->Dirty->Clean + * This is safe because thinking that a Clean buffer is actually dirty + * will at worst delay some action, and the stripe will be scheduled + * for attention after the transition is complete. + * + * There is one possibility that is not covered by these states. That + * is if one drive has failed and there is a spare being rebuilt. We + * can't distinguish between a clean block that has been generated + * from parity calculations, and a clean block that has been + * successfully written to the spare ( or to parity when resyncing). + * To distingush these states we have a stripe bit STRIPE_INSYNC that + * is set whenever a write is scheduled to the spare, or to the parity + * disc if there is no spare. A sync request clears this bit, and + * when we find it set with no buffers locked, we know the sync is + * complete. + * + * Buffers for the md device that arrive via make_request are attached + * to the appropriate stripe in one of two lists linked on b_reqnext. + * One list for read requests, one for write. There should never be + * more than one buffer on the two lists together, but we are not + * guaranteed of that so we allow for more. + * + * If a buffer is on the read list when the associated cache buffer is + * Uptodate, the data is copied into the read buffer and it's b_end_io + * routine is called. This may happen in the end_request routine only + * if the buffer has just successfully been read. end_request should + * remove the buffers from the list and then set the Uptodate bit on + * the buffer. Other threads may do this only if they first check + * that the Uptodate bit is set. Once they have checked that they may + * take buffers off the read queue. + * + * When a buffer on the write_list is committed for write, it is + * marked clean, copied into the cache buffer, which is then marked + * dirty, and moved onto a third list, the written list. Once both + * the parity block and the cached buffer are successfully written, + * any buffer on a written list can be returned with b_end_io. + * + * The write_list and read_list lists act as fifos. They are protected by the + * device_lock which can be claimed when a stripe_lock is held. + * The device_lock is only for list manipulations and will only be held for a very + * short time. It can be claimed from interrupts. + * + * + * Stripes in the stripe cache can be on one of two lists (or on + * neither). The "inactive_list" contains stripes which are not + * currently being used for any request. They can freely be reused + * for another stripe. The "handle_list" contains stripes that need + * to be handled in some way. Both of these are fifo queues. Each + * stripe is also (potentially) linked to a hash bucket in the hash + * table so that it can be found by sector number. Stripes that are + * not hashed must be on the inactive_list, and will normally be at + * the front. All stripes start life this way. + * + * The inactive_list, handle_list and hash bucket lists are all protected by the + * device_lock. + * - stripes on the inactive_list never have their stripe_lock held. + * - stripes have a reference counter. If count==0, they are on a list. + * - If a stripe might need handling, STRIPE_HANDLE is set. + * - When refcount reaches zero, then if STRIPE_HANDLE it is put on + * handle_list else inactive_list + * + * This, combined with the fact that STRIPE_HANDLE is only ever + * cleared while a stripe has a non-zero count means that if the + * refcount is 0 and STRIPE_HANDLE is set, then it is on the + * handle_list and if recount is 0 and STRIPE_HANDLE is not set, then + * the stripe is on inactive_list. + * + * The possible transitions are: + * activate an unhashed/inactive stripe (get_active_stripe()) + * lockdev check-hash unlink-stripe cnt++ clean-stripe hash-stripe unlockdev + * activate a hashed, possibly active stripe (get_active_stripe()) + * lockdev check-hash if(!cnt++)unlink-stripe unlockdev + * attach a request to an active stripe (add_stripe_bh()) + * lockdev attach-buffer unlockdev + * handle a stripe (handle_stripe()) + * lockstripe clrSTRIPE_HANDLE ... (lockdev check-buffers unlockdev) .. change-state .. record io needed unlockstripe schedule io + * release an active stripe (release_stripe()) + * lockdev if (!--cnt) { if STRIPE_HANDLE, add to handle_list else add to inactive-list } unlockdev + * + * The refcount counts each thread that have activated the stripe, + * plus raid5d if it is handling it, plus one for each active request + * on a cached buffer. + */ struct stripe_head { - md_spinlock_t stripe_lock; struct stripe_head *hash_next, **hash_pprev; /* hash pointers */ - struct stripe_head *free_next; /* pool of free sh's */ - struct buffer_head *buffer_pool; /* pool of free buffers */ - struct buffer_head *bh_pool; /* pool of free bh's */ + struct list_head lru; /* inactive_list or handle_list */ struct raid5_private_data *raid_conf; - struct buffer_head *bh_old[MD_SB_DISKS]; /* disk image */ - struct buffer_head *bh_new[MD_SB_DISKS]; /* buffers of the MD device (present in buffer cache) */ - struct buffer_head *bh_copy[MD_SB_DISKS]; /* copy on write of bh_new (bh_new can change from under us) */ - struct buffer_head *bh_req[MD_SB_DISKS]; /* copy of bh_new (only the buffer heads), queued to the lower levels */ - int cmd_new[MD_SB_DISKS]; /* READ/WRITE for new */ - int new[MD_SB_DISKS]; /* buffer added since the last handle_stripe() */ + struct buffer_head *bh_cache[MD_SB_DISKS]; /* buffered copy */ + struct buffer_head *bh_read[MD_SB_DISKS]; /* read request buffers of the MD device */ + struct buffer_head *bh_write[MD_SB_DISKS]; /* write request buffers of the MD device */ + struct buffer_head *bh_written[MD_SB_DISKS]; /* write request buffers of the MD device that have been scheduled for write */ unsigned long sector; /* sector of this row */ int size; /* buffers size */ int pd_idx; /* parity disk index */ - atomic_t nr_pending; /* nr of pending cmds */ unsigned long state; /* state flags */ - int cmd; /* stripe cmd */ - atomic_t count; /* nr of waiters */ - int write_method; /* reconstruct-write / read-modify-write */ - int phase; /* PHASE_BEGIN, ..., PHASE_COMPLETE */ - md_wait_queue_head_t wait; /* processes waiting for this stripe */ - + atomic_t count; /* nr of active thread/requests */ + spinlock_t lock; int sync_redone; }; -/* - * Phase - */ -#define PHASE_BEGIN 0 -#define PHASE_READ_OLD 1 -#define PHASE_WRITE 2 -#define PHASE_READ 3 -#define PHASE_COMPLETE 4 /* * Write method */ -#define METHOD_NONE 0 #define RECONSTRUCT_WRITE 1 #define READ_MODIFY_WRITE 2 +/* not a write method, but a compute_parity mode */ +#define CHECK_PARITY 3 /* * Stripe state */ -#define STRIPE_LOCKED 0 #define STRIPE_ERROR 1 +#define STRIPE_HANDLE 2 +#define STRIPE_SYNCING 3 +#define STRIPE_INSYNC 4 -/* - * Stripe commands - */ -#define STRIPE_NONE 0 -#define STRIPE_WRITE 1 -#define STRIPE_READ 2 -#define STRIPE_SYNC 3 +struct disk_info { + kdev_t dev; + int operational; + int number; + int raid_disk; + int write_only; + int spare; + int used_slot; +}; struct raid5_private_data { struct stripe_head **stripe_hashtbl; @@ -80,23 +175,15 @@ struct raid5_private_data { int buffer_size; int chunk_size, level, algorithm; int raid_disks, working_disks, failed_disks; - unsigned long next_sector; - atomic_t nr_handle; - struct stripe_head *next_free_stripe; - atomic_t nr_stripes; int resync_parity; int max_nr_stripes; - int clock; - atomic_t nr_hashed_stripes; - atomic_t nr_locked_stripes; - atomic_t nr_pending_stripes; - atomic_t nr_cached_stripes; + struct list_head handle_list; /* stripes needing handling */ /* * Free stripes pool */ - atomic_t nr_free_sh; - struct stripe_head *free_sh_list; + atomic_t active_stripes; + struct list_head inactive_list; md_wait_queue_head_t wait_for_stripe; md_spinlock_t device_lock; diff --git a/include/linux/sched.h b/include/linux/sched.h index 0622510fc..4be0dd7d5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -18,6 +18,7 @@ extern unsigned long event; #include <asm/semaphore.h> #include <asm/page.h> #include <asm/ptrace.h> +#include <asm/mmu.h> #include <linux/smp.h> #include <linux/tty.h> @@ -208,7 +209,6 @@ struct mm_struct { int map_count; /* number of VMAs */ struct semaphore mmap_sem; spinlock_t page_table_lock; - unsigned long context; unsigned long start_code, end_code, start_data, end_data; unsigned long start_brk, brk, start_stack; unsigned long arg_start, arg_end, env_start, env_end; @@ -217,11 +217,9 @@ struct mm_struct { unsigned long cpu_vm_mask; unsigned long swap_cnt; /* number of pages to swap on next pass */ unsigned long swap_address; - /* - * This is an architecture-specific pointer: the portable - * part of Linux does not know about any segments. - */ - void * segments; + + /* Architecture-specific MM context */ + mm_context_t context; }; #define INIT_MM(name) \ @@ -235,7 +233,6 @@ struct mm_struct { map_count: 1, \ mmap_sem: __MUTEX_INITIALIZER(name.mmap_sem), \ page_table_lock: SPIN_LOCK_UNLOCKED, \ - segments: NULL \ } struct signal_struct { diff --git a/include/linux/shm.h b/include/linux/shm.h index e1b335cbe..4ccdd749d 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -10,7 +10,7 @@ */ #define SHMMAX 0x2000000 /* max shared seg size (bytes) */ -#define SHMMIN 0 /* min shared seg size (bytes) */ +#define SHMMIN 1 /* min shared seg size (bytes) */ #define SHMMNI 4096 /* max num of segs system wide */ #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ #define SHMSEG SHMMNI /* max shared segs per process */ diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h new file mode 100644 index 000000000..3c61d5a01 --- /dev/null +++ b/include/linux/shmem_fs.h @@ -0,0 +1,37 @@ +#ifndef __SHMEM_FS_H +#define __SHMEM_FS_H + +/* inode in-kernel data */ + +#define SHMEM_NR_DIRECT 16 + +/* + * A swap entry has to fit into a "unsigned long", as + * the entry is hidden in the "index" field of the + * swapper address space. + * + * We have to move it here, since not every user of fs.h is including + * mm.h, but m.h is including fs.h via sched .h :-/ + */ +typedef struct { + unsigned long val; +} swp_entry_t; + +struct shmem_inode_info { + spinlock_t lock; + swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */ + swp_entry_t **i_indirect; /* doubly indirect blocks */ + unsigned long swapped; + int locked; /* into memory */ + struct list_head list; +}; + +struct shmem_sb_info { + unsigned long max_blocks; /* How many blocks are allowed */ + unsigned long free_blocks; /* How many are left for allocation */ + unsigned long max_inodes; /* How many inodes are allowed */ + unsigned long free_inodes; /* How many are left for allocation */ + spinlock_t stat_lock; +}; + +#endif diff --git a/include/linux/slab.h b/include/linux/slab.h index 9a6e61025..b01496cdf 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -22,7 +22,7 @@ typedef struct kmem_cache_s kmem_cache_t; #define SLAB_NFS GFP_NFS #define SLAB_DMA GFP_DMA -#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_HIGHMEM) +#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO) #define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */ /* flags to pass to kmem_cache_create(). diff --git a/include/linux/swap.h b/include/linux/swap.h index 1390490f9..e001de887 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -291,6 +291,8 @@ extern spinlock_t swaplock; #define swap_device_lock(p) spin_lock(&p->sdev_lock) #define swap_device_unlock(p) spin_unlock(&p->sdev_lock) +extern void shmem_unuse(swp_entry_t entry, struct page *page); + #endif /* __KERNEL__*/ #endif /* _LINUX_SWAP_H */ diff --git a/include/linux/telephony.h b/include/linux/telephony.h index 3dd5a969a..4e38e8ccb 100644 --- a/include/linux/telephony.h +++ b/include/linux/telephony.h @@ -207,8 +207,8 @@ struct phone_codec_data * indicate the current state of the hookswitch. The pstn_ring bit * indicates that the DAA on a LineJACK card has detected ring voltage on * the PSTN port. The caller_id bit indicates that caller_id data has been -* recieved and is available. The pstn_wink bit indicates that the DAA on -* the LineJACK has recieved a wink from the telco switch. The f0, f1, f2 +* received and is available. The pstn_wink bit indicates that the DAA on +* the LineJACK has received a wink from the telco switch. The f0, f1, f2 * and f3 bits indicate that the filter has been triggered by detecting the * frequency programmed into that filter. * diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index a0363ffa6..65adeb9b7 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -53,22 +53,22 @@ extern task_queue tq_timer, tq_immediate, tq_disk; * To implement your own list of active bottom halfs, use the following * two definitions: * - * DECLARE_TASK_QUEUE(my_bh); - * struct tq_struct run_my_bh = { - * routine: (void (*)(void *)) run_task_queue, - * data: &my_bh + * DECLARE_TASK_QUEUE(my_tqueue); + * struct tq_struct my_task = { + * routine: (void (*)(void *)) my_routine, + * data: &my_data * }; * - * To activate a bottom half on your list, use: + * To activate a bottom half on a list, use: * - * queue_task(tq_pointer, &my_bh); + * queue_task(&my_task, &my_tqueue); * - * To run the bottom halfs on your list put them on the immediate list by: + * To later run the queued tasks use * - * queue_task(&run_my_bh, &tq_immediate); + * run_task_queue(&my_tqueue); * - * This allows you to do deferred procession. For example, you could - * have a bottom half list tq_timer, which is marked active by the timer + * This allows you to do deferred processing. For example, you could + * have a task queue called tq_timer, which is executed within the timer * interrupt. */ @@ -78,8 +78,7 @@ extern spinlock_t tqueue_lock; * Queue a task on a tq. Return non-zero if it was successfully * added. */ -static inline int queue_task(struct tq_struct *bh_pointer, - task_queue *bh_list) +static inline int queue_task(struct tq_struct *bh_pointer, task_queue *bh_list) { int ret = 0; if (!test_and_set_bit(0,&bh_pointer->sync)) { @@ -95,32 +94,13 @@ static inline int queue_task(struct tq_struct *bh_pointer, /* * Call all "bottom halfs" on a given list. */ -static inline void run_task_queue(task_queue *list) -{ - while (!list_empty(list)) { - unsigned long flags; - struct list_head *next; - - spin_lock_irqsave(&tqueue_lock, flags); - next = list->next; - if (next != list) { - void *arg; - void (*f) (void *); - struct tq_struct *p; - list_del(next); - p = list_entry(next, struct tq_struct, list); - arg = p->data; - f = p->routine; - p->sync = 0; - spin_unlock_irqrestore(&tqueue_lock, flags); +extern void __run_task_queue(task_queue *list); - if (f) - f(arg); - continue; - } - spin_unlock_irqrestore(&tqueue_lock, flags); - } +static inline void run_task_queue(task_queue *list) +{ + if (TQ_ACTIVE(*list)) + __run_task_queue(list); } #endif /* _LINUX_TQUEUE_H */ diff --git a/include/linux/tty.h b/include/linux/tty.h index 642c8bd7e..057cb57a6 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -305,6 +305,7 @@ struct tty_struct { unsigned long canon_head; unsigned int canon_column; struct semaphore atomic_read; + struct semaphore atomic_write; spinlock_t read_lock; }; diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 3f358258b..8d7a7764d 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -6,14 +6,17 @@ * */ +#ifndef _LINUX_WATCHDOG_H +#define _LINUX_WATCHDOG_H + #include <linux/ioctl.h> #define WATCHDOG_IOCTL_BASE 'W' struct watchdog_info { - u32 options; /* Options the card/driver supports */ - u32 firmware_version; /* Firmware version of the card */ - u8 identity[32]; /* Identity of the board */ + __u32 options; /* Options the card/driver supports */ + __u32 firmware_version; /* Firmware version of the card */ + __u8 identity[32]; /* Identity of the board */ }; #define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) @@ -38,3 +41,5 @@ struct watchdog_info { #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ + +#endif /* ifndef _LINUX_WATCHDOG_H */ diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 868f812ac..c552ff21b 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -63,7 +63,7 @@ * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ -#define WIRELESS_EXT 9 +#define WIRELESS_EXT 10 /* * Changes : @@ -104,26 +104,33 @@ * - Change encoding to support larger tokens (>64 bits) * - Updated iw_params (disable, flags) and use it for NWID * - Extracted iw_point from iwreq for clarity + * + * V9 to V10 + * --------- + * - Add PM capability to range structure + * - Add PM modifier : MAX/MIN/RELATIVE + * - Add encoding option : IW_ENCODE_NOKEY + * - Add TxPower ioctls (work like TxRate) */ /* -------------------------- IOCTL LIST -------------------------- */ /* Basic operations */ -#define SIOCSIWNAME 0x8B00 /* Unused ??? */ -#define SIOCGIWNAME 0x8B01 /* get name */ +#define SIOCSIWNAME 0x8B00 /* Unused */ +#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ #define SIOCSIWNWID 0x8B02 /* set network id (the cell) */ #define SIOCGIWNWID 0x8B03 /* get network id */ -#define SIOCSIWFREQ 0x8B04 /* set channel/frequency */ -#define SIOCGIWFREQ 0x8B05 /* get channel/frequency */ +#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ +#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ #define SIOCSIWMODE 0x8B06 /* set operation mode */ #define SIOCGIWMODE 0x8B07 /* get operation mode */ -#define SIOCSIWSENS 0x8B08 /* set sensitivity */ -#define SIOCGIWSENS 0x8B09 /* get sensitivity */ +#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ +#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ /* Informative stuff */ -#define SIOCSIWRANGE 0x8B0A /* Unused ??? */ +#define SIOCSIWRANGE 0x8B0A /* Unused */ #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ -#define SIOCSIWPRIV 0x8B0C /* Unused ??? */ +#define SIOCSIWPRIV 0x8B0C /* Unused */ #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ /* Mobile IP support */ @@ -153,6 +160,8 @@ #define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ +#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ +#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ /* Encoding stuff (scrambling, hardware security, WEP...) */ #define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ @@ -205,6 +214,9 @@ /* Maximum bit rates in the range struct */ #define IW_MAX_BITRATES 8 +/* Maximum tx powers in the range struct */ +#define IW_MAX_TXPOWER 8 + /* Maximum of address that you may set with SPY */ #define IW_MAX_SPY 8 @@ -232,11 +244,13 @@ /* Flags for encoding (along with the token) */ #define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ -#define IW_ENCODE_FLAGS 0xF000 /* Flags defined below */ +#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */ +#define IW_ENCODE_MODE 0xF000 /* Modes defined below */ #define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ #define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ #define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ #define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ +#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */ /* Power management flags available (along with the value, if any) */ #define IW_POWER_ON 0x0000 /* No details... */ @@ -249,6 +263,14 @@ #define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ #define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ #define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ +#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ +#define IW_POWER_MIN 0x0001 /* Value is a minimum */ +#define IW_POWER_MAX 0x0002 /* Value is a maximum */ +#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ + +/* Transmit Power flags available */ +#define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ +#define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ /****************************** TYPES ******************************/ @@ -359,6 +381,7 @@ struct iwreq struct iw_param sens; /* signal level threshold */ struct iw_param bitrate; /* default bit rate */ + struct iw_param txpower; /* default transmit power */ struct iw_param rts; /* RTS threshold threshold */ struct iw_param frag; /* Fragmentation threshold */ __u32 mode; /* Operation mode */ @@ -422,15 +445,23 @@ struct iw_range __s32 max_frag; /* Maximal frag threshold */ /* Power Management duration & timeout */ - __s32 min_pmd; /* Minimal PM duration */ - __s32 max_pmd; /* Maximal PM duration */ + __s32 min_pmp; /* Minimal PM period */ + __s32 max_pmp; /* Maximal PM period */ __s32 min_pmt; /* Minimal PM timeout */ __s32 max_pmt; /* Maximal PM timeout */ + __u16 pmp_flags; /* How to decode max/min PM period */ + __u16 pmt_flags; /* How to decode max/min PM timeout */ + __u16 pm_capa; /* What PM options are supported */ /* Encoder stuff */ __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ __u8 num_encoding_sizes; /* Number of entry in the list */ __u8 max_encoding_tokens; /* Max number of tokens */ + + /* Transmit power */ + __u16 txpower_capa; /* What options are supported */ + __u8 num_txpower; /* Number of entries in the list */ + __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */ }; /* diff --git a/include/linux/zorro.h b/include/linux/zorro.h index aabaea588..ac27f4b83 100644 --- a/include/linux/zorro.h +++ b/include/linux/zorro.h @@ -152,6 +152,7 @@ CD_sizeof = CD_Unused+(4*4) #ifdef __KERNEL__ +#include <linux/init.h> #include <linux/ioport.h> struct zorro_dev { diff --git a/include/net/ax25.h b/include/net/ax25.h index 525786901..0957d1aae 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -339,7 +339,12 @@ extern int ax25_uid_get_info(char *, char **, off_t, int); extern void ax25_uid_free(void); /* sysctl_net_ax25.c */ +#ifdef CONFIG_SYSCTL extern void ax25_register_sysctl(void); extern void ax25_unregister_sysctl(void); +#else +extern inline void ax25_register_sysctl(void) {}; +extern inline void ax25_unregister_sysctl(void) {}; +#endif /* CONFIG_SYSCTL */ #endif diff --git a/include/net/sock.h b/include/net/sock.h index 8550282cb..6272cf459 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -302,6 +302,9 @@ struct tcp_opt { __u8 backoff; /* backoff */ __u32 srtt; /* smothed round trip time << 3 */ __u32 mdev; /* medium deviation */ + __u32 mdev_max; /* maximal mdev for the last rtt period */ + __u32 rttvar; /* smoothed mdev_max */ + __u32 rtt_seq; /* sequence number to update rttvar */ __u32 rto; /* retransmit timeout */ __u32 packets_out; /* Packets which are "in flight" */ diff --git a/include/net/tcp.h b/include/net/tcp.h index ccdff5aaa..8574af3e1 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -923,8 +923,11 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk) static inline void tcp_initialize_rcv_mss(struct sock *sk) { struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; + int hint = min(tp->advmss, tp->mss_cache); - tp->ack.rcv_mss = max(min(tp->advmss, TCP_MIN_RCVMSS), TCP_MIN_MSS); + hint = min(hint, tp->rcv_wnd/2); + + tp->ack.rcv_mss = max(min(hint, TCP_MIN_RCVMSS), TCP_MIN_MSS); } static __inline__ void __tcp_fast_path_on(struct tcp_opt *tp, u32 snd_wnd) diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index db004249f..01894cd3b 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h @@ -79,6 +79,12 @@ TCP_ECN_accept_cwr(struct tcp_opt *tp, struct sk_buff *skb) } static __inline__ void +TCP_ECN_withdraw_cwr(struct tcp_opt *tp) +{ + tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; +} + +static __inline__ void TCP_ECN_check_ce(struct tcp_opt *tp, struct sk_buff *skb) { if (tp->ecn_flags&TCP_ECN_OK) { @@ -148,6 +154,7 @@ TCP_ECN_create_request(struct open_request *req, struct tcphdr *th) #define TCP_ECN_rcv_ecn_echo(x...) (0) #define TCP_ECN_openreq_child(x...) do { } while (0) #define TCP_ECN_create_request(x...) do { } while (0) +#define TCP_ECN_withdraw_cwr(x...) do { } while (0) #endif |