diff options
32 files changed, 366 insertions, 200 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 680fb566b928..8362860e21a7 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
| @@ -144,8 +144,8 @@ prototypes: | |||
| 144 | void (*kill_sb) (struct super_block *); | 144 | void (*kill_sb) (struct super_block *); |
| 145 | locking rules: | 145 | locking rules: |
| 146 | may block BKL | 146 | may block BKL |
| 147 | get_sb yes yes | 147 | get_sb yes no |
| 148 | kill_sb yes yes | 148 | kill_sb yes no |
| 149 | 149 | ||
| 150 | ->get_sb() returns error or 0 with locked superblock attached to the vfsmount | 150 | ->get_sb() returns error or 0 with locked superblock attached to the vfsmount |
| 151 | (exclusive on ->s_umount). | 151 | (exclusive on ->s_umount). |
| @@ -409,12 +409,12 @@ ioctl: yes (see below) | |||
| 409 | unlocked_ioctl: no (see below) | 409 | unlocked_ioctl: no (see below) |
| 410 | compat_ioctl: no | 410 | compat_ioctl: no |
| 411 | mmap: no | 411 | mmap: no |
| 412 | open: maybe (see below) | 412 | open: no |
| 413 | flush: no | 413 | flush: no |
| 414 | release: no | 414 | release: no |
| 415 | fsync: no (see below) | 415 | fsync: no (see below) |
| 416 | aio_fsync: no | 416 | aio_fsync: no |
| 417 | fasync: yes (see below) | 417 | fasync: no |
| 418 | lock: yes | 418 | lock: yes |
| 419 | readv: no | 419 | readv: no |
| 420 | writev: no | 420 | writev: no |
| @@ -431,13 +431,6 @@ For many filesystems, it is probably safe to acquire the inode | |||
| 431 | semaphore. Note some filesystems (i.e. remote ones) provide no | 431 | semaphore. Note some filesystems (i.e. remote ones) provide no |
| 432 | protection for i_size so you will need to use the BKL. | 432 | protection for i_size so you will need to use the BKL. |
| 433 | 433 | ||
| 434 | ->open() locking is in-transit: big lock partially moved into the methods. | ||
| 435 | The only exception is ->open() in the instances of file_operations that never | ||
| 436 | end up in ->i_fop/->proc_fops, i.e. ones that belong to character devices | ||
| 437 | (chrdev_open() takes lock before replacing ->f_op and calling the secondary | ||
| 438 | method. As soon as we fix the handling of module reference counters all | ||
| 439 | instances of ->open() will be called without the BKL. | ||
| 440 | |||
| 441 | Note: ext2_release() was *the* source of contention on fs-intensive | 434 | Note: ext2_release() was *the* source of contention on fs-intensive |
| 442 | loads and dropping BKL on ->release() helps to get rid of that (we still | 435 | loads and dropping BKL on ->release() helps to get rid of that (we still |
| 443 | grab BKL for cases when we close a file that had been opened r/w, but that | 436 | grab BKL for cases when we close a file that had been opened r/w, but that |
diff --git a/MAINTAINERS b/MAINTAINERS index b3e92fbe336c..186be3ba5069 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -750,11 +750,13 @@ P: Ville Syrjala | |||
| 750 | M: syrjala@sci.fi | 750 | M: syrjala@sci.fi |
| 751 | S: Maintained | 751 | S: Maintained |
| 752 | 752 | ||
| 753 | ATL1 ETHERNET DRIVER | 753 | ATLX ETHERNET DRIVERS |
| 754 | P: Jay Cliburn | 754 | P: Jay Cliburn |
| 755 | M: jcliburn@gmail.com | 755 | M: jcliburn@gmail.com |
| 756 | P: Chris Snook | 756 | P: Chris Snook |
| 757 | M: csnook@redhat.com | 757 | M: csnook@redhat.com |
| 758 | P: Jie Yang | ||
| 759 | M: jie.yang@atheros.com | ||
| 758 | L: atl1-devel@lists.sourceforge.net | 760 | L: atl1-devel@lists.sourceforge.net |
| 759 | W: http://sourceforge.net/projects/atl1 | 761 | W: http://sourceforge.net/projects/atl1 |
| 760 | W: http://atl1.sourceforge.net | 762 | W: http://atl1.sourceforge.net |
diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h index 7286e4a9fe84..a7acad2bc2f0 100644 --- a/arch/ia64/include/asm/sections.h +++ b/arch/ia64/include/asm/sections.h | |||
| @@ -21,5 +21,8 @@ extern char __start_gate_brl_fsys_bubble_down_patchlist[], __end_gate_brl_fsys_b | |||
| 21 | extern char __start_unwind[], __end_unwind[]; | 21 | extern char __start_unwind[], __end_unwind[]; |
| 22 | extern char __start_ivt_text[], __end_ivt_text[]; | 22 | extern char __start_ivt_text[], __end_ivt_text[]; |
| 23 | 23 | ||
| 24 | #undef dereference_function_descriptor | ||
| 25 | void *dereference_function_descriptor(void *); | ||
| 26 | |||
| 24 | #endif /* _ASM_IA64_SECTIONS_H */ | 27 | #endif /* _ASM_IA64_SECTIONS_H */ |
| 25 | 28 | ||
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c index 29aad349e0c4..545626f66a4c 100644 --- a/arch/ia64/kernel/module.c +++ b/arch/ia64/kernel/module.c | |||
| @@ -31,9 +31,11 @@ | |||
| 31 | #include <linux/elf.h> | 31 | #include <linux/elf.h> |
| 32 | #include <linux/moduleloader.h> | 32 | #include <linux/moduleloader.h> |
| 33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
| 34 | #include <linux/uaccess.h> | ||
| 34 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
| 35 | 36 | ||
| 36 | #include <asm/patch.h> | 37 | #include <asm/patch.h> |
| 38 | #include <asm/sections.h> | ||
| 37 | #include <asm/unaligned.h> | 39 | #include <asm/unaligned.h> |
| 38 | 40 | ||
| 39 | #define ARCH_MODULE_DEBUG 0 | 41 | #define ARCH_MODULE_DEBUG 0 |
| @@ -941,3 +943,13 @@ module_arch_cleanup (struct module *mod) | |||
| 941 | if (mod->arch.core_unw_table) | 943 | if (mod->arch.core_unw_table) |
| 942 | unw_remove_unwind_table(mod->arch.core_unw_table); | 944 | unw_remove_unwind_table(mod->arch.core_unw_table); |
| 943 | } | 945 | } |
| 946 | |||
| 947 | void *dereference_function_descriptor(void *ptr) | ||
| 948 | { | ||
| 949 | struct fdesc *desc = ptr; | ||
| 950 | void *p; | ||
| 951 | |||
| 952 | if (!probe_kernel_address(&desc->ip, p)) | ||
| 953 | ptr = p; | ||
| 954 | return ptr; | ||
| 955 | } | ||
diff --git a/arch/mips/sgi-ip22/ip22-platform.c b/arch/mips/sgi-ip22/ip22-platform.c index 60141235ec40..52486c4d2b01 100644 --- a/arch/mips/sgi-ip22/ip22-platform.c +++ b/arch/mips/sgi-ip22/ip22-platform.c | |||
| @@ -150,7 +150,7 @@ static int __init sgiseeq_devinit(void) | |||
| 150 | return res; | 150 | return res; |
| 151 | 151 | ||
| 152 | /* Second HPC is missing? */ | 152 | /* Second HPC is missing? */ |
| 153 | if (!ip22_is_fullhouse() || | 153 | if (ip22_is_fullhouse() || |
| 154 | get_dbe(tmp, (unsigned int *)&hpc3c1->pbdma[1])) | 154 | get_dbe(tmp, (unsigned int *)&hpc3c1->pbdma[1])) |
| 155 | return 0; | 155 | return 0; |
| 156 | 156 | ||
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c index fdacdd4341c9..44138c3e6ea7 100644 --- a/arch/parisc/kernel/module.c +++ b/arch/parisc/kernel/module.c | |||
| @@ -47,7 +47,9 @@ | |||
| 47 | #include <linux/string.h> | 47 | #include <linux/string.h> |
| 48 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
| 49 | #include <linux/bug.h> | 49 | #include <linux/bug.h> |
| 50 | #include <linux/uaccess.h> | ||
| 50 | 51 | ||
| 52 | #include <asm/sections.h> | ||
| 51 | #include <asm/unwind.h> | 53 | #include <asm/unwind.h> |
| 52 | 54 | ||
| 53 | #if 0 | 55 | #if 0 |
| @@ -860,3 +862,15 @@ void module_arch_cleanup(struct module *mod) | |||
| 860 | deregister_unwind_table(mod); | 862 | deregister_unwind_table(mod); |
| 861 | module_bug_cleanup(mod); | 863 | module_bug_cleanup(mod); |
| 862 | } | 864 | } |
| 865 | |||
| 866 | #ifdef CONFIG_64BIT | ||
| 867 | void *dereference_function_descriptor(void *ptr) | ||
| 868 | { | ||
| 869 | Elf64_Fdesc *desc = ptr; | ||
| 870 | void *p; | ||
| 871 | |||
| 872 | if (!probe_kernel_address(&desc->addr, p)) | ||
| 873 | ptr = p; | ||
| 874 | return ptr; | ||
| 875 | } | ||
| 876 | #endif | ||
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index 916018e425c4..7710e9e6660f 100644 --- a/arch/powerpc/include/asm/sections.h +++ b/arch/powerpc/include/asm/sections.h | |||
| @@ -16,6 +16,9 @@ static inline int in_kernel_text(unsigned long addr) | |||
| 16 | return 0; | 16 | return 0; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #undef dereference_function_descriptor | ||
| 20 | void *dereference_function_descriptor(void *); | ||
| 21 | |||
| 19 | #endif | 22 | #endif |
| 20 | 23 | ||
| 21 | #endif /* __KERNEL__ */ | 24 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index ee6a2982d567..ad79de272ff3 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
| @@ -21,8 +21,9 @@ | |||
| 21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 22 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
| 23 | #include <linux/bug.h> | 23 | #include <linux/bug.h> |
| 24 | #include <linux/uaccess.h> | ||
| 24 | #include <asm/module.h> | 25 | #include <asm/module.h> |
| 25 | #include <asm/uaccess.h> | 26 | #include <asm/sections.h> |
| 26 | #include <asm/firmware.h> | 27 | #include <asm/firmware.h> |
| 27 | #include <asm/code-patching.h> | 28 | #include <asm/code-patching.h> |
| 28 | #include <linux/sort.h> | 29 | #include <linux/sort.h> |
| @@ -451,3 +452,13 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
| 451 | 452 | ||
| 452 | return 0; | 453 | return 0; |
| 453 | } | 454 | } |
| 455 | |||
| 456 | void *dereference_function_descriptor(void *ptr) | ||
| 457 | { | ||
| 458 | struct ppc64_opd_entry *desc = ptr; | ||
| 459 | void *p; | ||
| 460 | |||
| 461 | if (!probe_kernel_address(&desc->funcaddr, p)) | ||
| 462 | ptr = p; | ||
| 463 | return ptr; | ||
| 464 | } | ||
diff --git a/arch/s390/kernel/compat_ptrace.h b/arch/s390/kernel/compat_ptrace.h index cde81fa64f89..a2be3a978d5c 100644 --- a/arch/s390/kernel/compat_ptrace.h +++ b/arch/s390/kernel/compat_ptrace.h | |||
| @@ -42,6 +42,7 @@ struct user_regs_struct32 | |||
| 42 | u32 gprs[NUM_GPRS]; | 42 | u32 gprs[NUM_GPRS]; |
| 43 | u32 acrs[NUM_ACRS]; | 43 | u32 acrs[NUM_ACRS]; |
| 44 | u32 orig_gpr2; | 44 | u32 orig_gpr2; |
| 45 | /* nb: there's a 4-byte hole here */ | ||
| 45 | s390_fp_regs fp_regs; | 46 | s390_fp_regs fp_regs; |
| 46 | /* | 47 | /* |
| 47 | * These per registers are in here so that gdb can modify them | 48 | * These per registers are in here so that gdb can modify them |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 2815bfe348a6..c8b08289eb87 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
| @@ -170,6 +170,13 @@ static unsigned long __peek_user(struct task_struct *child, addr_t addr) | |||
| 170 | */ | 170 | */ |
| 171 | tmp = (addr_t) task_pt_regs(child)->orig_gpr2; | 171 | tmp = (addr_t) task_pt_regs(child)->orig_gpr2; |
| 172 | 172 | ||
| 173 | } else if (addr < (addr_t) &dummy->regs.fp_regs) { | ||
| 174 | /* | ||
| 175 | * prevent reads of padding hole between | ||
| 176 | * orig_gpr2 and fp_regs on s390. | ||
| 177 | */ | ||
| 178 | tmp = 0; | ||
| 179 | |||
| 173 | } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { | 180 | } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { |
| 174 | /* | 181 | /* |
| 175 | * floating point regs. are stored in the thread structure | 182 | * floating point regs. are stored in the thread structure |
| @@ -270,6 +277,13 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
| 270 | */ | 277 | */ |
| 271 | task_pt_regs(child)->orig_gpr2 = data; | 278 | task_pt_regs(child)->orig_gpr2 = data; |
| 272 | 279 | ||
| 280 | } else if (addr < (addr_t) &dummy->regs.fp_regs) { | ||
| 281 | /* | ||
| 282 | * prevent writes of padding hole between | ||
| 283 | * orig_gpr2 and fp_regs on s390. | ||
| 284 | */ | ||
| 285 | return 0; | ||
| 286 | |||
| 273 | } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { | 287 | } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { |
| 274 | /* | 288 | /* |
| 275 | * floating point regs. are stored in the thread structure | 289 | * floating point regs. are stored in the thread structure |
| @@ -428,6 +442,13 @@ static u32 __peek_user_compat(struct task_struct *child, addr_t addr) | |||
| 428 | */ | 442 | */ |
| 429 | tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4); | 443 | tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4); |
| 430 | 444 | ||
| 445 | } else if (addr < (addr_t) &dummy32->regs.fp_regs) { | ||
| 446 | /* | ||
| 447 | * prevent reads of padding hole between | ||
| 448 | * orig_gpr2 and fp_regs on s390. | ||
| 449 | */ | ||
| 450 | tmp = 0; | ||
| 451 | |||
| 431 | } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { | 452 | } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { |
| 432 | /* | 453 | /* |
| 433 | * floating point regs. are stored in the thread structure | 454 | * floating point regs. are stored in the thread structure |
| @@ -514,6 +535,13 @@ static int __poke_user_compat(struct task_struct *child, | |||
| 514 | */ | 535 | */ |
| 515 | *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp; | 536 | *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp; |
| 516 | 537 | ||
| 538 | } else if (addr < (addr_t) &dummy32->regs.fp_regs) { | ||
| 539 | /* | ||
| 540 | * prevent writess of padding hole between | ||
| 541 | * orig_gpr2 and fp_regs on s390. | ||
| 542 | */ | ||
| 543 | return 0; | ||
| 544 | |||
| 517 | } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { | 545 | } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { |
| 518 | /* | 546 | /* |
| 519 | * floating point regs. are stored in the thread structure | 547 | * floating point regs. are stored in the thread structure |
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 9b6689d9d570..23963882bc18 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c | |||
| @@ -792,6 +792,8 @@ void fixup_irqs(void) | |||
| 792 | } | 792 | } |
| 793 | spin_unlock_irqrestore(&irq_desc[irq].lock, flags); | 793 | spin_unlock_irqrestore(&irq_desc[irq].lock, flags); |
| 794 | } | 794 | } |
| 795 | |||
| 796 | tick_ops->disable_irq(); | ||
| 795 | } | 797 | } |
| 796 | #endif | 798 | #endif |
| 797 | 799 | ||
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 2c518fbc52ec..b225219c448c 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
| @@ -382,14 +382,17 @@ config X86_OOSTORE | |||
| 382 | # P6_NOPs are a relatively minor optimization that require a family >= | 382 | # P6_NOPs are a relatively minor optimization that require a family >= |
| 383 | # 6 processor, except that it is broken on certain VIA chips. | 383 | # 6 processor, except that it is broken on certain VIA chips. |
| 384 | # Furthermore, AMD chips prefer a totally different sequence of NOPs | 384 | # Furthermore, AMD chips prefer a totally different sequence of NOPs |
| 385 | # (which work on all CPUs). As a result, disallow these if we're | 385 | # (which work on all CPUs). In addition, it looks like Virtual PC |
| 386 | # compiling X86_GENERIC but not X86_64 (these NOPs do work on all | 386 | # does not understand them. |
| 387 | # x86-64 capable chips); the list of processors in the right-hand clause | 387 | # |
| 388 | # are the cores that benefit from this optimization. | 388 | # As a result, disallow these if we're not compiling for X86_64 (these |
| 389 | # NOPs do work on all x86-64 capable chips); the list of processors in | ||
| 390 | # the right-hand clause are the cores that benefit from this optimization. | ||
| 389 | # | 391 | # |
| 390 | config X86_P6_NOP | 392 | config X86_P6_NOP |
| 391 | def_bool y | 393 | def_bool y |
| 392 | depends on (X86_64 || !X86_GENERIC) && (M686 || MPENTIUMII || MPENTIUMIII || MPENTIUMM || MCORE2 || MPENTIUM4 || MPSC) | 394 | depends on X86_64 |
| 395 | depends on (MCORE2 || MPENTIUM4 || MPSC) | ||
| 393 | 396 | ||
| 394 | config X86_TSC | 397 | config X86_TSC |
| 395 | def_bool y | 398 | def_bool y |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 9af89078f7bb..66e48aa2dd1b 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
| @@ -1203,7 +1203,7 @@ static int __init parse_memmap_opt(char *p) | |||
| 1203 | if (!p) | 1203 | if (!p) |
| 1204 | return -EINVAL; | 1204 | return -EINVAL; |
| 1205 | 1205 | ||
| 1206 | if (!strcmp(p, "exactmap")) { | 1206 | if (!strncmp(p, "exactmap", 8)) { |
| 1207 | #ifdef CONFIG_CRASH_DUMP | 1207 | #ifdef CONFIG_CRASH_DUMP |
| 1208 | /* | 1208 | /* |
| 1209 | * If we are doing a crash dump, we still need to know | 1209 | * If we are doing a crash dump, we still need to know |
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index db00b0591733..f1216cf6fa8f 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c | |||
| @@ -423,7 +423,7 @@ int chp_new(struct chp_id chpid) | |||
| 423 | ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); | 423 | ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); |
| 424 | if (ret) { | 424 | if (ret) { |
| 425 | device_unregister(&chp->dev); | 425 | device_unregister(&chp->dev); |
| 426 | goto out_free; | 426 | goto out; |
| 427 | } | 427 | } |
| 428 | mutex_lock(&channel_subsystems[chpid.cssid]->mutex); | 428 | mutex_lock(&channel_subsystems[chpid.cssid]->mutex); |
| 429 | if (channel_subsystems[chpid.cssid]->cm_enabled) { | 429 | if (channel_subsystems[chpid.cssid]->cm_enabled) { |
| @@ -432,14 +432,15 @@ int chp_new(struct chp_id chpid) | |||
| 432 | sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); | 432 | sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); |
| 433 | device_unregister(&chp->dev); | 433 | device_unregister(&chp->dev); |
| 434 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); | 434 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); |
| 435 | goto out_free; | 435 | goto out; |
| 436 | } | 436 | } |
| 437 | } | 437 | } |
| 438 | channel_subsystems[chpid.cssid]->chps[chpid.id] = chp; | 438 | channel_subsystems[chpid.cssid]->chps[chpid.id] = chp; |
| 439 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); | 439 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); |
| 440 | return ret; | 440 | goto out; |
| 441 | out_free: | 441 | out_free: |
| 442 | kfree(chp); | 442 | kfree(chp); |
| 443 | out: | ||
| 443 | return ret; | 444 | return ret; |
| 444 | } | 445 | } |
| 445 | 446 | ||
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 33bff8fec7d1..5954b905e3ca 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
| @@ -208,8 +208,10 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */ | |||
| 208 | case 1: /* status pending */ | 208 | case 1: /* status pending */ |
| 209 | case 2: /* busy */ | 209 | case 2: /* busy */ |
| 210 | return -EBUSY; | 210 | return -EBUSY; |
| 211 | default: /* device/path not operational */ | 211 | case 3: /* device/path not operational */ |
| 212 | return cio_start_handle_notoper(sch, lpm); | 212 | return cio_start_handle_notoper(sch, lpm); |
| 213 | default: | ||
| 214 | return ccode; | ||
| 213 | } | 215 | } |
| 214 | } | 216 | } |
| 215 | 217 | ||
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 51489eff6b0b..1261e1a9e8cd 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
| @@ -633,6 +633,11 @@ channel_subsystem_release(struct device *dev) | |||
| 633 | 633 | ||
| 634 | css = to_css(dev); | 634 | css = to_css(dev); |
| 635 | mutex_destroy(&css->mutex); | 635 | mutex_destroy(&css->mutex); |
| 636 | if (css->pseudo_subchannel) { | ||
| 637 | /* Implies that it has been generated but never registered. */ | ||
| 638 | css_subchannel_release(&css->pseudo_subchannel->dev); | ||
| 639 | css->pseudo_subchannel = NULL; | ||
| 640 | } | ||
| 636 | kfree(css); | 641 | kfree(css); |
| 637 | } | 642 | } |
| 638 | 643 | ||
| @@ -785,11 +790,15 @@ init_channel_subsystem (void) | |||
| 785 | } | 790 | } |
| 786 | channel_subsystems[i] = css; | 791 | channel_subsystems[i] = css; |
| 787 | ret = setup_css(i); | 792 | ret = setup_css(i); |
| 788 | if (ret) | 793 | if (ret) { |
| 789 | goto out_free; | 794 | kfree(channel_subsystems[i]); |
| 795 | goto out_unregister; | ||
| 796 | } | ||
| 790 | ret = device_register(&css->device); | 797 | ret = device_register(&css->device); |
| 791 | if (ret) | 798 | if (ret) { |
| 792 | goto out_free_all; | 799 | put_device(&css->device); |
| 800 | goto out_unregister; | ||
| 801 | } | ||
| 793 | if (css_chsc_characteristics.secm) { | 802 | if (css_chsc_characteristics.secm) { |
| 794 | ret = device_create_file(&css->device, | 803 | ret = device_create_file(&css->device, |
| 795 | &dev_attr_cm_enable); | 804 | &dev_attr_cm_enable); |
| @@ -802,7 +811,7 @@ init_channel_subsystem (void) | |||
| 802 | } | 811 | } |
| 803 | ret = register_reboot_notifier(&css_reboot_notifier); | 812 | ret = register_reboot_notifier(&css_reboot_notifier); |
| 804 | if (ret) | 813 | if (ret) |
| 805 | goto out_pseudo; | 814 | goto out_unregister; |
| 806 | css_init_done = 1; | 815 | css_init_done = 1; |
| 807 | 816 | ||
| 808 | /* Enable default isc for I/O subchannels. */ | 817 | /* Enable default isc for I/O subchannels. */ |
| @@ -810,18 +819,12 @@ init_channel_subsystem (void) | |||
| 810 | 819 | ||
| 811 | for_each_subchannel(__init_channel_subsystem, NULL); | 820 | for_each_subchannel(__init_channel_subsystem, NULL); |
| 812 | return 0; | 821 | return 0; |
| 813 | out_pseudo: | ||
| 814 | device_unregister(&channel_subsystems[i]->pseudo_subchannel->dev); | ||
| 815 | out_file: | 822 | out_file: |
| 816 | device_remove_file(&channel_subsystems[i]->device, | 823 | if (css_chsc_characteristics.secm) |
| 817 | &dev_attr_cm_enable); | 824 | device_remove_file(&channel_subsystems[i]->device, |
| 825 | &dev_attr_cm_enable); | ||
| 818 | out_device: | 826 | out_device: |
| 819 | device_unregister(&channel_subsystems[i]->device); | 827 | device_unregister(&channel_subsystems[i]->device); |
| 820 | out_free_all: | ||
| 821 | kfree(channel_subsystems[i]->pseudo_subchannel->lock); | ||
| 822 | kfree(channel_subsystems[i]->pseudo_subchannel); | ||
| 823 | out_free: | ||
| 824 | kfree(channel_subsystems[i]); | ||
| 825 | out_unregister: | 828 | out_unregister: |
| 826 | while (i > 0) { | 829 | while (i > 0) { |
| 827 | struct channel_subsystem *css; | 830 | struct channel_subsystem *css; |
| @@ -829,6 +832,7 @@ out_unregister: | |||
| 829 | i--; | 832 | i--; |
| 830 | css = channel_subsystems[i]; | 833 | css = channel_subsystems[i]; |
| 831 | device_unregister(&css->pseudo_subchannel->dev); | 834 | device_unregister(&css->pseudo_subchannel->dev); |
| 835 | css->pseudo_subchannel = NULL; | ||
| 832 | if (css_chsc_characteristics.secm) | 836 | if (css_chsc_characteristics.secm) |
| 833 | device_remove_file(&css->device, | 837 | device_remove_file(&css->device, |
| 834 | &dev_attr_cm_enable); | 838 | &dev_attr_cm_enable); |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 550508df952b..84cc9ea346db 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
| @@ -658,6 +658,13 @@ ccw_device_offline(struct ccw_device *cdev) | |||
| 658 | { | 658 | { |
| 659 | struct subchannel *sch; | 659 | struct subchannel *sch; |
| 660 | 660 | ||
| 661 | /* Allow ccw_device_offline while disconnected. */ | ||
| 662 | if (cdev->private->state == DEV_STATE_DISCONNECTED || | ||
| 663 | cdev->private->state == DEV_STATE_NOT_OPER) { | ||
| 664 | cdev->private->flags.donotify = 0; | ||
| 665 | ccw_device_done(cdev, DEV_STATE_NOT_OPER); | ||
| 666 | return 0; | ||
| 667 | } | ||
| 661 | if (ccw_device_is_orphan(cdev)) { | 668 | if (ccw_device_is_orphan(cdev)) { |
| 662 | ccw_device_done(cdev, DEV_STATE_OFFLINE); | 669 | ccw_device_done(cdev, DEV_STATE_OFFLINE); |
| 663 | return 0; | 670 | return 0; |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index d4427cb86979..2e15da5459cf 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | 60 | ||
| 61 | #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10)) | 61 | #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10)) |
| 62 | 62 | ||
| 63 | #define BALLOON_CLASS_NAME "memory" | 63 | #define BALLOON_CLASS_NAME "xen_memory" |
| 64 | 64 | ||
| 65 | struct balloon_stats { | 65 | struct balloon_stats { |
| 66 | /* We aim for 'current allocation' == 'target allocation'. */ | 66 | /* We aim for 'current allocation' == 'target allocation'. */ |
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index 154098157473..73db464cd08b 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c | |||
| @@ -302,18 +302,6 @@ long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs) | |||
| 302 | int subtract_lebs; | 302 | int subtract_lebs; |
| 303 | long long available; | 303 | long long available; |
| 304 | 304 | ||
| 305 | /* | ||
| 306 | * Force the amount available to the total size reported if the used | ||
| 307 | * space is zero. | ||
| 308 | */ | ||
| 309 | if (c->lst.total_used <= UBIFS_INO_NODE_SZ && | ||
| 310 | c->budg_data_growth + c->budg_dd_growth == 0) { | ||
| 311 | /* Do the same calculation as for c->block_cnt */ | ||
| 312 | available = c->main_lebs - 2; | ||
| 313 | available *= c->leb_size - c->dark_wm; | ||
| 314 | return available; | ||
| 315 | } | ||
| 316 | |||
| 317 | available = c->main_bytes - c->lst.total_used; | 305 | available = c->main_bytes - c->lst.total_used; |
| 318 | 306 | ||
| 319 | /* | 307 | /* |
| @@ -714,34 +702,106 @@ void ubifs_release_dirty_inode_budget(struct ubifs_info *c, | |||
| 714 | } | 702 | } |
| 715 | 703 | ||
| 716 | /** | 704 | /** |
| 717 | * ubifs_budg_get_free_space - return amount of free space. | 705 | * ubifs_reported_space - calculate reported free space. |
| 706 | * @c: the UBIFS file-system description object | ||
| 707 | * @free: amount of free space | ||
| 708 | * | ||
| 709 | * This function calculates amount of free space which will be reported to | ||
| 710 | * user-space. User-space application tend to expect that if the file-system | ||
| 711 | * (e.g., via the 'statfs()' call) reports that it has N bytes available, they | ||
| 712 | * are able to write a file of size N. UBIFS attaches node headers to each data | ||
| 713 | * node and it has to write indexind nodes as well. This introduces additional | ||
| 714 | * overhead, and UBIFS it has to report sligtly less free space to meet the | ||
| 715 | * above expectetion. | ||
| 716 | * | ||
| 717 | * This function assumes free space is made up of uncompressed data nodes and | ||
| 718 | * full index nodes (one per data node, tripled because we always allow enough | ||
| 719 | * space to write the index thrice). | ||
| 720 | * | ||
| 721 | * Note, the calculation is pessimistic, which means that most of the time | ||
| 722 | * UBIFS reports less space than it actually has. | ||
| 723 | */ | ||
| 724 | long long ubifs_reported_space(const struct ubifs_info *c, uint64_t free) | ||
| 725 | { | ||
| 726 | int divisor, factor, f; | ||
| 727 | |||
| 728 | /* | ||
| 729 | * Reported space size is @free * X, where X is UBIFS block size | ||
| 730 | * divided by UBIFS block size + all overhead one data block | ||
| 731 | * introduces. The overhead is the node header + indexing overhead. | ||
| 732 | * | ||
| 733 | * Indexing overhead calculations are based on the following formula: | ||
| 734 | * I = N/(f - 1) + 1, where I - number of indexing nodes, N - number | ||
| 735 | * of data nodes, f - fanout. Because effective UBIFS fanout is twice | ||
| 736 | * as less than maximum fanout, we assume that each data node | ||
| 737 | * introduces 3 * @c->max_idx_node_sz / (@c->fanout/2 - 1) bytes. | ||
| 738 | * Note, the multiplier 3 is because UBIFS reseves thrice as more space | ||
| 739 | * for the index. | ||
| 740 | */ | ||
| 741 | f = c->fanout > 3 ? c->fanout >> 1 : 2; | ||
| 742 | factor = UBIFS_BLOCK_SIZE; | ||
| 743 | divisor = UBIFS_MAX_DATA_NODE_SZ; | ||
| 744 | divisor += (c->max_idx_node_sz * 3) / (f - 1); | ||
| 745 | free *= factor; | ||
| 746 | do_div(free, divisor); | ||
| 747 | return free; | ||
| 748 | } | ||
| 749 | |||
| 750 | /** | ||
| 751 | * ubifs_get_free_space - return amount of free space. | ||
| 718 | * @c: UBIFS file-system description object | 752 | * @c: UBIFS file-system description object |
| 719 | * | 753 | * |
| 720 | * This function returns amount of free space on the file-system. | 754 | * This function calculates amount of free space to report to user-space. |
| 755 | * | ||
| 756 | * Because UBIFS may introduce substantial overhead (the index, node headers, | ||
| 757 | * alighment, wastage at the end of eraseblocks, etc), it cannot report real | ||
| 758 | * amount of free flash space it has (well, because not all dirty space is | ||
| 759 | * reclamable, UBIFS does not actually know the real amount). If UBIFS did so, | ||
| 760 | * it would bread user expectetion about what free space is. Users seem to | ||
| 761 | * accustomed to assume that if the file-system reports N bytes of free space, | ||
| 762 | * they would be able to fit a file of N bytes to the FS. This almost works for | ||
| 763 | * traditional file-systems, because they have way less overhead than UBIFS. | ||
| 764 | * So, to keep users happy, UBIFS tries to take the overhead into account. | ||
| 721 | */ | 765 | */ |
| 722 | long long ubifs_budg_get_free_space(struct ubifs_info *c) | 766 | long long ubifs_get_free_space(struct ubifs_info *c) |
| 723 | { | 767 | { |
| 724 | int min_idx_lebs, rsvd_idx_lebs; | 768 | int min_idx_lebs, rsvd_idx_lebs, lebs; |
| 725 | long long available, outstanding, free; | 769 | long long available, outstanding, free; |
| 726 | 770 | ||
| 727 | /* Do exactly the same calculations as in 'do_budget_space()' */ | ||
| 728 | spin_lock(&c->space_lock); | 771 | spin_lock(&c->space_lock); |
| 729 | min_idx_lebs = ubifs_calc_min_idx_lebs(c); | 772 | min_idx_lebs = ubifs_calc_min_idx_lebs(c); |
| 773 | outstanding = c->budg_data_growth + c->budg_dd_growth; | ||
| 730 | 774 | ||
| 731 | if (min_idx_lebs > c->lst.idx_lebs) | 775 | /* |
| 732 | rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs; | 776 | * Force the amount available to the total size reported if the used |
| 733 | else | 777 | * space is zero. |
| 734 | rsvd_idx_lebs = 0; | 778 | */ |
| 735 | 779 | if (c->lst.total_used <= UBIFS_INO_NODE_SZ && !outstanding) { | |
| 736 | if (rsvd_idx_lebs > c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt | ||
| 737 | - c->lst.taken_empty_lebs) { | ||
| 738 | spin_unlock(&c->space_lock); | 780 | spin_unlock(&c->space_lock); |
| 739 | return 0; | 781 | return (long long)c->block_cnt << UBIFS_BLOCK_SHIFT; |
| 740 | } | 782 | } |
| 741 | 783 | ||
| 742 | available = ubifs_calc_available(c, min_idx_lebs); | 784 | available = ubifs_calc_available(c, min_idx_lebs); |
| 743 | outstanding = c->budg_data_growth + c->budg_dd_growth; | 785 | |
| 744 | c->min_idx_lebs = min_idx_lebs; | 786 | /* |
| 787 | * When reporting free space to user-space, UBIFS guarantees that it is | ||
| 788 | * possible to write a file of free space size. This means that for | ||
| 789 | * empty LEBs we may use more precise calculations than | ||
| 790 | * 'ubifs_calc_available()' is using. Namely, we know that in empty | ||
| 791 | * LEBs we would waste only @c->leb_overhead bytes, not @c->dark_wm. | ||
| 792 | * Thus, amend the available space. | ||
| 793 | * | ||
| 794 | * Note, the calculations below are similar to what we have in | ||
| 795 | * 'do_budget_space()', so refer there for comments. | ||
| 796 | */ | ||
| 797 | if (min_idx_lebs > c->lst.idx_lebs) | ||
| 798 | rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs; | ||
| 799 | else | ||
| 800 | rsvd_idx_lebs = 0; | ||
| 801 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - | ||
| 802 | c->lst.taken_empty_lebs; | ||
| 803 | lebs -= rsvd_idx_lebs; | ||
| 804 | available += lebs * (c->dark_wm - c->leb_overhead); | ||
| 745 | spin_unlock(&c->space_lock); | 805 | spin_unlock(&c->space_lock); |
| 746 | 806 | ||
| 747 | if (available > outstanding) | 807 | if (available > outstanding) |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 5c96f1fb7016..2b267c9a1806 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
| @@ -587,7 +587,6 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 587 | if (err) { | 587 | if (err) { |
| 588 | if (err != -ENOSPC) | 588 | if (err != -ENOSPC) |
| 589 | return err; | 589 | return err; |
| 590 | err = 0; | ||
| 591 | budgeted = 0; | 590 | budgeted = 0; |
| 592 | } | 591 | } |
| 593 | 592 | ||
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 4071d1cae29f..3d698e2022b1 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
| @@ -793,7 +793,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode, | |||
| 793 | int err; | 793 | int err; |
| 794 | struct ubifs_budget_req req; | 794 | struct ubifs_budget_req req; |
| 795 | loff_t old_size = inode->i_size, new_size = attr->ia_size; | 795 | loff_t old_size = inode->i_size, new_size = attr->ia_size; |
| 796 | int offset = new_size & (UBIFS_BLOCK_SIZE - 1); | 796 | int offset = new_size & (UBIFS_BLOCK_SIZE - 1), budgeted = 1; |
| 797 | struct ubifs_inode *ui = ubifs_inode(inode); | 797 | struct ubifs_inode *ui = ubifs_inode(inode); |
| 798 | 798 | ||
| 799 | dbg_gen("ino %lu, size %lld -> %lld", inode->i_ino, old_size, new_size); | 799 | dbg_gen("ino %lu, size %lld -> %lld", inode->i_ino, old_size, new_size); |
| @@ -811,8 +811,15 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode, | |||
| 811 | /* A funny way to budget for truncation node */ | 811 | /* A funny way to budget for truncation node */ |
| 812 | req.dirtied_ino_d = UBIFS_TRUN_NODE_SZ; | 812 | req.dirtied_ino_d = UBIFS_TRUN_NODE_SZ; |
| 813 | err = ubifs_budget_space(c, &req); | 813 | err = ubifs_budget_space(c, &req); |
| 814 | if (err) | 814 | if (err) { |
| 815 | return err; | 815 | /* |
| 816 | * Treat truncations to zero as deletion and always allow them, | ||
| 817 | * just like we do for '->unlink()'. | ||
| 818 | */ | ||
| 819 | if (new_size || err != -ENOSPC) | ||
| 820 | return err; | ||
| 821 | budgeted = 0; | ||
| 822 | } | ||
| 816 | 823 | ||
| 817 | err = vmtruncate(inode, new_size); | 824 | err = vmtruncate(inode, new_size); |
| 818 | if (err) | 825 | if (err) |
| @@ -869,7 +876,12 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode, | |||
| 869 | err = ubifs_jnl_truncate(c, inode, old_size, new_size); | 876 | err = ubifs_jnl_truncate(c, inode, old_size, new_size); |
| 870 | mutex_unlock(&ui->ui_mutex); | 877 | mutex_unlock(&ui->ui_mutex); |
| 871 | out_budg: | 878 | out_budg: |
| 872 | ubifs_release_budget(c, &req); | 879 | if (budgeted) |
| 880 | ubifs_release_budget(c, &req); | ||
| 881 | else { | ||
| 882 | c->nospace = c->nospace_rp = 0; | ||
| 883 | smp_wmb(); | ||
| 884 | } | ||
| 873 | return err; | 885 | return err; |
| 874 | } | 886 | } |
| 875 | 887 | ||
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c index adee7b5ddeab..e045c8b55423 100644 --- a/fs/ubifs/find.c +++ b/fs/ubifs/find.c | |||
| @@ -211,14 +211,8 @@ static const struct ubifs_lprops *scan_for_dirty(struct ubifs_info *c, | |||
| 211 | * dirty index heap, and it falls-back to LPT scanning if the heaps are empty | 211 | * dirty index heap, and it falls-back to LPT scanning if the heaps are empty |
| 212 | * or do not have an LEB which satisfies the @min_space criteria. | 212 | * or do not have an LEB which satisfies the @min_space criteria. |
| 213 | * | 213 | * |
| 214 | * Note: | 214 | * Note, LEBs which have less than dead watermark of free + dirty space are |
| 215 | * o LEBs which have less than dead watermark of dirty space are never picked | 215 | * never picked by this function. |
| 216 | * by this function; | ||
| 217 | * | ||
| 218 | * Returns zero and the LEB properties of | ||
| 219 | * found dirty LEB in case of success, %-ENOSPC if no dirty LEB was found and a | ||
| 220 | * negative error code in case of other failures. The returned LEB is marked as | ||
| 221 | * "taken". | ||
| 222 | * | 216 | * |
| 223 | * The additional @pick_free argument controls if this function has to return a | 217 | * The additional @pick_free argument controls if this function has to return a |
| 224 | * free or freeable LEB if one is present. For example, GC must to set it to %1, | 218 | * free or freeable LEB if one is present. For example, GC must to set it to %1, |
| @@ -231,6 +225,10 @@ static const struct ubifs_lprops *scan_for_dirty(struct ubifs_info *c, | |||
| 231 | * | 225 | * |
| 232 | * In addition @pick_free is set to %2 by the recovery process in order to | 226 | * In addition @pick_free is set to %2 by the recovery process in order to |
| 233 | * recover gc_lnum in which case an index LEB must not be returned. | 227 | * recover gc_lnum in which case an index LEB must not be returned. |
| 228 | * | ||
| 229 | * This function returns zero and the LEB properties of found dirty LEB in case | ||
| 230 | * of success, %-ENOSPC if no dirty LEB was found and a negative error code in | ||
| 231 | * case of other failures. The returned LEB is marked as "taken". | ||
| 234 | */ | 232 | */ |
| 235 | int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp, | 233 | int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp, |
| 236 | int min_space, int pick_free) | 234 | int min_space, int pick_free) |
| @@ -245,7 +243,7 @@ int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp, | |||
| 245 | int lebs, rsvd_idx_lebs = 0; | 243 | int lebs, rsvd_idx_lebs = 0; |
| 246 | 244 | ||
| 247 | spin_lock(&c->space_lock); | 245 | spin_lock(&c->space_lock); |
| 248 | lebs = c->lst.empty_lebs; | 246 | lebs = c->lst.empty_lebs + c->idx_gc_cnt; |
| 249 | lebs += c->freeable_cnt - c->lst.taken_empty_lebs; | 247 | lebs += c->freeable_cnt - c->lst.taken_empty_lebs; |
| 250 | 248 | ||
| 251 | /* | 249 | /* |
| @@ -317,7 +315,7 @@ int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp, | |||
| 317 | lp = idx_lp; | 315 | lp = idx_lp; |
| 318 | 316 | ||
| 319 | if (lp) { | 317 | if (lp) { |
| 320 | ubifs_assert(lp->dirty >= c->dead_wm); | 318 | ubifs_assert(lp->free + lp->dirty >= c->dead_wm); |
| 321 | goto found; | 319 | goto found; |
| 322 | } | 320 | } |
| 323 | 321 | ||
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index d0f3dac29081..13f1019c859f 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
| @@ -344,6 +344,12 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) | |||
| 344 | if (err) | 344 | if (err) |
| 345 | goto out; | 345 | goto out; |
| 346 | 346 | ||
| 347 | /* Allow for races with TNC */ | ||
| 348 | c->gced_lnum = lnum; | ||
| 349 | smp_wmb(); | ||
| 350 | c->gc_seq += 1; | ||
| 351 | smp_wmb(); | ||
| 352 | |||
| 347 | if (c->gc_lnum == -1) { | 353 | if (c->gc_lnum == -1) { |
| 348 | c->gc_lnum = lnum; | 354 | c->gc_lnum = lnum; |
| 349 | err = LEB_RETAINED; | 355 | err = LEB_RETAINED; |
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h index 87dabf9fe742..4c12a9215d7f 100644 --- a/fs/ubifs/misc.h +++ b/fs/ubifs/misc.h | |||
| @@ -284,38 +284,6 @@ static inline void *ubifs_idx_key(const struct ubifs_info *c, | |||
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | /** | 286 | /** |
| 287 | * ubifs_reported_space - calculate reported free space. | ||
| 288 | * @c: the UBIFS file-system description object | ||
| 289 | * @free: amount of free space | ||
| 290 | * | ||
| 291 | * This function calculates amount of free space which will be reported to | ||
| 292 | * user-space. User-space application tend to expect that if the file-system | ||
| 293 | * (e.g., via the 'statfs()' call) reports that it has N bytes available, they | ||
| 294 | * are able to write a file of size N. UBIFS attaches node headers to each data | ||
| 295 | * node and it has to write indexind nodes as well. This introduces additional | ||
| 296 | * overhead, and UBIFS it has to report sligtly less free space to meet the | ||
| 297 | * above expectetion. | ||
| 298 | * | ||
| 299 | * This function assumes free space is made up of uncompressed data nodes and | ||
| 300 | * full index nodes (one per data node, doubled because we always allow enough | ||
| 301 | * space to write the index twice). | ||
| 302 | * | ||
| 303 | * Note, the calculation is pessimistic, which means that most of the time | ||
| 304 | * UBIFS reports less space than it actually has. | ||
| 305 | */ | ||
| 306 | static inline long long ubifs_reported_space(const struct ubifs_info *c, | ||
| 307 | uint64_t free) | ||
| 308 | { | ||
| 309 | int divisor, factor; | ||
| 310 | |||
| 311 | divisor = UBIFS_MAX_DATA_NODE_SZ + (c->max_idx_node_sz * 3); | ||
| 312 | factor = UBIFS_MAX_DATA_NODE_SZ - UBIFS_DATA_NODE_SZ; | ||
| 313 | do_div(free, divisor); | ||
| 314 | |||
| 315 | return free * factor; | ||
| 316 | } | ||
| 317 | |||
| 318 | /** | ||
| 319 | * ubifs_current_time - round current time to time granularity. | 287 | * ubifs_current_time - round current time to time granularity. |
| 320 | * @inode: inode | 288 | * @inode: inode |
| 321 | */ | 289 | */ |
| @@ -325,4 +293,21 @@ static inline struct timespec ubifs_current_time(struct inode *inode) | |||
| 325 | current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; | 293 | current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; |
| 326 | } | 294 | } |
| 327 | 295 | ||
| 296 | /** | ||
| 297 | * ubifs_tnc_lookup - look up a file-system node. | ||
| 298 | * @c: UBIFS file-system description object | ||
| 299 | * @key: node key to lookup | ||
| 300 | * @node: the node is returned here | ||
| 301 | * | ||
| 302 | * This function look up and reads node with key @key. The caller has to make | ||
| 303 | * sure the @node buffer is large enough to fit the node. Returns zero in case | ||
| 304 | * of success, %-ENOENT if the node was not found, and a negative error code in | ||
| 305 | * case of failure. | ||
| 306 | */ | ||
| 307 | static inline int ubifs_tnc_lookup(struct ubifs_info *c, | ||
| 308 | const union ubifs_key *key, void *node) | ||
| 309 | { | ||
| 310 | return ubifs_tnc_locate(c, key, node, NULL, NULL); | ||
| 311 | } | ||
| 312 | |||
| 328 | #endif /* __UBIFS_MISC_H__ */ | 313 | #endif /* __UBIFS_MISC_H__ */ |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index f71e6b8822c4..7562464ac83f 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -370,8 +370,9 @@ static int ubifs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 370 | { | 370 | { |
| 371 | struct ubifs_info *c = dentry->d_sb->s_fs_info; | 371 | struct ubifs_info *c = dentry->d_sb->s_fs_info; |
| 372 | unsigned long long free; | 372 | unsigned long long free; |
| 373 | __le32 *uuid = (__le32 *)c->uuid; | ||
| 373 | 374 | ||
| 374 | free = ubifs_budg_get_free_space(c); | 375 | free = ubifs_get_free_space(c); |
| 375 | dbg_gen("free space %lld bytes (%lld blocks)", | 376 | dbg_gen("free space %lld bytes (%lld blocks)", |
| 376 | free, free >> UBIFS_BLOCK_SHIFT); | 377 | free, free >> UBIFS_BLOCK_SHIFT); |
| 377 | 378 | ||
| @@ -386,7 +387,8 @@ static int ubifs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 386 | buf->f_files = 0; | 387 | buf->f_files = 0; |
| 387 | buf->f_ffree = 0; | 388 | buf->f_ffree = 0; |
| 388 | buf->f_namelen = UBIFS_MAX_NLEN; | 389 | buf->f_namelen = UBIFS_MAX_NLEN; |
| 389 | 390 | buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]); | |
| 391 | buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]); | ||
| 390 | return 0; | 392 | return 0; |
| 391 | } | 393 | } |
| 392 | 394 | ||
| @@ -530,6 +532,12 @@ static int init_constants_early(struct ubifs_info *c) | |||
| 530 | c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); | 532 | c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); |
| 531 | c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); | 533 | c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); |
| 532 | 534 | ||
| 535 | /* | ||
| 536 | * Calculate how many bytes would be wasted at the end of LEB if it was | ||
| 537 | * fully filled with data nodes of maximum size. This is used in | ||
| 538 | * calculations when reporting free space. | ||
| 539 | */ | ||
| 540 | c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ; | ||
| 533 | return 0; | 541 | return 0; |
| 534 | } | 542 | } |
| 535 | 543 | ||
| @@ -647,13 +655,11 @@ static int init_constants_late(struct ubifs_info *c) | |||
| 647 | * internally because it does not make much sense for UBIFS, but it is | 655 | * internally because it does not make much sense for UBIFS, but it is |
| 648 | * necessary to report something for the 'statfs()' call. | 656 | * necessary to report something for the 'statfs()' call. |
| 649 | * | 657 | * |
| 650 | * Subtract the LEB reserved for GC and the LEB which is reserved for | 658 | * Subtract the LEB reserved for GC, the LEB which is reserved for |
| 651 | * deletions. | 659 | * deletions, and assume only one journal head is available. |
| 652 | * | ||
| 653 | * Review 'ubifs_calc_available()' if changing this calculation. | ||
| 654 | */ | 660 | */ |
| 655 | tmp64 = c->main_lebs - 2; | 661 | tmp64 = c->main_lebs - 2 - c->jhead_cnt + 1; |
| 656 | tmp64 *= (uint64_t)c->leb_size - c->dark_wm; | 662 | tmp64 *= (uint64_t)c->leb_size - c->leb_overhead; |
| 657 | tmp64 = ubifs_reported_space(c, tmp64); | 663 | tmp64 = ubifs_reported_space(c, tmp64); |
| 658 | c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT; | 664 | c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT; |
| 659 | 665 | ||
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index e909f4a96443..7da209ab9378 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
| @@ -506,7 +506,7 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, | |||
| 506 | if (keys_cmp(c, key, &node_key) != 0) | 506 | if (keys_cmp(c, key, &node_key) != 0) |
| 507 | ret = 0; | 507 | ret = 0; |
| 508 | } | 508 | } |
| 509 | if (ret == 0) | 509 | if (ret == 0 && c->replaying) |
| 510 | dbg_mnt("dangling branch LEB %d:%d len %d, key %s", | 510 | dbg_mnt("dangling branch LEB %d:%d len %d, key %s", |
| 511 | zbr->lnum, zbr->offs, zbr->len, DBGKEY(key)); | 511 | zbr->lnum, zbr->offs, zbr->len, DBGKEY(key)); |
| 512 | return ret; | 512 | return ret; |
| @@ -1382,50 +1382,39 @@ static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, | |||
| 1382 | } | 1382 | } |
| 1383 | 1383 | ||
| 1384 | /** | 1384 | /** |
| 1385 | * ubifs_tnc_lookup - look up a file-system node. | 1385 | * maybe_leb_gced - determine if a LEB may have been garbage collected. |
| 1386 | * @c: UBIFS file-system description object | 1386 | * @c: UBIFS file-system description object |
| 1387 | * @key: node key to lookup | 1387 | * @lnum: LEB number |
| 1388 | * @node: the node is returned here | 1388 | * @gc_seq1: garbage collection sequence number |
| 1389 | * | 1389 | * |
| 1390 | * This function look up and reads node with key @key. The caller has to make | 1390 | * This function determines if @lnum may have been garbage collected since |
| 1391 | * sure the @node buffer is large enough to fit the node. Returns zero in case | 1391 | * sequence number @gc_seq1. If it may have been then %1 is returned, otherwise |
| 1392 | * of success, %-ENOENT if the node was not found, and a negative error code in | 1392 | * %0 is returned. |
| 1393 | * case of failure. | ||
| 1394 | */ | 1393 | */ |
| 1395 | int ubifs_tnc_lookup(struct ubifs_info *c, const union ubifs_key *key, | 1394 | static int maybe_leb_gced(struct ubifs_info *c, int lnum, int gc_seq1) |
| 1396 | void *node) | ||
| 1397 | { | 1395 | { |
| 1398 | int found, n, err; | 1396 | int gc_seq2, gced_lnum; |
| 1399 | struct ubifs_znode *znode; | ||
| 1400 | struct ubifs_zbranch zbr, *zt; | ||
| 1401 | 1397 | ||
| 1402 | mutex_lock(&c->tnc_mutex); | 1398 | gced_lnum = c->gced_lnum; |
| 1403 | found = ubifs_lookup_level0(c, key, &znode, &n); | 1399 | smp_rmb(); |
| 1404 | if (!found) { | 1400 | gc_seq2 = c->gc_seq; |
| 1405 | err = -ENOENT; | 1401 | /* Same seq means no GC */ |
| 1406 | goto out; | 1402 | if (gc_seq1 == gc_seq2) |
| 1407 | } else if (found < 0) { | 1403 | return 0; |
| 1408 | err = found; | 1404 | /* Different by more than 1 means we don't know */ |
| 1409 | goto out; | 1405 | if (gc_seq1 + 1 != gc_seq2) |
| 1410 | } | 1406 | return 1; |
| 1411 | zt = &znode->zbranch[n]; | 1407 | /* |
| 1412 | if (is_hash_key(c, key)) { | 1408 | * We have seen the sequence number has increased by 1. Now we need to |
| 1413 | /* | 1409 | * be sure we read the right LEB number, so read it again. |
| 1414 | * In this case the leaf node cache gets used, so we pass the | 1410 | */ |
| 1415 | * address of the zbranch and keep the mutex locked | 1411 | smp_rmb(); |
| 1416 | */ | 1412 | if (gced_lnum != c->gced_lnum) |
| 1417 | err = tnc_read_node_nm(c, zt, node); | 1413 | return 1; |
| 1418 | goto out; | 1414 | /* Finally we can check lnum */ |
| 1419 | } | 1415 | if (gced_lnum == lnum) |
| 1420 | zbr = znode->zbranch[n]; | 1416 | return 1; |
| 1421 | mutex_unlock(&c->tnc_mutex); | 1417 | return 0; |
| 1422 | |||
| 1423 | err = ubifs_tnc_read_node(c, &zbr, node); | ||
| 1424 | return err; | ||
| 1425 | |||
| 1426 | out: | ||
| 1427 | mutex_unlock(&c->tnc_mutex); | ||
| 1428 | return err; | ||
| 1429 | } | 1418 | } |
| 1430 | 1419 | ||
| 1431 | /** | 1420 | /** |
| @@ -1436,16 +1425,19 @@ out: | |||
| 1436 | * @lnum: LEB number is returned here | 1425 | * @lnum: LEB number is returned here |
| 1437 | * @offs: offset is returned here | 1426 | * @offs: offset is returned here |
| 1438 | * | 1427 | * |
| 1439 | * This function is the same as 'ubifs_tnc_lookup()' but it returns the node | 1428 | * This function look up and reads node with key @key. The caller has to make |
| 1440 | * location also. See 'ubifs_tnc_lookup()'. | 1429 | * sure the @node buffer is large enough to fit the node. Returns zero in case |
| 1430 | * of success, %-ENOENT if the node was not found, and a negative error code in | ||
| 1431 | * case of failure. The node location can be returned in @lnum and @offs. | ||
| 1441 | */ | 1432 | */ |
| 1442 | int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, | 1433 | int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, |
| 1443 | void *node, int *lnum, int *offs) | 1434 | void *node, int *lnum, int *offs) |
| 1444 | { | 1435 | { |
| 1445 | int found, n, err; | 1436 | int found, n, err, safely = 0, gc_seq1; |
| 1446 | struct ubifs_znode *znode; | 1437 | struct ubifs_znode *znode; |
| 1447 | struct ubifs_zbranch zbr, *zt; | 1438 | struct ubifs_zbranch zbr, *zt; |
| 1448 | 1439 | ||
| 1440 | again: | ||
| 1449 | mutex_lock(&c->tnc_mutex); | 1441 | mutex_lock(&c->tnc_mutex); |
| 1450 | found = ubifs_lookup_level0(c, key, &znode, &n); | 1442 | found = ubifs_lookup_level0(c, key, &znode, &n); |
| 1451 | if (!found) { | 1443 | if (!found) { |
| @@ -1456,24 +1448,43 @@ int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, | |||
| 1456 | goto out; | 1448 | goto out; |
| 1457 | } | 1449 | } |
| 1458 | zt = &znode->zbranch[n]; | 1450 | zt = &znode->zbranch[n]; |
| 1451 | if (lnum) { | ||
| 1452 | *lnum = zt->lnum; | ||
| 1453 | *offs = zt->offs; | ||
| 1454 | } | ||
| 1459 | if (is_hash_key(c, key)) { | 1455 | if (is_hash_key(c, key)) { |
| 1460 | /* | 1456 | /* |
| 1461 | * In this case the leaf node cache gets used, so we pass the | 1457 | * In this case the leaf node cache gets used, so we pass the |
| 1462 | * address of the zbranch and keep the mutex locked | 1458 | * address of the zbranch and keep the mutex locked |
| 1463 | */ | 1459 | */ |
| 1464 | *lnum = zt->lnum; | ||
| 1465 | *offs = zt->offs; | ||
| 1466 | err = tnc_read_node_nm(c, zt, node); | 1460 | err = tnc_read_node_nm(c, zt, node); |
| 1467 | goto out; | 1461 | goto out; |
| 1468 | } | 1462 | } |
| 1463 | if (safely) { | ||
| 1464 | err = ubifs_tnc_read_node(c, zt, node); | ||
| 1465 | goto out; | ||
| 1466 | } | ||
| 1467 | /* Drop the TNC mutex prematurely and race with garbage collection */ | ||
| 1469 | zbr = znode->zbranch[n]; | 1468 | zbr = znode->zbranch[n]; |
| 1469 | gc_seq1 = c->gc_seq; | ||
| 1470 | mutex_unlock(&c->tnc_mutex); | 1470 | mutex_unlock(&c->tnc_mutex); |
| 1471 | 1471 | ||
| 1472 | *lnum = zbr.lnum; | 1472 | if (ubifs_get_wbuf(c, zbr.lnum)) { |
| 1473 | *offs = zbr.offs; | 1473 | /* We do not GC journal heads */ |
| 1474 | err = ubifs_tnc_read_node(c, &zbr, node); | ||
| 1475 | return err; | ||
| 1476 | } | ||
| 1474 | 1477 | ||
| 1475 | err = ubifs_tnc_read_node(c, &zbr, node); | 1478 | err = fallible_read_node(c, key, &zbr, node); |
| 1476 | return err; | 1479 | if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) { |
| 1480 | /* | ||
| 1481 | * The node may have been GC'ed out from under us so try again | ||
| 1482 | * while keeping the TNC mutex locked. | ||
| 1483 | */ | ||
| 1484 | safely = 1; | ||
| 1485 | goto again; | ||
| 1486 | } | ||
| 1487 | return 0; | ||
| 1477 | 1488 | ||
| 1478 | out: | 1489 | out: |
| 1479 | mutex_unlock(&c->tnc_mutex); | 1490 | mutex_unlock(&c->tnc_mutex); |
| @@ -1498,7 +1509,6 @@ static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, | |||
| 1498 | { | 1509 | { |
| 1499 | int found, n, err; | 1510 | int found, n, err; |
| 1500 | struct ubifs_znode *znode; | 1511 | struct ubifs_znode *znode; |
| 1501 | struct ubifs_zbranch zbr; | ||
| 1502 | 1512 | ||
| 1503 | dbg_tnc("name '%.*s' key %s", nm->len, nm->name, DBGKEY(key)); | 1513 | dbg_tnc("name '%.*s' key %s", nm->len, nm->name, DBGKEY(key)); |
| 1504 | mutex_lock(&c->tnc_mutex); | 1514 | mutex_lock(&c->tnc_mutex); |
| @@ -1522,11 +1532,7 @@ static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, | |||
| 1522 | goto out_unlock; | 1532 | goto out_unlock; |
| 1523 | } | 1533 | } |
| 1524 | 1534 | ||
| 1525 | zbr = znode->zbranch[n]; | 1535 | err = tnc_read_node_nm(c, &znode->zbranch[n], node); |
| 1526 | mutex_unlock(&c->tnc_mutex); | ||
| 1527 | |||
| 1528 | err = tnc_read_node_nm(c, &zbr, node); | ||
| 1529 | return err; | ||
| 1530 | 1536 | ||
| 1531 | out_unlock: | 1537 | out_unlock: |
| 1532 | mutex_unlock(&c->tnc_mutex); | 1538 | mutex_unlock(&c->tnc_mutex); |
diff --git a/fs/ubifs/ubifs-media.h b/fs/ubifs/ubifs-media.h index bd2121f3426e..a9ecbd9af20d 100644 --- a/fs/ubifs/ubifs-media.h +++ b/fs/ubifs/ubifs-media.h | |||
| @@ -87,7 +87,7 @@ | |||
| 87 | #define UBIFS_SK_LEN 8 | 87 | #define UBIFS_SK_LEN 8 |
| 88 | 88 | ||
| 89 | /* Minimum index tree fanout */ | 89 | /* Minimum index tree fanout */ |
| 90 | #define UBIFS_MIN_FANOUT 2 | 90 | #define UBIFS_MIN_FANOUT 3 |
| 91 | 91 | ||
| 92 | /* Maximum number of levels in UBIFS indexing B-tree */ | 92 | /* Maximum number of levels in UBIFS indexing B-tree */ |
| 93 | #define UBIFS_MAX_LEVELS 512 | 93 | #define UBIFS_MAX_LEVELS 512 |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index d7f706f7a302..17c620b93eec 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
| @@ -995,6 +995,9 @@ struct ubifs_mount_opts { | |||
| 995 | * @max_idx_node_sz: maximum indexing node aligned on 8-bytes boundary | 995 | * @max_idx_node_sz: maximum indexing node aligned on 8-bytes boundary |
| 996 | * @max_inode_sz: maximum possible inode size in bytes | 996 | * @max_inode_sz: maximum possible inode size in bytes |
| 997 | * @max_znode_sz: size of znode in bytes | 997 | * @max_znode_sz: size of znode in bytes |
| 998 | * | ||
| 999 | * @leb_overhead: how many bytes are wasted in an LEB when it is filled with | ||
| 1000 | * data nodes of maximum size - used in free space reporting | ||
| 998 | * @dead_wm: LEB dead space watermark | 1001 | * @dead_wm: LEB dead space watermark |
| 999 | * @dark_wm: LEB dark space watermark | 1002 | * @dark_wm: LEB dark space watermark |
| 1000 | * @block_cnt: count of 4KiB blocks on the FS | 1003 | * @block_cnt: count of 4KiB blocks on the FS |
| @@ -1028,6 +1031,8 @@ struct ubifs_mount_opts { | |||
| 1028 | * @sbuf: a buffer of LEB size used by GC and replay for scanning | 1031 | * @sbuf: a buffer of LEB size used by GC and replay for scanning |
| 1029 | * @idx_gc: list of index LEBs that have been garbage collected | 1032 | * @idx_gc: list of index LEBs that have been garbage collected |
| 1030 | * @idx_gc_cnt: number of elements on the idx_gc list | 1033 | * @idx_gc_cnt: number of elements on the idx_gc list |
| 1034 | * @gc_seq: incremented for every non-index LEB garbage collected | ||
| 1035 | * @gced_lnum: last non-index LEB that was garbage collected | ||
| 1031 | * | 1036 | * |
| 1032 | * @infos_list: links all 'ubifs_info' objects | 1037 | * @infos_list: links all 'ubifs_info' objects |
| 1033 | * @umount_mutex: serializes shrinker and un-mount | 1038 | * @umount_mutex: serializes shrinker and un-mount |
| @@ -1224,6 +1229,8 @@ struct ubifs_info { | |||
| 1224 | int max_idx_node_sz; | 1229 | int max_idx_node_sz; |
| 1225 | long long max_inode_sz; | 1230 | long long max_inode_sz; |
| 1226 | int max_znode_sz; | 1231 | int max_znode_sz; |
| 1232 | |||
| 1233 | int leb_overhead; | ||
| 1227 | int dead_wm; | 1234 | int dead_wm; |
| 1228 | int dark_wm; | 1235 | int dark_wm; |
| 1229 | int block_cnt; | 1236 | int block_cnt; |
| @@ -1257,6 +1264,8 @@ struct ubifs_info { | |||
| 1257 | void *sbuf; | 1264 | void *sbuf; |
| 1258 | struct list_head idx_gc; | 1265 | struct list_head idx_gc; |
| 1259 | int idx_gc_cnt; | 1266 | int idx_gc_cnt; |
| 1267 | volatile int gc_seq; | ||
| 1268 | volatile int gced_lnum; | ||
| 1260 | 1269 | ||
| 1261 | struct list_head infos_list; | 1270 | struct list_head infos_list; |
| 1262 | struct mutex umount_mutex; | 1271 | struct mutex umount_mutex; |
| @@ -1434,9 +1443,10 @@ void ubifs_release_ino_dirty(struct ubifs_info *c, struct inode *inode, | |||
| 1434 | struct ubifs_budget_req *req); | 1443 | struct ubifs_budget_req *req); |
| 1435 | void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode, | 1444 | void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode, |
| 1436 | struct ubifs_budget_req *req); | 1445 | struct ubifs_budget_req *req); |
| 1437 | long long ubifs_budg_get_free_space(struct ubifs_info *c); | 1446 | long long ubifs_get_free_space(struct ubifs_info *c); |
| 1438 | int ubifs_calc_min_idx_lebs(struct ubifs_info *c); | 1447 | int ubifs_calc_min_idx_lebs(struct ubifs_info *c); |
| 1439 | void ubifs_convert_page_budget(struct ubifs_info *c); | 1448 | void ubifs_convert_page_budget(struct ubifs_info *c); |
| 1449 | long long ubifs_reported_space(const struct ubifs_info *c, uint64_t free); | ||
| 1440 | long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs); | 1450 | long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs); |
| 1441 | 1451 | ||
| 1442 | /* find.c */ | 1452 | /* find.c */ |
| @@ -1451,8 +1461,6 @@ int ubifs_save_dirty_idx_lnums(struct ubifs_info *c); | |||
| 1451 | /* tnc.c */ | 1461 | /* tnc.c */ |
| 1452 | int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, | 1462 | int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, |
| 1453 | struct ubifs_znode **zn, int *n); | 1463 | struct ubifs_znode **zn, int *n); |
| 1454 | int ubifs_tnc_lookup(struct ubifs_info *c, const union ubifs_key *key, | ||
| 1455 | void *node); | ||
| 1456 | int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, | 1464 | int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, |
| 1457 | void *node, const struct qstr *nm); | 1465 | void *node, const struct qstr *nm); |
| 1458 | int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, | 1466 | int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 8feeae1f2369..79a7ff925bf8 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
| @@ -14,4 +14,10 @@ extern char __kprobes_text_start[], __kprobes_text_end[]; | |||
| 14 | extern char __initdata_begin[], __initdata_end[]; | 14 | extern char __initdata_begin[], __initdata_end[]; |
| 15 | extern char __start_rodata[], __end_rodata[]; | 15 | extern char __start_rodata[], __end_rodata[]; |
| 16 | 16 | ||
| 17 | /* function descriptor handling (if any). Override | ||
| 18 | * in asm/sections.h */ | ||
| 19 | #ifndef dereference_function_descriptor | ||
| 20 | #define dereference_function_descriptor(p) (p) | ||
| 21 | #endif | ||
| 22 | |||
| 17 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ | 23 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ |
diff --git a/include/asm-parisc/sections.h b/include/asm-parisc/sections.h index fdd43ec42ec5..9d13c3507ad6 100644 --- a/include/asm-parisc/sections.h +++ b/include/asm-parisc/sections.h | |||
| @@ -4,4 +4,9 @@ | |||
| 4 | /* nothing to see, move along */ | 4 | /* nothing to see, move along */ |
| 5 | #include <asm-generic/sections.h> | 5 | #include <asm-generic/sections.h> |
| 6 | 6 | ||
| 7 | #ifdef CONFIG_64BIT | ||
| 8 | #undef dereference_function_descriptor | ||
| 9 | void *dereference_function_descriptor(void *); | ||
| 10 | #endif | ||
| 11 | |||
| 7 | #endif | 12 | #endif |
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 2e35501e61dd..2e8de678e767 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c | |||
| @@ -43,19 +43,17 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires, | |||
| 43 | * and emit a warning. | 43 | * and emit a warning. |
| 44 | */ | 44 | */ |
| 45 | if (++i > 2) { | 45 | if (++i > 2) { |
| 46 | printk(KERN_WARNING "CE: __tick_program_event of %s is " | 46 | /* Increase the min. delta and try again */ |
| 47 | "stuck %llx %llx\n", dev->name ? dev->name : "?", | ||
| 48 | now.tv64, expires.tv64); | ||
| 49 | printk(KERN_WARNING | ||
| 50 | "CE: increasing min_delta_ns %ld to %ld nsec\n", | ||
| 51 | dev->min_delta_ns, dev->min_delta_ns << 1); | ||
| 52 | WARN_ON(1); | ||
| 53 | |||
| 54 | /* Double the min. delta and try again */ | ||
| 55 | if (!dev->min_delta_ns) | 47 | if (!dev->min_delta_ns) |
| 56 | dev->min_delta_ns = 5000; | 48 | dev->min_delta_ns = 5000; |
| 57 | else | 49 | else |
| 58 | dev->min_delta_ns <<= 1; | 50 | dev->min_delta_ns += dev->min_delta_ns >> 1; |
| 51 | |||
| 52 | printk(KERN_WARNING | ||
| 53 | "CE: %s increasing min_delta_ns to %lu nsec\n", | ||
| 54 | dev->name ? dev->name : "?", | ||
| 55 | dev->min_delta_ns << 1); | ||
| 56 | |||
| 59 | i = 0; | 57 | i = 0; |
| 60 | } | 58 | } |
| 61 | 59 | ||
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index d8d1d1142248..c399bc1093cb 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | #include <asm/page.h> /* for PAGE_SIZE */ | 28 | #include <asm/page.h> /* for PAGE_SIZE */ |
| 29 | #include <asm/div64.h> | 29 | #include <asm/div64.h> |
| 30 | #include <asm/sections.h> /* for dereference_function_descriptor() */ | ||
| 30 | 31 | ||
| 31 | /* Works only for digits and letters, but small and fast */ | 32 | /* Works only for digits and letters, but small and fast */ |
| 32 | #define TOLOWER(x) ((x) | 0x20) | 33 | #define TOLOWER(x) ((x) | 0x20) |
| @@ -513,16 +514,6 @@ static char *string(char *buf, char *end, char *s, int field_width, int precisio | |||
| 513 | return buf; | 514 | return buf; |
| 514 | } | 515 | } |
| 515 | 516 | ||
| 516 | static inline void *dereference_function_descriptor(void *ptr) | ||
| 517 | { | ||
| 518 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
| 519 | void *p; | ||
| 520 | if (!probe_kernel_address(ptr, p)) | ||
| 521 | ptr = p; | ||
| 522 | #endif | ||
| 523 | return ptr; | ||
| 524 | } | ||
| 525 | |||
| 526 | static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags) | 517 | static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags) |
| 527 | { | 518 | { |
| 528 | unsigned long value = (unsigned long) ptr; | 519 | unsigned long value = (unsigned long) ptr; |
