diff options
128 files changed, 1713 insertions, 1140 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-rbd b/Documentation/ABI/testing/sysfs-bus-rbd index fa72ccb2282e..dbedafb095e2 100644 --- a/Documentation/ABI/testing/sysfs-bus-rbd +++ b/Documentation/ABI/testing/sysfs-bus-rbd | |||
@@ -57,13 +57,6 @@ create_snap | |||
57 | 57 | ||
58 | $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create | 58 | $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create |
59 | 59 | ||
60 | rollback_snap | ||
61 | |||
62 | Rolls back data to the specified snapshot. This goes over the entire | ||
63 | list of rados blocks and sends a rollback command to each. | ||
64 | |||
65 | $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_rollback | ||
66 | |||
67 | snap_* | 60 | snap_* |
68 | 61 | ||
69 | A directory per each snapshot | 62 | A directory per each snapshot |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e084b7e981e8..776d76b8cb69 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -220,8 +220,9 @@ config NEED_MACH_MEMORY_H | |||
220 | be avoided when possible. | 220 | be avoided when possible. |
221 | 221 | ||
222 | config PHYS_OFFSET | 222 | config PHYS_OFFSET |
223 | hex "Physical address of main memory" | 223 | hex "Physical address of main memory" if MMU |
224 | depends on !ARM_PATCH_PHYS_VIRT && !NEED_MACH_MEMORY_H | 224 | depends on !ARM_PATCH_PHYS_VIRT && !NEED_MACH_MEMORY_H |
225 | default DRAM_BASE if !MMU | ||
225 | help | 226 | help |
226 | Please provide the physical address corresponding to the | 227 | Please provide the physical address corresponding to the |
227 | location of main memory in your system. | 228 | location of main memory in your system. |
diff --git a/arch/arm/include/asm/unwind.h b/arch/arm/include/asm/unwind.h index a5edf421005c..d1c3f3a71c94 100644 --- a/arch/arm/include/asm/unwind.h +++ b/arch/arm/include/asm/unwind.h | |||
@@ -30,14 +30,15 @@ enum unwind_reason_code { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct unwind_idx { | 32 | struct unwind_idx { |
33 | unsigned long addr; | 33 | unsigned long addr_offset; |
34 | unsigned long insn; | 34 | unsigned long insn; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct unwind_table { | 37 | struct unwind_table { |
38 | struct list_head list; | 38 | struct list_head list; |
39 | struct unwind_idx *start; | 39 | const struct unwind_idx *start; |
40 | struct unwind_idx *stop; | 40 | const struct unwind_idx *origin; |
41 | const struct unwind_idx *stop; | ||
41 | unsigned long begin_addr; | 42 | unsigned long begin_addr; |
42 | unsigned long end_addr; | 43 | unsigned long end_addr; |
43 | }; | 44 | }; |
@@ -49,15 +50,6 @@ extern struct unwind_table *unwind_table_add(unsigned long start, | |||
49 | extern void unwind_table_del(struct unwind_table *tab); | 50 | extern void unwind_table_del(struct unwind_table *tab); |
50 | extern void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk); | 51 | extern void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk); |
51 | 52 | ||
52 | #ifdef CONFIG_ARM_UNWIND | ||
53 | extern int __init unwind_init(void); | ||
54 | #else | ||
55 | static inline int __init unwind_init(void) | ||
56 | { | ||
57 | return 0; | ||
58 | } | ||
59 | #endif | ||
60 | |||
61 | #endif /* !__ASSEMBLY__ */ | 53 | #endif /* !__ASSEMBLY__ */ |
62 | 54 | ||
63 | #ifdef CONFIG_ARM_UNWIND | 55 | #ifdef CONFIG_ARM_UNWIND |
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 8e9c98edc068..88b0941ce51e 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -640,6 +640,9 @@ static struct platform_device_id armpmu_plat_device_ids[] = { | |||
640 | 640 | ||
641 | static int __devinit armpmu_device_probe(struct platform_device *pdev) | 641 | static int __devinit armpmu_device_probe(struct platform_device *pdev) |
642 | { | 642 | { |
643 | if (!cpu_pmu) | ||
644 | return -ENODEV; | ||
645 | |||
643 | cpu_pmu->plat_device = pdev; | 646 | cpu_pmu->plat_device = pdev; |
644 | return 0; | 647 | return 0; |
645 | } | 648 | } |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 3448a3f9cc8c..8fc2c8fcbdc6 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -895,8 +895,6 @@ void __init setup_arch(char **cmdline_p) | |||
895 | { | 895 | { |
896 | struct machine_desc *mdesc; | 896 | struct machine_desc *mdesc; |
897 | 897 | ||
898 | unwind_init(); | ||
899 | |||
900 | setup_processor(); | 898 | setup_processor(); |
901 | mdesc = setup_machine_fdt(__atags_pointer); | 899 | mdesc = setup_machine_fdt(__atags_pointer); |
902 | if (!mdesc) | 900 | if (!mdesc) |
@@ -904,6 +902,12 @@ void __init setup_arch(char **cmdline_p) | |||
904 | machine_desc = mdesc; | 902 | machine_desc = mdesc; |
905 | machine_name = mdesc->name; | 903 | machine_name = mdesc->name; |
906 | 904 | ||
905 | #ifdef CONFIG_ZONE_DMA | ||
906 | if (mdesc->dma_zone_size) { | ||
907 | extern unsigned long arm_dma_zone_size; | ||
908 | arm_dma_zone_size = mdesc->dma_zone_size; | ||
909 | } | ||
910 | #endif | ||
907 | if (mdesc->soft_reboot) | 911 | if (mdesc->soft_reboot) |
908 | reboot_setup("s"); | 912 | reboot_setup("s"); |
909 | 913 | ||
@@ -934,12 +938,6 @@ void __init setup_arch(char **cmdline_p) | |||
934 | 938 | ||
935 | tcm_init(); | 939 | tcm_init(); |
936 | 940 | ||
937 | #ifdef CONFIG_ZONE_DMA | ||
938 | if (mdesc->dma_zone_size) { | ||
939 | extern unsigned long arm_dma_zone_size; | ||
940 | arm_dma_zone_size = mdesc->dma_zone_size; | ||
941 | } | ||
942 | #endif | ||
943 | #ifdef CONFIG_MULTI_IRQ_HANDLER | 941 | #ifdef CONFIG_MULTI_IRQ_HANDLER |
944 | handle_arch_irq = mdesc->handle_irq; | 942 | handle_arch_irq = mdesc->handle_irq; |
945 | #endif | 943 | #endif |
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index e7e8365795c3..00df012c4678 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c | |||
@@ -67,7 +67,7 @@ EXPORT_SYMBOL(__aeabi_unwind_cpp_pr2); | |||
67 | 67 | ||
68 | struct unwind_ctrl_block { | 68 | struct unwind_ctrl_block { |
69 | unsigned long vrs[16]; /* virtual register set */ | 69 | unsigned long vrs[16]; /* virtual register set */ |
70 | unsigned long *insn; /* pointer to the current instructions word */ | 70 | const unsigned long *insn; /* pointer to the current instructions word */ |
71 | int entries; /* number of entries left to interpret */ | 71 | int entries; /* number of entries left to interpret */ |
72 | int byte; /* current byte number in the instructions word */ | 72 | int byte; /* current byte number in the instructions word */ |
73 | }; | 73 | }; |
@@ -83,8 +83,9 @@ enum regs { | |||
83 | PC = 15 | 83 | PC = 15 |
84 | }; | 84 | }; |
85 | 85 | ||
86 | extern struct unwind_idx __start_unwind_idx[]; | 86 | extern const struct unwind_idx __start_unwind_idx[]; |
87 | extern struct unwind_idx __stop_unwind_idx[]; | 87 | static const struct unwind_idx *__origin_unwind_idx; |
88 | extern const struct unwind_idx __stop_unwind_idx[]; | ||
88 | 89 | ||
89 | static DEFINE_SPINLOCK(unwind_lock); | 90 | static DEFINE_SPINLOCK(unwind_lock); |
90 | static LIST_HEAD(unwind_tables); | 91 | static LIST_HEAD(unwind_tables); |
@@ -98,45 +99,99 @@ static LIST_HEAD(unwind_tables); | |||
98 | }) | 99 | }) |
99 | 100 | ||
100 | /* | 101 | /* |
101 | * Binary search in the unwind index. The entries entries are | 102 | * Binary search in the unwind index. The entries are |
102 | * guaranteed to be sorted in ascending order by the linker. | 103 | * guaranteed to be sorted in ascending order by the linker. |
104 | * | ||
105 | * start = first entry | ||
106 | * origin = first entry with positive offset (or stop if there is no such entry) | ||
107 | * stop - 1 = last entry | ||
103 | */ | 108 | */ |
104 | static struct unwind_idx *search_index(unsigned long addr, | 109 | static const struct unwind_idx *search_index(unsigned long addr, |
105 | struct unwind_idx *first, | 110 | const struct unwind_idx *start, |
106 | struct unwind_idx *last) | 111 | const struct unwind_idx *origin, |
112 | const struct unwind_idx *stop) | ||
107 | { | 113 | { |
108 | pr_debug("%s(%08lx, %p, %p)\n", __func__, addr, first, last); | 114 | unsigned long addr_prel31; |
115 | |||
116 | pr_debug("%s(%08lx, %p, %p, %p)\n", | ||
117 | __func__, addr, start, origin, stop); | ||
118 | |||
119 | /* | ||
120 | * only search in the section with the matching sign. This way the | ||
121 | * prel31 numbers can be compared as unsigned longs. | ||
122 | */ | ||
123 | if (addr < (unsigned long)start) | ||
124 | /* negative offsets: [start; origin) */ | ||
125 | stop = origin; | ||
126 | else | ||
127 | /* positive offsets: [origin; stop) */ | ||
128 | start = origin; | ||
129 | |||
130 | /* prel31 for address relavive to start */ | ||
131 | addr_prel31 = (addr - (unsigned long)start) & 0x7fffffff; | ||
109 | 132 | ||
110 | if (addr < first->addr) { | 133 | while (start < stop - 1) { |
134 | const struct unwind_idx *mid = start + ((stop - start) >> 1); | ||
135 | |||
136 | /* | ||
137 | * As addr_prel31 is relative to start an offset is needed to | ||
138 | * make it relative to mid. | ||
139 | */ | ||
140 | if (addr_prel31 - ((unsigned long)mid - (unsigned long)start) < | ||
141 | mid->addr_offset) | ||
142 | stop = mid; | ||
143 | else { | ||
144 | /* keep addr_prel31 relative to start */ | ||
145 | addr_prel31 -= ((unsigned long)mid - | ||
146 | (unsigned long)start); | ||
147 | start = mid; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | if (likely(start->addr_offset <= addr_prel31)) | ||
152 | return start; | ||
153 | else { | ||
111 | pr_warning("unwind: Unknown symbol address %08lx\n", addr); | 154 | pr_warning("unwind: Unknown symbol address %08lx\n", addr); |
112 | return NULL; | 155 | return NULL; |
113 | } else if (addr >= last->addr) | 156 | } |
114 | return last; | 157 | } |
115 | 158 | ||
116 | while (first < last - 1) { | 159 | static const struct unwind_idx *unwind_find_origin( |
117 | struct unwind_idx *mid = first + ((last - first + 1) >> 1); | 160 | const struct unwind_idx *start, const struct unwind_idx *stop) |
161 | { | ||
162 | pr_debug("%s(%p, %p)\n", __func__, start, stop); | ||
163 | while (start < stop) { | ||
164 | const struct unwind_idx *mid = start + ((stop - start) >> 1); | ||
118 | 165 | ||
119 | if (addr < mid->addr) | 166 | if (mid->addr_offset >= 0x40000000) |
120 | last = mid; | 167 | /* negative offset */ |
168 | start = mid + 1; | ||
121 | else | 169 | else |
122 | first = mid; | 170 | /* positive offset */ |
171 | stop = mid; | ||
123 | } | 172 | } |
124 | 173 | pr_debug("%s -> %p\n", __func__, stop); | |
125 | return first; | 174 | return stop; |
126 | } | 175 | } |
127 | 176 | ||
128 | static struct unwind_idx *unwind_find_idx(unsigned long addr) | 177 | static const struct unwind_idx *unwind_find_idx(unsigned long addr) |
129 | { | 178 | { |
130 | struct unwind_idx *idx = NULL; | 179 | const struct unwind_idx *idx = NULL; |
131 | unsigned long flags; | 180 | unsigned long flags; |
132 | 181 | ||
133 | pr_debug("%s(%08lx)\n", __func__, addr); | 182 | pr_debug("%s(%08lx)\n", __func__, addr); |
134 | 183 | ||
135 | if (core_kernel_text(addr)) | 184 | if (core_kernel_text(addr)) { |
185 | if (unlikely(!__origin_unwind_idx)) | ||
186 | __origin_unwind_idx = | ||
187 | unwind_find_origin(__start_unwind_idx, | ||
188 | __stop_unwind_idx); | ||
189 | |||
136 | /* main unwind table */ | 190 | /* main unwind table */ |
137 | idx = search_index(addr, __start_unwind_idx, | 191 | idx = search_index(addr, __start_unwind_idx, |
138 | __stop_unwind_idx - 1); | 192 | __origin_unwind_idx, |
139 | else { | 193 | __stop_unwind_idx); |
194 | } else { | ||
140 | /* module unwind tables */ | 195 | /* module unwind tables */ |
141 | struct unwind_table *table; | 196 | struct unwind_table *table; |
142 | 197 | ||
@@ -145,7 +200,8 @@ static struct unwind_idx *unwind_find_idx(unsigned long addr) | |||
145 | if (addr >= table->begin_addr && | 200 | if (addr >= table->begin_addr && |
146 | addr < table->end_addr) { | 201 | addr < table->end_addr) { |
147 | idx = search_index(addr, table->start, | 202 | idx = search_index(addr, table->start, |
148 | table->stop - 1); | 203 | table->origin, |
204 | table->stop); | ||
149 | /* Move-to-front to exploit common traces */ | 205 | /* Move-to-front to exploit common traces */ |
150 | list_move(&table->list, &unwind_tables); | 206 | list_move(&table->list, &unwind_tables); |
151 | break; | 207 | break; |
@@ -274,7 +330,7 @@ static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) | |||
274 | int unwind_frame(struct stackframe *frame) | 330 | int unwind_frame(struct stackframe *frame) |
275 | { | 331 | { |
276 | unsigned long high, low; | 332 | unsigned long high, low; |
277 | struct unwind_idx *idx; | 333 | const struct unwind_idx *idx; |
278 | struct unwind_ctrl_block ctrl; | 334 | struct unwind_ctrl_block ctrl; |
279 | 335 | ||
280 | /* only go to a higher address on the stack */ | 336 | /* only go to a higher address on the stack */ |
@@ -399,7 +455,6 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size, | |||
399 | unsigned long text_size) | 455 | unsigned long text_size) |
400 | { | 456 | { |
401 | unsigned long flags; | 457 | unsigned long flags; |
402 | struct unwind_idx *idx; | ||
403 | struct unwind_table *tab = kmalloc(sizeof(*tab), GFP_KERNEL); | 458 | struct unwind_table *tab = kmalloc(sizeof(*tab), GFP_KERNEL); |
404 | 459 | ||
405 | pr_debug("%s(%08lx, %08lx, %08lx, %08lx)\n", __func__, start, size, | 460 | pr_debug("%s(%08lx, %08lx, %08lx, %08lx)\n", __func__, start, size, |
@@ -408,15 +463,12 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size, | |||
408 | if (!tab) | 463 | if (!tab) |
409 | return tab; | 464 | return tab; |
410 | 465 | ||
411 | tab->start = (struct unwind_idx *)start; | 466 | tab->start = (const struct unwind_idx *)start; |
412 | tab->stop = (struct unwind_idx *)(start + size); | 467 | tab->stop = (const struct unwind_idx *)(start + size); |
468 | tab->origin = unwind_find_origin(tab->start, tab->stop); | ||
413 | tab->begin_addr = text_addr; | 469 | tab->begin_addr = text_addr; |
414 | tab->end_addr = text_addr + text_size; | 470 | tab->end_addr = text_addr + text_size; |
415 | 471 | ||
416 | /* Convert the symbol addresses to absolute values */ | ||
417 | for (idx = tab->start; idx < tab->stop; idx++) | ||
418 | idx->addr = prel31_to_addr(&idx->addr); | ||
419 | |||
420 | spin_lock_irqsave(&unwind_lock, flags); | 472 | spin_lock_irqsave(&unwind_lock, flags); |
421 | list_add_tail(&tab->list, &unwind_tables); | 473 | list_add_tail(&tab->list, &unwind_tables); |
422 | spin_unlock_irqrestore(&unwind_lock, flags); | 474 | spin_unlock_irqrestore(&unwind_lock, flags); |
@@ -437,16 +489,3 @@ void unwind_table_del(struct unwind_table *tab) | |||
437 | 489 | ||
438 | kfree(tab); | 490 | kfree(tab); |
439 | } | 491 | } |
440 | |||
441 | int __init unwind_init(void) | ||
442 | { | ||
443 | struct unwind_idx *idx; | ||
444 | |||
445 | /* Convert the symbol addresses to absolute values */ | ||
446 | for (idx = __start_unwind_idx; idx < __stop_unwind_idx; idx++) | ||
447 | idx->addr = prel31_to_addr(&idx->addr); | ||
448 | |||
449 | pr_debug("unwind: ARM stack unwinding initialised\n"); | ||
450 | |||
451 | return 0; | ||
452 | } | ||
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c index 97343df8f132..85b5527d0918 100644 --- a/arch/arm/mach-exynos/mct.c +++ b/arch/arm/mach-exynos/mct.c | |||
@@ -44,8 +44,6 @@ struct mct_clock_event_device { | |||
44 | char name[10]; | 44 | char name[10]; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static DEFINE_PER_CPU(struct mct_clock_event_device, percpu_mct_tick); | ||
48 | |||
49 | static void exynos4_mct_write(unsigned int value, void *addr) | 47 | static void exynos4_mct_write(unsigned int value, void *addr) |
50 | { | 48 | { |
51 | void __iomem *stat_addr; | 49 | void __iomem *stat_addr; |
@@ -264,6 +262,9 @@ static void exynos4_clockevent_init(void) | |||
264 | } | 262 | } |
265 | 263 | ||
266 | #ifdef CONFIG_LOCAL_TIMERS | 264 | #ifdef CONFIG_LOCAL_TIMERS |
265 | |||
266 | static DEFINE_PER_CPU(struct mct_clock_event_device, percpu_mct_tick); | ||
267 | |||
267 | /* Clock event handling */ | 268 | /* Clock event handling */ |
268 | static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) | 269 | static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) |
269 | { | 270 | { |
@@ -428,9 +429,13 @@ int __cpuinit local_timer_setup(struct clock_event_device *evt) | |||
428 | 429 | ||
429 | void local_timer_stop(struct clock_event_device *evt) | 430 | void local_timer_stop(struct clock_event_device *evt) |
430 | { | 431 | { |
432 | unsigned int cpu = smp_processor_id(); | ||
431 | evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); | 433 | evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); |
432 | if (mct_int_type == MCT_INT_SPI) | 434 | if (mct_int_type == MCT_INT_SPI) |
433 | disable_irq(evt->irq); | 435 | if (cpu == 0) |
436 | remove_irq(evt->irq, &mct_tick0_event_irq); | ||
437 | else | ||
438 | remove_irq(evt->irq, &mct_tick1_event_irq); | ||
434 | else | 439 | else |
435 | disable_percpu_irq(IRQ_MCT_LOCALTIMER); | 440 | disable_percpu_irq(IRQ_MCT_LOCALTIMER); |
436 | } | 441 | } |
@@ -443,6 +448,7 @@ static void __init exynos4_timer_resources(void) | |||
443 | 448 | ||
444 | clk_rate = clk_get_rate(mct_clk); | 449 | clk_rate = clk_get_rate(mct_clk); |
445 | 450 | ||
451 | #ifdef CONFIG_LOCAL_TIMERS | ||
446 | if (mct_int_type == MCT_INT_PPI) { | 452 | if (mct_int_type == MCT_INT_PPI) { |
447 | int err; | 453 | int err; |
448 | 454 | ||
@@ -452,6 +458,7 @@ static void __init exynos4_timer_resources(void) | |||
452 | WARN(err, "MCT: can't request IRQ %d (%d)\n", | 458 | WARN(err, "MCT: can't request IRQ %d (%d)\n", |
453 | IRQ_MCT_LOCALTIMER, err); | 459 | IRQ_MCT_LOCALTIMER, err); |
454 | } | 460 | } |
461 | #endif /* CONFIG_LOCAL_TIMERS */ | ||
455 | } | 462 | } |
456 | 463 | ||
457 | static void __init exynos4_timer_init(void) | 464 | static void __init exynos4_timer_init(void) |
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c index 5c837603ff0f..24994bb52147 100644 --- a/arch/arm/mach-mx5/board-mx51_babbage.c +++ b/arch/arm/mach-mx5/board-mx51_babbage.c | |||
@@ -362,7 +362,7 @@ static void __init mx51_babbage_init(void) | |||
362 | { | 362 | { |
363 | iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; | 363 | iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; |
364 | iomux_v3_cfg_t power_key = NEW_PAD_CTRL(MX51_PAD_EIM_A27__GPIO2_21, | 364 | iomux_v3_cfg_t power_key = NEW_PAD_CTRL(MX51_PAD_EIM_A27__GPIO2_21, |
365 | PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP); | 365 | PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH); |
366 | 366 | ||
367 | imx51_soc_init(); | 367 | imx51_soc_init(); |
368 | 368 | ||
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c index 6bea31ab8f85..64bbfcea6f35 100644 --- a/arch/arm/mach-mx5/board-mx53_evk.c +++ b/arch/arm/mach-mx5/board-mx53_evk.c | |||
@@ -106,7 +106,7 @@ static inline void mx53_evk_fec_reset(void) | |||
106 | gpio_set_value(MX53_EVK_FEC_PHY_RST, 1); | 106 | gpio_set_value(MX53_EVK_FEC_PHY_RST, 1); |
107 | } | 107 | } |
108 | 108 | ||
109 | static struct fec_platform_data mx53_evk_fec_pdata = { | 109 | static const struct fec_platform_data mx53_evk_fec_pdata __initconst = { |
110 | .phy = PHY_INTERFACE_MODE_RMII, | 110 | .phy = PHY_INTERFACE_MODE_RMII, |
111 | }; | 111 | }; |
112 | 112 | ||
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 7678f7734db6..237bdecd9331 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c | |||
@@ -242,7 +242,7 @@ static inline void mx53_loco_fec_reset(void) | |||
242 | gpio_set_value(LOCO_FEC_PHY_RST, 1); | 242 | gpio_set_value(LOCO_FEC_PHY_RST, 1); |
243 | } | 243 | } |
244 | 244 | ||
245 | static struct fec_platform_data mx53_loco_fec_data = { | 245 | static const struct fec_platform_data mx53_loco_fec_data __initconst = { |
246 | .phy = PHY_INTERFACE_MODE_RMII, | 246 | .phy = PHY_INTERFACE_MODE_RMII, |
247 | }; | 247 | }; |
248 | 248 | ||
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c index 59c0845eb4a6..d42132a80e8f 100644 --- a/arch/arm/mach-mx5/board-mx53_smd.c +++ b/arch/arm/mach-mx5/board-mx53_smd.c | |||
@@ -104,7 +104,7 @@ static inline void mx53_smd_fec_reset(void) | |||
104 | gpio_set_value(SMD_FEC_PHY_RST, 1); | 104 | gpio_set_value(SMD_FEC_PHY_RST, 1); |
105 | } | 105 | } |
106 | 106 | ||
107 | static struct fec_platform_data mx53_smd_fec_data = { | 107 | static const struct fec_platform_data mx53_smd_fec_data __initconst = { |
108 | .phy = PHY_INTERFACE_MODE_RMII, | 108 | .phy = PHY_INTERFACE_MODE_RMII, |
109 | }; | 109 | }; |
110 | 110 | ||
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index ba1aa07bdb29..c15c5c9c9085 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -193,7 +193,7 @@ static struct platform_device rx51_charger_device = { | |||
193 | static void __init rx51_charger_init(void) | 193 | static void __init rx51_charger_init(void) |
194 | { | 194 | { |
195 | WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO, | 195 | WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO, |
196 | GPIOF_OUT_INIT_LOW, "isp1704_reset")); | 196 | GPIOF_OUT_INIT_HIGH, "isp1704_reset")); |
197 | 197 | ||
198 | platform_device_register(&rx51_charger_device); | 198 | platform_device_register(&rx51_charger_device); |
199 | } | 199 | } |
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 292eee3be15f..28fcb27005d2 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -145,6 +145,9 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
145 | pdata->reg_size = 4; | 145 | pdata->reg_size = 4; |
146 | pdata->has_ccr = true; | 146 | pdata->has_ccr = true; |
147 | } | 147 | } |
148 | pdata->set_clk_src = omap2_mcbsp_set_clk_src; | ||
149 | if (id == 1) | ||
150 | pdata->mux_signal = omap2_mcbsp1_mux_rx_clk; | ||
148 | 151 | ||
149 | if (oh->class->rev == MCBSP_CONFIG_TYPE3) { | 152 | if (oh->class->rev == MCBSP_CONFIG_TYPE3) { |
150 | if (id == 2) | 153 | if (id == 2) |
@@ -174,9 +177,6 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
174 | name, oh->name); | 177 | name, oh->name); |
175 | return PTR_ERR(pdev); | 178 | return PTR_ERR(pdev); |
176 | } | 179 | } |
177 | pdata->set_clk_src = omap2_mcbsp_set_clk_src; | ||
178 | if (id == 1) | ||
179 | pdata->mux_signal = omap2_mcbsp1_mux_rx_clk; | ||
180 | omap_mcbsp_count++; | 180 | omap_mcbsp_count++; |
181 | return 0; | 181 | return 0; |
182 | } | 182 | } |
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index a9106c392398..8662ef6e5681 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
@@ -273,6 +273,7 @@ static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = { | |||
273 | 273 | ||
274 | static struct platform_pwm_backlight_data smdkv210_bl_data = { | 274 | static struct platform_pwm_backlight_data smdkv210_bl_data = { |
275 | .pwm_id = 3, | 275 | .pwm_id = 3, |
276 | .pwm_period_ns = 1000, | ||
276 | }; | 277 | }; |
277 | 278 | ||
278 | static void __init smdkv210_map_io(void) | 279 | static void __init smdkv210_map_io(void) |
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c index 74aac96cda20..adbff706ef6f 100644 --- a/arch/arm/plat-mxc/cpufreq.c +++ b/arch/arm/plat-mxc/cpufreq.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * the CPU clock speed on the fly. | 17 | * the CPU clock speed on the fly. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/module.h> | ||
20 | #include <linux/cpufreq.h> | 21 | #include <linux/cpufreq.h> |
21 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
22 | #include <linux/err.h> | 23 | #include <linux/err.h> |
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index 42d74ea59084..845de59f07ed 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c | |||
@@ -32,6 +32,9 @@ | |||
32 | #define MX3_PWMSAR 0x0C /* PWM Sample Register */ | 32 | #define MX3_PWMSAR 0x0C /* PWM Sample Register */ |
33 | #define MX3_PWMPR 0x10 /* PWM Period Register */ | 33 | #define MX3_PWMPR 0x10 /* PWM Period Register */ |
34 | #define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) | 34 | #define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) |
35 | #define MX3_PWMCR_DOZEEN (1 << 24) | ||
36 | #define MX3_PWMCR_WAITEN (1 << 23) | ||
37 | #define MX3_PWMCR_DBGEN (1 << 22) | ||
35 | #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16) | 38 | #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16) |
36 | #define MX3_PWMCR_CLKSRC_IPG (1 << 16) | 39 | #define MX3_PWMCR_CLKSRC_IPG (1 << 16) |
37 | #define MX3_PWMCR_EN (1 << 0) | 40 | #define MX3_PWMCR_EN (1 << 0) |
@@ -77,7 +80,9 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) | |||
77 | writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); | 80 | writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); |
78 | writel(period_cycles, pwm->mmio_base + MX3_PWMPR); | 81 | writel(period_cycles, pwm->mmio_base + MX3_PWMPR); |
79 | 82 | ||
80 | cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN; | 83 | cr = MX3_PWMCR_PRESCALER(prescale) | |
84 | MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN | | ||
85 | MX3_PWMCR_DBGEN | MX3_PWMCR_EN; | ||
81 | 86 | ||
82 | if (cpu_is_mx25()) | 87 | if (cpu_is_mx25()) |
83 | cr |= MX3_PWMCR_CLKSRC_IPG; | 88 | cr |= MX3_PWMCR_CLKSRC_IPG; |
diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/plat-samsung/dev-backlight.c index e657305644cc..a976c023b286 100644 --- a/arch/arm/plat-samsung/dev-backlight.c +++ b/arch/arm/plat-samsung/dev-backlight.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/pwm_backlight.h> | 17 | #include <linux/pwm_backlight.h> |
18 | #include <linux/slab.h> | ||
19 | 18 | ||
20 | #include <plat/devs.h> | 19 | #include <plat/devs.h> |
21 | #include <plat/gpio-cfg.h> | 20 | #include <plat/gpio-cfg.h> |
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index c9547033e38e..908b96957d88 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h | |||
@@ -53,13 +53,6 @@ | |||
53 | */ | 53 | */ |
54 | #define E820_RESERVED_KERN 128 | 54 | #define E820_RESERVED_KERN 128 |
55 | 55 | ||
56 | /* | ||
57 | * Address ranges that need to be mapped by the kernel direct | ||
58 | * mapping. This is used to make sure regions such as | ||
59 | * EFI_RUNTIME_SERVICES_DATA are directly mapped. See setup_arch(). | ||
60 | */ | ||
61 | #define E820_RESERVED_EFI 129 | ||
62 | |||
63 | #ifndef __ASSEMBLY__ | 56 | #ifndef __ASSEMBLY__ |
64 | #include <linux/types.h> | 57 | #include <linux/types.h> |
65 | struct e820entry { | 58 | struct e820entry { |
@@ -122,7 +115,6 @@ static inline void early_memtest(unsigned long start, unsigned long end) | |||
122 | } | 115 | } |
123 | #endif | 116 | #endif |
124 | 117 | ||
125 | extern unsigned long e820_end_pfn(unsigned long limit_pfn, unsigned type); | ||
126 | extern unsigned long e820_end_of_ram_pfn(void); | 118 | extern unsigned long e820_end_of_ram_pfn(void); |
127 | extern unsigned long e820_end_of_low_ram_pfn(void); | 119 | extern unsigned long e820_end_of_low_ram_pfn(void); |
128 | extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); | 120 | extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index b8d8bfcd44a9..7093e4a6a0bc 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -33,6 +33,8 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); | |||
33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ | 33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ |
34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) | 34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) |
35 | 35 | ||
36 | #define efi_ioremap(addr, size, type) ioremap_cache(addr, size) | ||
37 | |||
36 | #else /* !CONFIG_X86_32 */ | 38 | #else /* !CONFIG_X86_32 */ |
37 | 39 | ||
38 | extern u64 efi_call0(void *fp); | 40 | extern u64 efi_call0(void *fp); |
@@ -82,6 +84,9 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, | |||
82 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 84 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
83 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) | 85 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) |
84 | 86 | ||
87 | extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, | ||
88 | u32 type); | ||
89 | |||
85 | #endif /* CONFIG_X86_32 */ | 90 | #endif /* CONFIG_X86_32 */ |
86 | 91 | ||
87 | extern int add_efi_memmap; | 92 | extern int add_efi_memmap; |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 65ffd110a81b..303a0e48f076 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -135,7 +135,6 @@ static void __init e820_print_type(u32 type) | |||
135 | printk(KERN_CONT "(usable)"); | 135 | printk(KERN_CONT "(usable)"); |
136 | break; | 136 | break; |
137 | case E820_RESERVED: | 137 | case E820_RESERVED: |
138 | case E820_RESERVED_EFI: | ||
139 | printk(KERN_CONT "(reserved)"); | 138 | printk(KERN_CONT "(reserved)"); |
140 | break; | 139 | break; |
141 | case E820_ACPI: | 140 | case E820_ACPI: |
@@ -784,7 +783,7 @@ u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align) | |||
784 | /* | 783 | /* |
785 | * Find the highest page frame number we have available | 784 | * Find the highest page frame number we have available |
786 | */ | 785 | */ |
787 | unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) | 786 | static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) |
788 | { | 787 | { |
789 | int i; | 788 | int i; |
790 | unsigned long last_pfn = 0; | 789 | unsigned long last_pfn = 0; |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 9a9e40fb091c..cf0ef986cb6d 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -691,8 +691,6 @@ early_param("reservelow", parse_reservelow); | |||
691 | 691 | ||
692 | void __init setup_arch(char **cmdline_p) | 692 | void __init setup_arch(char **cmdline_p) |
693 | { | 693 | { |
694 | unsigned long end_pfn; | ||
695 | |||
696 | #ifdef CONFIG_X86_32 | 694 | #ifdef CONFIG_X86_32 |
697 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 695 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
698 | visws_early_detect(); | 696 | visws_early_detect(); |
@@ -934,24 +932,7 @@ void __init setup_arch(char **cmdline_p) | |||
934 | init_gbpages(); | 932 | init_gbpages(); |
935 | 933 | ||
936 | /* max_pfn_mapped is updated here */ | 934 | /* max_pfn_mapped is updated here */ |
937 | end_pfn = max_low_pfn; | 935 | max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT); |
938 | |||
939 | #ifdef CONFIG_X86_64 | ||
940 | /* | ||
941 | * There may be regions after the last E820_RAM region that we | ||
942 | * want to include in the kernel direct mapping, such as | ||
943 | * EFI_RUNTIME_SERVICES_DATA. | ||
944 | */ | ||
945 | if (efi_enabled) { | ||
946 | unsigned long efi_end; | ||
947 | |||
948 | efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI); | ||
949 | if (efi_end > max_low_pfn) | ||
950 | end_pfn = efi_end; | ||
951 | } | ||
952 | #endif | ||
953 | |||
954 | max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT); | ||
955 | max_pfn_mapped = max_low_pfn_mapped; | 936 | max_pfn_mapped = max_low_pfn_mapped; |
956 | 937 | ||
957 | #ifdef CONFIG_X86_64 | 938 | #ifdef CONFIG_X86_64 |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index c9718a16be15..37718f0f053d 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -323,13 +323,10 @@ static void __init do_add_efi_memmap(void) | |||
323 | case EFI_UNUSABLE_MEMORY: | 323 | case EFI_UNUSABLE_MEMORY: |
324 | e820_type = E820_UNUSABLE; | 324 | e820_type = E820_UNUSABLE; |
325 | break; | 325 | break; |
326 | case EFI_RUNTIME_SERVICES_DATA: | ||
327 | e820_type = E820_RESERVED_EFI; | ||
328 | break; | ||
329 | default: | 326 | default: |
330 | /* | 327 | /* |
331 | * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE | 328 | * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE |
332 | * EFI_MEMORY_MAPPED_IO | 329 | * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO |
333 | * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE | 330 | * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE |
334 | */ | 331 | */ |
335 | e820_type = E820_RESERVED; | 332 | e820_type = E820_RESERVED; |
@@ -674,21 +671,10 @@ void __init efi_enter_virtual_mode(void) | |||
674 | end_pfn = PFN_UP(end); | 671 | end_pfn = PFN_UP(end); |
675 | if (end_pfn <= max_low_pfn_mapped | 672 | if (end_pfn <= max_low_pfn_mapped |
676 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) | 673 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) |
677 | && end_pfn <= max_pfn_mapped)) { | 674 | && end_pfn <= max_pfn_mapped)) |
678 | va = __va(md->phys_addr); | 675 | va = __va(md->phys_addr); |
679 | 676 | else | |
680 | if (!(md->attribute & EFI_MEMORY_WB)) { | 677 | va = efi_ioremap(md->phys_addr, size, md->type); |
681 | addr = (u64) (unsigned long)va; | ||
682 | npages = md->num_pages; | ||
683 | memrange_efi_to_native(&addr, &npages); | ||
684 | set_memory_uc(addr, npages); | ||
685 | } | ||
686 | } else { | ||
687 | if (!(md->attribute & EFI_MEMORY_WB)) | ||
688 | va = ioremap_nocache(md->phys_addr, size); | ||
689 | else | ||
690 | va = ioremap_cache(md->phys_addr, size); | ||
691 | } | ||
692 | 678 | ||
693 | md->virt_addr = (u64) (unsigned long) va; | 679 | md->virt_addr = (u64) (unsigned long) va; |
694 | 680 | ||
@@ -698,6 +684,13 @@ void __init efi_enter_virtual_mode(void) | |||
698 | continue; | 684 | continue; |
699 | } | 685 | } |
700 | 686 | ||
687 | if (!(md->attribute & EFI_MEMORY_WB)) { | ||
688 | addr = md->virt_addr; | ||
689 | npages = md->num_pages; | ||
690 | memrange_efi_to_native(&addr, &npages); | ||
691 | set_memory_uc(addr, npages); | ||
692 | } | ||
693 | |||
701 | systab = (u64) (unsigned long) efi_phys.systab; | 694 | systab = (u64) (unsigned long) efi_phys.systab; |
702 | if (md->phys_addr <= systab && systab < end) { | 695 | if (md->phys_addr <= systab && systab < end) { |
703 | systab += md->virt_addr - md->phys_addr; | 696 | systab += md->virt_addr - md->phys_addr; |
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index e36bf714cb77..40e446941dd7 100644 --- a/arch/x86/platform/efi/efi_32.c +++ b/arch/x86/platform/efi/efi_32.c | |||
@@ -39,43 +39,14 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | static unsigned long efi_rt_eflags; | 41 | static unsigned long efi_rt_eflags; |
42 | static pgd_t efi_bak_pg_dir_pointer[2]; | ||
43 | 42 | ||
44 | void efi_call_phys_prelog(void) | 43 | void efi_call_phys_prelog(void) |
45 | { | 44 | { |
46 | unsigned long cr4; | ||
47 | unsigned long temp; | ||
48 | struct desc_ptr gdt_descr; | 45 | struct desc_ptr gdt_descr; |
49 | 46 | ||
50 | local_irq_save(efi_rt_eflags); | 47 | local_irq_save(efi_rt_eflags); |
51 | 48 | ||
52 | /* | 49 | load_cr3(initial_page_table); |
53 | * If I don't have PAE, I should just duplicate two entries in page | ||
54 | * directory. If I have PAE, I just need to duplicate one entry in | ||
55 | * page directory. | ||
56 | */ | ||
57 | cr4 = read_cr4_safe(); | ||
58 | |||
59 | if (cr4 & X86_CR4_PAE) { | ||
60 | efi_bak_pg_dir_pointer[0].pgd = | ||
61 | swapper_pg_dir[pgd_index(0)].pgd; | ||
62 | swapper_pg_dir[0].pgd = | ||
63 | swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd; | ||
64 | } else { | ||
65 | efi_bak_pg_dir_pointer[0].pgd = | ||
66 | swapper_pg_dir[pgd_index(0)].pgd; | ||
67 | efi_bak_pg_dir_pointer[1].pgd = | ||
68 | swapper_pg_dir[pgd_index(0x400000)].pgd; | ||
69 | swapper_pg_dir[pgd_index(0)].pgd = | ||
70 | swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd; | ||
71 | temp = PAGE_OFFSET + 0x400000; | ||
72 | swapper_pg_dir[pgd_index(0x400000)].pgd = | ||
73 | swapper_pg_dir[pgd_index(temp)].pgd; | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * After the lock is released, the original page table is restored. | ||
78 | */ | ||
79 | __flush_tlb_all(); | 50 | __flush_tlb_all(); |
80 | 51 | ||
81 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); | 52 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); |
@@ -85,28 +56,13 @@ void efi_call_phys_prelog(void) | |||
85 | 56 | ||
86 | void efi_call_phys_epilog(void) | 57 | void efi_call_phys_epilog(void) |
87 | { | 58 | { |
88 | unsigned long cr4; | ||
89 | struct desc_ptr gdt_descr; | 59 | struct desc_ptr gdt_descr; |
90 | 60 | ||
91 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); | 61 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); |
92 | gdt_descr.size = GDT_SIZE - 1; | 62 | gdt_descr.size = GDT_SIZE - 1; |
93 | load_gdt(&gdt_descr); | 63 | load_gdt(&gdt_descr); |
94 | 64 | ||
95 | cr4 = read_cr4_safe(); | 65 | load_cr3(swapper_pg_dir); |
96 | |||
97 | if (cr4 & X86_CR4_PAE) { | ||
98 | swapper_pg_dir[pgd_index(0)].pgd = | ||
99 | efi_bak_pg_dir_pointer[0].pgd; | ||
100 | } else { | ||
101 | swapper_pg_dir[pgd_index(0)].pgd = | ||
102 | efi_bak_pg_dir_pointer[0].pgd; | ||
103 | swapper_pg_dir[pgd_index(0x400000)].pgd = | ||
104 | efi_bak_pg_dir_pointer[1].pgd; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * After the lock is released, the original page table is restored. | ||
109 | */ | ||
110 | __flush_tlb_all(); | 66 | __flush_tlb_all(); |
111 | 67 | ||
112 | local_irq_restore(efi_rt_eflags); | 68 | local_irq_restore(efi_rt_eflags); |
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 312250c6b2de..ac3aa54e2654 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -80,3 +80,20 @@ void __init efi_call_phys_epilog(void) | |||
80 | local_irq_restore(efi_flags); | 80 | local_irq_restore(efi_flags); |
81 | early_code_mapping_set_exec(0); | 81 | early_code_mapping_set_exec(0); |
82 | } | 82 | } |
83 | |||
84 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, | ||
85 | u32 type) | ||
86 | { | ||
87 | unsigned long last_map_pfn; | ||
88 | |||
89 | if (type == EFI_MEMORY_MAPPED_IO) | ||
90 | return ioremap(phys_addr, size); | ||
91 | |||
92 | last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); | ||
93 | if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) { | ||
94 | unsigned long top = last_map_pfn << PAGE_SHIFT; | ||
95 | efi_ioremap(top, size - (top - phys_addr), type); | ||
96 | } | ||
97 | |||
98 | return (void __iomem *)__va(phys_addr); | ||
99 | } | ||
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 1093f80c162d..b2c7179fa263 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -173,9 +173,21 @@ static unsigned long __init xen_get_max_pages(void) | |||
173 | domid_t domid = DOMID_SELF; | 173 | domid_t domid = DOMID_SELF; |
174 | int ret; | 174 | int ret; |
175 | 175 | ||
176 | ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid); | 176 | /* |
177 | if (ret > 0) | 177 | * For the initial domain we use the maximum reservation as |
178 | max_pages = ret; | 178 | * the maximum page. |
179 | * | ||
180 | * For guest domains the current maximum reservation reflects | ||
181 | * the current maximum rather than the static maximum. In this | ||
182 | * case the e820 map provided to us will cover the static | ||
183 | * maximum region. | ||
184 | */ | ||
185 | if (xen_initial_domain()) { | ||
186 | ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid); | ||
187 | if (ret > 0) | ||
188 | max_pages = ret; | ||
189 | } | ||
190 | |||
179 | return min(max_pages, MAX_DOMAIN_PAGES); | 191 | return min(max_pages, MAX_DOMAIN_PAGES); |
180 | } | 192 | } |
181 | 193 | ||
diff --git a/block/blk-core.c b/block/blk-core.c index ea70e6c80cd3..15de223c7f93 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -366,7 +366,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all) | |||
366 | if (drain_all) | 366 | if (drain_all) |
367 | blk_throtl_drain(q); | 367 | blk_throtl_drain(q); |
368 | 368 | ||
369 | __blk_run_queue(q); | 369 | /* |
370 | * This function might be called on a queue which failed | ||
371 | * driver init after queue creation. Some drivers | ||
372 | * (e.g. fd) get unhappy in such cases. Kick queue iff | ||
373 | * dispatch queue has something on it. | ||
374 | */ | ||
375 | if (!list_empty(&q->queue_head)) | ||
376 | __blk_run_queue(q); | ||
370 | 377 | ||
371 | if (drain_all) | 378 | if (drain_all) |
372 | nr_rqs = q->rq.count[0] + q->rq.count[1]; | 379 | nr_rqs = q->rq.count[0] + q->rq.count[1]; |
@@ -467,6 +474,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) | |||
467 | q->backing_dev_info.state = 0; | 474 | q->backing_dev_info.state = 0; |
468 | q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; | 475 | q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; |
469 | q->backing_dev_info.name = "block"; | 476 | q->backing_dev_info.name = "block"; |
477 | q->node = node_id; | ||
470 | 478 | ||
471 | err = bdi_init(&q->backing_dev_info); | 479 | err = bdi_init(&q->backing_dev_info); |
472 | if (err) { | 480 | if (err) { |
@@ -551,7 +559,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
551 | if (!uninit_q) | 559 | if (!uninit_q) |
552 | return NULL; | 560 | return NULL; |
553 | 561 | ||
554 | q = blk_init_allocated_queue_node(uninit_q, rfn, lock, node_id); | 562 | q = blk_init_allocated_queue(uninit_q, rfn, lock); |
555 | if (!q) | 563 | if (!q) |
556 | blk_cleanup_queue(uninit_q); | 564 | blk_cleanup_queue(uninit_q); |
557 | 565 | ||
@@ -563,18 +571,9 @@ struct request_queue * | |||
563 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | 571 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, |
564 | spinlock_t *lock) | 572 | spinlock_t *lock) |
565 | { | 573 | { |
566 | return blk_init_allocated_queue_node(q, rfn, lock, -1); | ||
567 | } | ||
568 | EXPORT_SYMBOL(blk_init_allocated_queue); | ||
569 | |||
570 | struct request_queue * | ||
571 | blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | ||
572 | spinlock_t *lock, int node_id) | ||
573 | { | ||
574 | if (!q) | 574 | if (!q) |
575 | return NULL; | 575 | return NULL; |
576 | 576 | ||
577 | q->node = node_id; | ||
578 | if (blk_init_free_list(q)) | 577 | if (blk_init_free_list(q)) |
579 | return NULL; | 578 | return NULL; |
580 | 579 | ||
@@ -604,7 +603,7 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | |||
604 | 603 | ||
605 | return NULL; | 604 | return NULL; |
606 | } | 605 | } |
607 | EXPORT_SYMBOL(blk_init_allocated_queue_node); | 606 | EXPORT_SYMBOL(blk_init_allocated_queue); |
608 | 607 | ||
609 | int blk_get_queue(struct request_queue *q) | 608 | int blk_get_queue(struct request_queue *q) |
610 | { | 609 | { |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 16ace89613bc..4c12869fcf77 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -3184,7 +3184,7 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc, | |||
3184 | } | 3184 | } |
3185 | } | 3185 | } |
3186 | 3186 | ||
3187 | if (ret) | 3187 | if (ret && ret != -EEXIST) |
3188 | printk(KERN_ERR "cfq: cic link failed!\n"); | 3188 | printk(KERN_ERR "cfq: cic link failed!\n"); |
3189 | 3189 | ||
3190 | return ret; | 3190 | return ret; |
@@ -3200,6 +3200,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
3200 | { | 3200 | { |
3201 | struct io_context *ioc = NULL; | 3201 | struct io_context *ioc = NULL; |
3202 | struct cfq_io_context *cic; | 3202 | struct cfq_io_context *cic; |
3203 | int ret; | ||
3203 | 3204 | ||
3204 | might_sleep_if(gfp_mask & __GFP_WAIT); | 3205 | might_sleep_if(gfp_mask & __GFP_WAIT); |
3205 | 3206 | ||
@@ -3207,6 +3208,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
3207 | if (!ioc) | 3208 | if (!ioc) |
3208 | return NULL; | 3209 | return NULL; |
3209 | 3210 | ||
3211 | retry: | ||
3210 | cic = cfq_cic_lookup(cfqd, ioc); | 3212 | cic = cfq_cic_lookup(cfqd, ioc); |
3211 | if (cic) | 3213 | if (cic) |
3212 | goto out; | 3214 | goto out; |
@@ -3215,7 +3217,12 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
3215 | if (cic == NULL) | 3217 | if (cic == NULL) |
3216 | goto err; | 3218 | goto err; |
3217 | 3219 | ||
3218 | if (cfq_cic_link(cfqd, ioc, cic, gfp_mask)) | 3220 | ret = cfq_cic_link(cfqd, ioc, cic, gfp_mask); |
3221 | if (ret == -EEXIST) { | ||
3222 | /* someone has linked cic to ioc already */ | ||
3223 | cfq_cic_free(cic); | ||
3224 | goto retry; | ||
3225 | } else if (ret) | ||
3219 | goto err_free; | 3226 | goto err_free; |
3220 | 3227 | ||
3221 | out: | 3228 | out: |
@@ -4036,6 +4043,11 @@ static void *cfq_init_queue(struct request_queue *q) | |||
4036 | 4043 | ||
4037 | if (blkio_alloc_blkg_stats(&cfqg->blkg)) { | 4044 | if (blkio_alloc_blkg_stats(&cfqg->blkg)) { |
4038 | kfree(cfqg); | 4045 | kfree(cfqg); |
4046 | |||
4047 | spin_lock(&cic_index_lock); | ||
4048 | ida_remove(&cic_index_ida, cfqd->cic_index); | ||
4049 | spin_unlock(&cic_index_lock); | ||
4050 | |||
4039 | kfree(cfqd); | 4051 | kfree(cfqd); |
4040 | return NULL; | 4052 | return NULL; |
4041 | } | 4053 | } |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 8004ac30a7a8..587cce57adae 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2601,6 +2601,8 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, | |||
2601 | c->Request.Timeout = 0; | 2601 | c->Request.Timeout = 0; |
2602 | c->Request.CDB[0] = BMIC_WRITE; | 2602 | c->Request.CDB[0] = BMIC_WRITE; |
2603 | c->Request.CDB[6] = BMIC_CACHE_FLUSH; | 2603 | c->Request.CDB[6] = BMIC_CACHE_FLUSH; |
2604 | c->Request.CDB[7] = (size >> 8) & 0xFF; | ||
2605 | c->Request.CDB[8] = size & 0xFF; | ||
2604 | break; | 2606 | break; |
2605 | case TEST_UNIT_READY: | 2607 | case TEST_UNIT_READY: |
2606 | c->Request.CDBLen = 6; | 2608 | c->Request.CDBLen = 6; |
@@ -4880,7 +4882,7 @@ static int cciss_request_irq(ctlr_info_t *h, | |||
4880 | { | 4882 | { |
4881 | if (h->msix_vector || h->msi_vector) { | 4883 | if (h->msix_vector || h->msi_vector) { |
4882 | if (!request_irq(h->intr[h->intr_mode], msixhandler, | 4884 | if (!request_irq(h->intr[h->intr_mode], msixhandler, |
4883 | IRQF_DISABLED, h->devname, h)) | 4885 | 0, h->devname, h)) |
4884 | return 0; | 4886 | return 0; |
4885 | dev_err(&h->pdev->dev, "Unable to get msi irq %d" | 4887 | dev_err(&h->pdev->dev, "Unable to get msi irq %d" |
4886 | " for %s\n", h->intr[h->intr_mode], | 4888 | " for %s\n", h->intr[h->intr_mode], |
@@ -4889,7 +4891,7 @@ static int cciss_request_irq(ctlr_info_t *h, | |||
4889 | } | 4891 | } |
4890 | 4892 | ||
4891 | if (!request_irq(h->intr[h->intr_mode], intxhandler, | 4893 | if (!request_irq(h->intr[h->intr_mode], intxhandler, |
4892 | IRQF_DISABLED, h->devname, h)) | 4894 | IRQF_SHARED, h->devname, h)) |
4893 | return 0; | 4895 | return 0; |
4894 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | 4896 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", |
4895 | h->intr[h->intr_mode], h->devname); | 4897 | h->intr[h->intr_mode], h->devname); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 68b205a9338f..1e888c9e85b3 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -422,7 +422,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) | |||
422 | 422 | ||
423 | /* | 423 | /* |
424 | * We use punch hole to reclaim the free space used by the | 424 | * We use punch hole to reclaim the free space used by the |
425 | * image a.k.a. discard. However we do support discard if | 425 | * image a.k.a. discard. However we do not support discard if |
426 | * encryption is enabled, because it may give an attacker | 426 | * encryption is enabled, because it may give an attacker |
427 | * useful information. | 427 | * useful information. |
428 | */ | 428 | */ |
@@ -797,7 +797,7 @@ static void loop_config_discard(struct loop_device *lo) | |||
797 | } | 797 | } |
798 | 798 | ||
799 | q->limits.discard_granularity = inode->i_sb->s_blocksize; | 799 | q->limits.discard_granularity = inode->i_sb->s_blocksize; |
800 | q->limits.discard_alignment = inode->i_sb->s_blocksize; | 800 | q->limits.discard_alignment = 0; |
801 | q->limits.max_discard_sectors = UINT_MAX >> 9; | 801 | q->limits.max_discard_sectors = UINT_MAX >> 9; |
802 | q->limits.discard_zeroes_data = 1; | 802 | q->limits.discard_zeroes_data = 1; |
803 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | 803 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 65cc424359b0..148ab944378d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -183,10 +183,6 @@ static LIST_HEAD(rbd_client_list); /* clients */ | |||
183 | 183 | ||
184 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev); | 184 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev); |
185 | static void rbd_dev_release(struct device *dev); | 185 | static void rbd_dev_release(struct device *dev); |
186 | static ssize_t rbd_snap_rollback(struct device *dev, | ||
187 | struct device_attribute *attr, | ||
188 | const char *buf, | ||
189 | size_t size); | ||
190 | static ssize_t rbd_snap_add(struct device *dev, | 186 | static ssize_t rbd_snap_add(struct device *dev, |
191 | struct device_attribute *attr, | 187 | struct device_attribute *attr, |
192 | const char *buf, | 188 | const char *buf, |
@@ -461,6 +457,10 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
461 | u32 snap_count = le32_to_cpu(ondisk->snap_count); | 457 | u32 snap_count = le32_to_cpu(ondisk->snap_count); |
462 | int ret = -ENOMEM; | 458 | int ret = -ENOMEM; |
463 | 459 | ||
460 | if (memcmp(ondisk, RBD_HEADER_TEXT, sizeof(RBD_HEADER_TEXT))) { | ||
461 | return -ENXIO; | ||
462 | } | ||
463 | |||
464 | init_rwsem(&header->snap_rwsem); | 464 | init_rwsem(&header->snap_rwsem); |
465 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); | 465 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); |
466 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + | 466 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + |
@@ -1356,32 +1356,6 @@ fail: | |||
1356 | } | 1356 | } |
1357 | 1357 | ||
1358 | /* | 1358 | /* |
1359 | * Request sync osd rollback | ||
1360 | */ | ||
1361 | static int rbd_req_sync_rollback_obj(struct rbd_device *dev, | ||
1362 | u64 snapid, | ||
1363 | const char *obj) | ||
1364 | { | ||
1365 | struct ceph_osd_req_op *ops; | ||
1366 | int ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_ROLLBACK, 0); | ||
1367 | if (ret < 0) | ||
1368 | return ret; | ||
1369 | |||
1370 | ops[0].snap.snapid = snapid; | ||
1371 | |||
1372 | ret = rbd_req_sync_op(dev, NULL, | ||
1373 | CEPH_NOSNAP, | ||
1374 | 0, | ||
1375 | CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, | ||
1376 | ops, | ||
1377 | 1, obj, 0, 0, NULL, NULL, NULL); | ||
1378 | |||
1379 | rbd_destroy_ops(ops); | ||
1380 | |||
1381 | return ret; | ||
1382 | } | ||
1383 | |||
1384 | /* | ||
1385 | * Request sync osd read | 1359 | * Request sync osd read |
1386 | */ | 1360 | */ |
1387 | static int rbd_req_sync_exec(struct rbd_device *dev, | 1361 | static int rbd_req_sync_exec(struct rbd_device *dev, |
@@ -1610,8 +1584,13 @@ static int rbd_read_header(struct rbd_device *rbd_dev, | |||
1610 | goto out_dh; | 1584 | goto out_dh; |
1611 | 1585 | ||
1612 | rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL); | 1586 | rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL); |
1613 | if (rc < 0) | 1587 | if (rc < 0) { |
1588 | if (rc == -ENXIO) { | ||
1589 | pr_warning("unrecognized header format" | ||
1590 | " for image %s", rbd_dev->obj); | ||
1591 | } | ||
1614 | goto out_dh; | 1592 | goto out_dh; |
1593 | } | ||
1615 | 1594 | ||
1616 | if (snap_count != header->total_snaps) { | 1595 | if (snap_count != header->total_snaps) { |
1617 | snap_count = header->total_snaps; | 1596 | snap_count = header->total_snaps; |
@@ -1882,7 +1861,6 @@ static DEVICE_ATTR(name, S_IRUGO, rbd_name_show, NULL); | |||
1882 | static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); | 1861 | static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); |
1883 | static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); | 1862 | static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); |
1884 | static DEVICE_ATTR(create_snap, S_IWUSR, NULL, rbd_snap_add); | 1863 | static DEVICE_ATTR(create_snap, S_IWUSR, NULL, rbd_snap_add); |
1885 | static DEVICE_ATTR(rollback_snap, S_IWUSR, NULL, rbd_snap_rollback); | ||
1886 | 1864 | ||
1887 | static struct attribute *rbd_attrs[] = { | 1865 | static struct attribute *rbd_attrs[] = { |
1888 | &dev_attr_size.attr, | 1866 | &dev_attr_size.attr, |
@@ -1893,7 +1871,6 @@ static struct attribute *rbd_attrs[] = { | |||
1893 | &dev_attr_current_snap.attr, | 1871 | &dev_attr_current_snap.attr, |
1894 | &dev_attr_refresh.attr, | 1872 | &dev_attr_refresh.attr, |
1895 | &dev_attr_create_snap.attr, | 1873 | &dev_attr_create_snap.attr, |
1896 | &dev_attr_rollback_snap.attr, | ||
1897 | NULL | 1874 | NULL |
1898 | }; | 1875 | }; |
1899 | 1876 | ||
@@ -2424,64 +2401,6 @@ err_unlock: | |||
2424 | return ret; | 2401 | return ret; |
2425 | } | 2402 | } |
2426 | 2403 | ||
2427 | static ssize_t rbd_snap_rollback(struct device *dev, | ||
2428 | struct device_attribute *attr, | ||
2429 | const char *buf, | ||
2430 | size_t count) | ||
2431 | { | ||
2432 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
2433 | int ret; | ||
2434 | u64 snapid; | ||
2435 | u64 cur_ofs; | ||
2436 | char *seg_name = NULL; | ||
2437 | char *snap_name = kmalloc(count + 1, GFP_KERNEL); | ||
2438 | ret = -ENOMEM; | ||
2439 | if (!snap_name) | ||
2440 | return ret; | ||
2441 | |||
2442 | /* parse snaps add command */ | ||
2443 | snprintf(snap_name, count, "%s", buf); | ||
2444 | seg_name = kmalloc(RBD_MAX_SEG_NAME_LEN + 1, GFP_NOIO); | ||
2445 | if (!seg_name) | ||
2446 | goto done; | ||
2447 | |||
2448 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
2449 | |||
2450 | ret = snap_by_name(&rbd_dev->header, snap_name, &snapid, NULL); | ||
2451 | if (ret < 0) | ||
2452 | goto done_unlock; | ||
2453 | |||
2454 | dout("snapid=%lld\n", snapid); | ||
2455 | |||
2456 | cur_ofs = 0; | ||
2457 | while (cur_ofs < rbd_dev->header.image_size) { | ||
2458 | cur_ofs += rbd_get_segment(&rbd_dev->header, | ||
2459 | rbd_dev->obj, | ||
2460 | cur_ofs, (u64)-1, | ||
2461 | seg_name, NULL); | ||
2462 | dout("seg_name=%s\n", seg_name); | ||
2463 | |||
2464 | ret = rbd_req_sync_rollback_obj(rbd_dev, snapid, seg_name); | ||
2465 | if (ret < 0) | ||
2466 | pr_warning("could not roll back obj %s err=%d\n", | ||
2467 | seg_name, ret); | ||
2468 | } | ||
2469 | |||
2470 | ret = __rbd_update_snaps(rbd_dev); | ||
2471 | if (ret < 0) | ||
2472 | goto done_unlock; | ||
2473 | |||
2474 | ret = count; | ||
2475 | |||
2476 | done_unlock: | ||
2477 | mutex_unlock(&ctl_mutex); | ||
2478 | done: | ||
2479 | kfree(seg_name); | ||
2480 | kfree(snap_name); | ||
2481 | |||
2482 | return ret; | ||
2483 | } | ||
2484 | |||
2485 | static struct bus_attribute rbd_bus_attrs[] = { | 2404 | static struct bus_attribute rbd_bus_attrs[] = { |
2486 | __ATTR(add, S_IWUSR, NULL, rbd_add), | 2405 | __ATTR(add, S_IWUSR, NULL, rbd_add), |
2487 | __ATTR(remove, S_IWUSR, NULL, rbd_remove), | 2406 | __ATTR(remove, S_IWUSR, NULL, rbd_remove), |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index ae3e167e17ad..89ddab127e33 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * handle GCR disks | 16 | * handle GCR disks |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #undef DEBUG | ||
20 | |||
19 | #include <linux/stddef.h> | 21 | #include <linux/stddef.h> |
20 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
21 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
@@ -36,13 +38,11 @@ | |||
36 | #include <asm/machdep.h> | 38 | #include <asm/machdep.h> |
37 | #include <asm/pmac_feature.h> | 39 | #include <asm/pmac_feature.h> |
38 | 40 | ||
39 | static DEFINE_MUTEX(swim3_mutex); | ||
40 | static struct request_queue *swim3_queue; | ||
41 | static struct gendisk *disks[2]; | ||
42 | static struct request *fd_req; | ||
43 | |||
44 | #define MAX_FLOPPIES 2 | 41 | #define MAX_FLOPPIES 2 |
45 | 42 | ||
43 | static DEFINE_MUTEX(swim3_mutex); | ||
44 | static struct gendisk *disks[MAX_FLOPPIES]; | ||
45 | |||
46 | enum swim_state { | 46 | enum swim_state { |
47 | idle, | 47 | idle, |
48 | locating, | 48 | locating, |
@@ -177,7 +177,6 @@ struct swim3 { | |||
177 | 177 | ||
178 | struct floppy_state { | 178 | struct floppy_state { |
179 | enum swim_state state; | 179 | enum swim_state state; |
180 | spinlock_t lock; | ||
181 | struct swim3 __iomem *swim3; /* hardware registers */ | 180 | struct swim3 __iomem *swim3; /* hardware registers */ |
182 | struct dbdma_regs __iomem *dma; /* DMA controller registers */ | 181 | struct dbdma_regs __iomem *dma; /* DMA controller registers */ |
183 | int swim3_intr; /* interrupt number for SWIM3 */ | 182 | int swim3_intr; /* interrupt number for SWIM3 */ |
@@ -204,8 +203,20 @@ struct floppy_state { | |||
204 | int wanted; | 203 | int wanted; |
205 | struct macio_dev *mdev; | 204 | struct macio_dev *mdev; |
206 | char dbdma_cmd_space[5 * sizeof(struct dbdma_cmd)]; | 205 | char dbdma_cmd_space[5 * sizeof(struct dbdma_cmd)]; |
206 | int index; | ||
207 | struct request *cur_req; | ||
207 | }; | 208 | }; |
208 | 209 | ||
210 | #define swim3_err(fmt, arg...) dev_err(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
211 | #define swim3_warn(fmt, arg...) dev_warn(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
212 | #define swim3_info(fmt, arg...) dev_info(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
213 | |||
214 | #ifdef DEBUG | ||
215 | #define swim3_dbg(fmt, arg...) dev_dbg(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
216 | #else | ||
217 | #define swim3_dbg(fmt, arg...) do { } while(0) | ||
218 | #endif | ||
219 | |||
209 | static struct floppy_state floppy_states[MAX_FLOPPIES]; | 220 | static struct floppy_state floppy_states[MAX_FLOPPIES]; |
210 | static int floppy_count = 0; | 221 | static int floppy_count = 0; |
211 | static DEFINE_SPINLOCK(swim3_lock); | 222 | static DEFINE_SPINLOCK(swim3_lock); |
@@ -224,17 +235,8 @@ static unsigned short write_postamble[] = { | |||
224 | 0, 0, 0, 0, 0, 0 | 235 | 0, 0, 0, 0, 0, 0 |
225 | }; | 236 | }; |
226 | 237 | ||
227 | static void swim3_select(struct floppy_state *fs, int sel); | ||
228 | static void swim3_action(struct floppy_state *fs, int action); | ||
229 | static int swim3_readbit(struct floppy_state *fs, int bit); | ||
230 | static void do_fd_request(struct request_queue * q); | ||
231 | static void start_request(struct floppy_state *fs); | ||
232 | static void set_timeout(struct floppy_state *fs, int nticks, | ||
233 | void (*proc)(unsigned long)); | ||
234 | static void scan_track(struct floppy_state *fs); | ||
235 | static void seek_track(struct floppy_state *fs, int n); | 238 | static void seek_track(struct floppy_state *fs, int n); |
236 | static void init_dma(struct dbdma_cmd *cp, int cmd, void *buf, int count); | 239 | static void init_dma(struct dbdma_cmd *cp, int cmd, void *buf, int count); |
237 | static void setup_transfer(struct floppy_state *fs); | ||
238 | static void act(struct floppy_state *fs); | 240 | static void act(struct floppy_state *fs); |
239 | static void scan_timeout(unsigned long data); | 241 | static void scan_timeout(unsigned long data); |
240 | static void seek_timeout(unsigned long data); | 242 | static void seek_timeout(unsigned long data); |
@@ -254,18 +256,21 @@ static unsigned int floppy_check_events(struct gendisk *disk, | |||
254 | unsigned int clearing); | 256 | unsigned int clearing); |
255 | static int floppy_revalidate(struct gendisk *disk); | 257 | static int floppy_revalidate(struct gendisk *disk); |
256 | 258 | ||
257 | static bool swim3_end_request(int err, unsigned int nr_bytes) | 259 | static bool swim3_end_request(struct floppy_state *fs, int err, unsigned int nr_bytes) |
258 | { | 260 | { |
259 | if (__blk_end_request(fd_req, err, nr_bytes)) | 261 | struct request *req = fs->cur_req; |
260 | return true; | 262 | int rc; |
261 | 263 | ||
262 | fd_req = NULL; | 264 | swim3_dbg(" end request, err=%d nr_bytes=%d, cur_req=%p\n", |
263 | return false; | 265 | err, nr_bytes, req); |
264 | } | ||
265 | 266 | ||
266 | static bool swim3_end_request_cur(int err) | 267 | if (err) |
267 | { | 268 | nr_bytes = blk_rq_cur_bytes(req); |
268 | return swim3_end_request(err, blk_rq_cur_bytes(fd_req)); | 269 | rc = __blk_end_request(req, err, nr_bytes); |
270 | if (rc) | ||
271 | return true; | ||
272 | fs->cur_req = NULL; | ||
273 | return false; | ||
269 | } | 274 | } |
270 | 275 | ||
271 | static void swim3_select(struct floppy_state *fs, int sel) | 276 | static void swim3_select(struct floppy_state *fs, int sel) |
@@ -303,50 +308,53 @@ static int swim3_readbit(struct floppy_state *fs, int bit) | |||
303 | return (stat & DATA) == 0; | 308 | return (stat & DATA) == 0; |
304 | } | 309 | } |
305 | 310 | ||
306 | static void do_fd_request(struct request_queue * q) | ||
307 | { | ||
308 | int i; | ||
309 | |||
310 | for(i=0; i<floppy_count; i++) { | ||
311 | struct floppy_state *fs = &floppy_states[i]; | ||
312 | if (fs->mdev->media_bay && | ||
313 | check_media_bay(fs->mdev->media_bay) != MB_FD) | ||
314 | continue; | ||
315 | start_request(fs); | ||
316 | } | ||
317 | } | ||
318 | |||
319 | static void start_request(struct floppy_state *fs) | 311 | static void start_request(struct floppy_state *fs) |
320 | { | 312 | { |
321 | struct request *req; | 313 | struct request *req; |
322 | unsigned long x; | 314 | unsigned long x; |
323 | 315 | ||
316 | swim3_dbg("start request, initial state=%d\n", fs->state); | ||
317 | |||
324 | if (fs->state == idle && fs->wanted) { | 318 | if (fs->state == idle && fs->wanted) { |
325 | fs->state = available; | 319 | fs->state = available; |
326 | wake_up(&fs->wait); | 320 | wake_up(&fs->wait); |
327 | return; | 321 | return; |
328 | } | 322 | } |
329 | while (fs->state == idle) { | 323 | while (fs->state == idle) { |
330 | if (!fd_req) { | 324 | swim3_dbg("start request, idle loop, cur_req=%p\n", fs->cur_req); |
331 | fd_req = blk_fetch_request(swim3_queue); | 325 | if (!fs->cur_req) { |
332 | if (!fd_req) | 326 | fs->cur_req = blk_fetch_request(disks[fs->index]->queue); |
327 | swim3_dbg(" fetched request %p\n", fs->cur_req); | ||
328 | if (!fs->cur_req) | ||
333 | break; | 329 | break; |
334 | } | 330 | } |
335 | req = fd_req; | 331 | req = fs->cur_req; |
336 | #if 0 | 332 | |
337 | printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n", | 333 | if (fs->mdev->media_bay && |
338 | req->rq_disk->disk_name, req->cmd, | 334 | check_media_bay(fs->mdev->media_bay) != MB_FD) { |
339 | (long)blk_rq_pos(req), blk_rq_sectors(req), req->buffer); | 335 | swim3_dbg("%s", " media bay absent, dropping req\n"); |
340 | printk(" errors=%d current_nr_sectors=%u\n", | 336 | swim3_end_request(fs, -ENODEV, 0); |
341 | req->errors, blk_rq_cur_sectors(req)); | 337 | continue; |
338 | } | ||
339 | |||
340 | #if 0 /* This is really too verbose */ | ||
341 | swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n", | ||
342 | req->rq_disk->disk_name, req->cmd, | ||
343 | (long)blk_rq_pos(req), blk_rq_sectors(req), | ||
344 | req->buffer); | ||
345 | swim3_dbg(" errors=%d current_nr_sectors=%u\n", | ||
346 | req->errors, blk_rq_cur_sectors(req)); | ||
342 | #endif | 347 | #endif |
343 | 348 | ||
344 | if (blk_rq_pos(req) >= fs->total_secs) { | 349 | if (blk_rq_pos(req) >= fs->total_secs) { |
345 | swim3_end_request_cur(-EIO); | 350 | swim3_dbg(" pos out of bounds (%ld, max is %ld)\n", |
351 | (long)blk_rq_pos(req), (long)fs->total_secs); | ||
352 | swim3_end_request(fs, -EIO, 0); | ||
346 | continue; | 353 | continue; |
347 | } | 354 | } |
348 | if (fs->ejected) { | 355 | if (fs->ejected) { |
349 | swim3_end_request_cur(-EIO); | 356 | swim3_dbg("%s", " disk ejected\n"); |
357 | swim3_end_request(fs, -EIO, 0); | ||
350 | continue; | 358 | continue; |
351 | } | 359 | } |
352 | 360 | ||
@@ -354,7 +362,8 @@ static void start_request(struct floppy_state *fs) | |||
354 | if (fs->write_prot < 0) | 362 | if (fs->write_prot < 0) |
355 | fs->write_prot = swim3_readbit(fs, WRITE_PROT); | 363 | fs->write_prot = swim3_readbit(fs, WRITE_PROT); |
356 | if (fs->write_prot) { | 364 | if (fs->write_prot) { |
357 | swim3_end_request_cur(-EIO); | 365 | swim3_dbg("%s", " try to write, disk write protected\n"); |
366 | swim3_end_request(fs, -EIO, 0); | ||
358 | continue; | 367 | continue; |
359 | } | 368 | } |
360 | } | 369 | } |
@@ -369,7 +378,6 @@ static void start_request(struct floppy_state *fs) | |||
369 | x = ((long)blk_rq_pos(req)) % fs->secpercyl; | 378 | x = ((long)blk_rq_pos(req)) % fs->secpercyl; |
370 | fs->head = x / fs->secpertrack; | 379 | fs->head = x / fs->secpertrack; |
371 | fs->req_sector = x % fs->secpertrack + 1; | 380 | fs->req_sector = x % fs->secpertrack + 1; |
372 | fd_req = req; | ||
373 | fs->state = do_transfer; | 381 | fs->state = do_transfer; |
374 | fs->retries = 0; | 382 | fs->retries = 0; |
375 | 383 | ||
@@ -377,12 +385,14 @@ static void start_request(struct floppy_state *fs) | |||
377 | } | 385 | } |
378 | } | 386 | } |
379 | 387 | ||
388 | static void do_fd_request(struct request_queue * q) | ||
389 | { | ||
390 | start_request(q->queuedata); | ||
391 | } | ||
392 | |||
380 | static void set_timeout(struct floppy_state *fs, int nticks, | 393 | static void set_timeout(struct floppy_state *fs, int nticks, |
381 | void (*proc)(unsigned long)) | 394 | void (*proc)(unsigned long)) |
382 | { | 395 | { |
383 | unsigned long flags; | ||
384 | |||
385 | spin_lock_irqsave(&fs->lock, flags); | ||
386 | if (fs->timeout_pending) | 396 | if (fs->timeout_pending) |
387 | del_timer(&fs->timeout); | 397 | del_timer(&fs->timeout); |
388 | fs->timeout.expires = jiffies + nticks; | 398 | fs->timeout.expires = jiffies + nticks; |
@@ -390,7 +400,6 @@ static void set_timeout(struct floppy_state *fs, int nticks, | |||
390 | fs->timeout.data = (unsigned long) fs; | 400 | fs->timeout.data = (unsigned long) fs; |
391 | add_timer(&fs->timeout); | 401 | add_timer(&fs->timeout); |
392 | fs->timeout_pending = 1; | 402 | fs->timeout_pending = 1; |
393 | spin_unlock_irqrestore(&fs->lock, flags); | ||
394 | } | 403 | } |
395 | 404 | ||
396 | static inline void scan_track(struct floppy_state *fs) | 405 | static inline void scan_track(struct floppy_state *fs) |
@@ -442,40 +451,45 @@ static inline void setup_transfer(struct floppy_state *fs) | |||
442 | struct swim3 __iomem *sw = fs->swim3; | 451 | struct swim3 __iomem *sw = fs->swim3; |
443 | struct dbdma_cmd *cp = fs->dma_cmd; | 452 | struct dbdma_cmd *cp = fs->dma_cmd; |
444 | struct dbdma_regs __iomem *dr = fs->dma; | 453 | struct dbdma_regs __iomem *dr = fs->dma; |
454 | struct request *req = fs->cur_req; | ||
445 | 455 | ||
446 | if (blk_rq_cur_sectors(fd_req) <= 0) { | 456 | if (blk_rq_cur_sectors(req) <= 0) { |
447 | printk(KERN_ERR "swim3: transfer 0 sectors?\n"); | 457 | swim3_warn("%s", "Transfer 0 sectors ?\n"); |
448 | return; | 458 | return; |
449 | } | 459 | } |
450 | if (rq_data_dir(fd_req) == WRITE) | 460 | if (rq_data_dir(req) == WRITE) |
451 | n = 1; | 461 | n = 1; |
452 | else { | 462 | else { |
453 | n = fs->secpertrack - fs->req_sector + 1; | 463 | n = fs->secpertrack - fs->req_sector + 1; |
454 | if (n > blk_rq_cur_sectors(fd_req)) | 464 | if (n > blk_rq_cur_sectors(req)) |
455 | n = blk_rq_cur_sectors(fd_req); | 465 | n = blk_rq_cur_sectors(req); |
456 | } | 466 | } |
467 | |||
468 | swim3_dbg(" setup xfer at sect %d (of %d) head %d for %d\n", | ||
469 | fs->req_sector, fs->secpertrack, fs->head, n); | ||
470 | |||
457 | fs->scount = n; | 471 | fs->scount = n; |
458 | swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0); | 472 | swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0); |
459 | out_8(&sw->sector, fs->req_sector); | 473 | out_8(&sw->sector, fs->req_sector); |
460 | out_8(&sw->nsect, n); | 474 | out_8(&sw->nsect, n); |
461 | out_8(&sw->gap3, 0); | 475 | out_8(&sw->gap3, 0); |
462 | out_le32(&dr->cmdptr, virt_to_bus(cp)); | 476 | out_le32(&dr->cmdptr, virt_to_bus(cp)); |
463 | if (rq_data_dir(fd_req) == WRITE) { | 477 | if (rq_data_dir(req) == WRITE) { |
464 | /* Set up 3 dma commands: write preamble, data, postamble */ | 478 | /* Set up 3 dma commands: write preamble, data, postamble */ |
465 | init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble)); | 479 | init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble)); |
466 | ++cp; | 480 | ++cp; |
467 | init_dma(cp, OUTPUT_MORE, fd_req->buffer, 512); | 481 | init_dma(cp, OUTPUT_MORE, req->buffer, 512); |
468 | ++cp; | 482 | ++cp; |
469 | init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble)); | 483 | init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble)); |
470 | } else { | 484 | } else { |
471 | init_dma(cp, INPUT_LAST, fd_req->buffer, n * 512); | 485 | init_dma(cp, INPUT_LAST, req->buffer, n * 512); |
472 | } | 486 | } |
473 | ++cp; | 487 | ++cp; |
474 | out_le16(&cp->command, DBDMA_STOP); | 488 | out_le16(&cp->command, DBDMA_STOP); |
475 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); | 489 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); |
476 | in_8(&sw->error); | 490 | in_8(&sw->error); |
477 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); | 491 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); |
478 | if (rq_data_dir(fd_req) == WRITE) | 492 | if (rq_data_dir(req) == WRITE) |
479 | out_8(&sw->control_bis, WRITE_SECTORS); | 493 | out_8(&sw->control_bis, WRITE_SECTORS); |
480 | in_8(&sw->intr); | 494 | in_8(&sw->intr); |
481 | out_le32(&dr->control, (RUN << 16) | RUN); | 495 | out_le32(&dr->control, (RUN << 16) | RUN); |
@@ -488,12 +502,16 @@ static inline void setup_transfer(struct floppy_state *fs) | |||
488 | static void act(struct floppy_state *fs) | 502 | static void act(struct floppy_state *fs) |
489 | { | 503 | { |
490 | for (;;) { | 504 | for (;;) { |
505 | swim3_dbg(" act loop, state=%d, req_cyl=%d, cur_cyl=%d\n", | ||
506 | fs->state, fs->req_cyl, fs->cur_cyl); | ||
507 | |||
491 | switch (fs->state) { | 508 | switch (fs->state) { |
492 | case idle: | 509 | case idle: |
493 | return; /* XXX shouldn't get here */ | 510 | return; /* XXX shouldn't get here */ |
494 | 511 | ||
495 | case locating: | 512 | case locating: |
496 | if (swim3_readbit(fs, TRACK_ZERO)) { | 513 | if (swim3_readbit(fs, TRACK_ZERO)) { |
514 | swim3_dbg("%s", " locate track 0\n"); | ||
497 | fs->cur_cyl = 0; | 515 | fs->cur_cyl = 0; |
498 | if (fs->req_cyl == 0) | 516 | if (fs->req_cyl == 0) |
499 | fs->state = do_transfer; | 517 | fs->state = do_transfer; |
@@ -511,7 +529,7 @@ static void act(struct floppy_state *fs) | |||
511 | break; | 529 | break; |
512 | } | 530 | } |
513 | if (fs->req_cyl == fs->cur_cyl) { | 531 | if (fs->req_cyl == fs->cur_cyl) { |
514 | printk("whoops, seeking 0\n"); | 532 | swim3_warn("%s", "Whoops, seeking 0\n"); |
515 | fs->state = do_transfer; | 533 | fs->state = do_transfer; |
516 | break; | 534 | break; |
517 | } | 535 | } |
@@ -527,7 +545,9 @@ static void act(struct floppy_state *fs) | |||
527 | case do_transfer: | 545 | case do_transfer: |
528 | if (fs->cur_cyl != fs->req_cyl) { | 546 | if (fs->cur_cyl != fs->req_cyl) { |
529 | if (fs->retries > 5) { | 547 | if (fs->retries > 5) { |
530 | swim3_end_request_cur(-EIO); | 548 | swim3_err("Wrong cylinder in transfer, want: %d got %d\n", |
549 | fs->req_cyl, fs->cur_cyl); | ||
550 | swim3_end_request(fs, -EIO, 0); | ||
531 | fs->state = idle; | 551 | fs->state = idle; |
532 | return; | 552 | return; |
533 | } | 553 | } |
@@ -542,7 +562,7 @@ static void act(struct floppy_state *fs) | |||
542 | return; | 562 | return; |
543 | 563 | ||
544 | default: | 564 | default: |
545 | printk(KERN_ERR"swim3: unknown state %d\n", fs->state); | 565 | swim3_err("Unknown state %d\n", fs->state); |
546 | return; | 566 | return; |
547 | } | 567 | } |
548 | } | 568 | } |
@@ -552,59 +572,75 @@ static void scan_timeout(unsigned long data) | |||
552 | { | 572 | { |
553 | struct floppy_state *fs = (struct floppy_state *) data; | 573 | struct floppy_state *fs = (struct floppy_state *) data; |
554 | struct swim3 __iomem *sw = fs->swim3; | 574 | struct swim3 __iomem *sw = fs->swim3; |
575 | unsigned long flags; | ||
576 | |||
577 | swim3_dbg("* scan timeout, state=%d\n", fs->state); | ||
555 | 578 | ||
579 | spin_lock_irqsave(&swim3_lock, flags); | ||
556 | fs->timeout_pending = 0; | 580 | fs->timeout_pending = 0; |
557 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); | 581 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); |
558 | out_8(&sw->select, RELAX); | 582 | out_8(&sw->select, RELAX); |
559 | out_8(&sw->intr_enable, 0); | 583 | out_8(&sw->intr_enable, 0); |
560 | fs->cur_cyl = -1; | 584 | fs->cur_cyl = -1; |
561 | if (fs->retries > 5) { | 585 | if (fs->retries > 5) { |
562 | swim3_end_request_cur(-EIO); | 586 | swim3_end_request(fs, -EIO, 0); |
563 | fs->state = idle; | 587 | fs->state = idle; |
564 | start_request(fs); | 588 | start_request(fs); |
565 | } else { | 589 | } else { |
566 | fs->state = jogging; | 590 | fs->state = jogging; |
567 | act(fs); | 591 | act(fs); |
568 | } | 592 | } |
593 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
569 | } | 594 | } |
570 | 595 | ||
571 | static void seek_timeout(unsigned long data) | 596 | static void seek_timeout(unsigned long data) |
572 | { | 597 | { |
573 | struct floppy_state *fs = (struct floppy_state *) data; | 598 | struct floppy_state *fs = (struct floppy_state *) data; |
574 | struct swim3 __iomem *sw = fs->swim3; | 599 | struct swim3 __iomem *sw = fs->swim3; |
600 | unsigned long flags; | ||
601 | |||
602 | swim3_dbg("* seek timeout, state=%d\n", fs->state); | ||
575 | 603 | ||
604 | spin_lock_irqsave(&swim3_lock, flags); | ||
576 | fs->timeout_pending = 0; | 605 | fs->timeout_pending = 0; |
577 | out_8(&sw->control_bic, DO_SEEK); | 606 | out_8(&sw->control_bic, DO_SEEK); |
578 | out_8(&sw->select, RELAX); | 607 | out_8(&sw->select, RELAX); |
579 | out_8(&sw->intr_enable, 0); | 608 | out_8(&sw->intr_enable, 0); |
580 | printk(KERN_ERR "swim3: seek timeout\n"); | 609 | swim3_err("%s", "Seek timeout\n"); |
581 | swim3_end_request_cur(-EIO); | 610 | swim3_end_request(fs, -EIO, 0); |
582 | fs->state = idle; | 611 | fs->state = idle; |
583 | start_request(fs); | 612 | start_request(fs); |
613 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
584 | } | 614 | } |
585 | 615 | ||
586 | static void settle_timeout(unsigned long data) | 616 | static void settle_timeout(unsigned long data) |
587 | { | 617 | { |
588 | struct floppy_state *fs = (struct floppy_state *) data; | 618 | struct floppy_state *fs = (struct floppy_state *) data; |
589 | struct swim3 __iomem *sw = fs->swim3; | 619 | struct swim3 __iomem *sw = fs->swim3; |
620 | unsigned long flags; | ||
621 | |||
622 | swim3_dbg("* settle timeout, state=%d\n", fs->state); | ||
590 | 623 | ||
624 | spin_lock_irqsave(&swim3_lock, flags); | ||
591 | fs->timeout_pending = 0; | 625 | fs->timeout_pending = 0; |
592 | if (swim3_readbit(fs, SEEK_COMPLETE)) { | 626 | if (swim3_readbit(fs, SEEK_COMPLETE)) { |
593 | out_8(&sw->select, RELAX); | 627 | out_8(&sw->select, RELAX); |
594 | fs->state = locating; | 628 | fs->state = locating; |
595 | act(fs); | 629 | act(fs); |
596 | return; | 630 | goto unlock; |
597 | } | 631 | } |
598 | out_8(&sw->select, RELAX); | 632 | out_8(&sw->select, RELAX); |
599 | if (fs->settle_time < 2*HZ) { | 633 | if (fs->settle_time < 2*HZ) { |
600 | ++fs->settle_time; | 634 | ++fs->settle_time; |
601 | set_timeout(fs, 1, settle_timeout); | 635 | set_timeout(fs, 1, settle_timeout); |
602 | return; | 636 | goto unlock; |
603 | } | 637 | } |
604 | printk(KERN_ERR "swim3: seek settle timeout\n"); | 638 | swim3_err("%s", "Seek settle timeout\n"); |
605 | swim3_end_request_cur(-EIO); | 639 | swim3_end_request(fs, -EIO, 0); |
606 | fs->state = idle; | 640 | fs->state = idle; |
607 | start_request(fs); | 641 | start_request(fs); |
642 | unlock: | ||
643 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
608 | } | 644 | } |
609 | 645 | ||
610 | static void xfer_timeout(unsigned long data) | 646 | static void xfer_timeout(unsigned long data) |
@@ -612,8 +648,12 @@ static void xfer_timeout(unsigned long data) | |||
612 | struct floppy_state *fs = (struct floppy_state *) data; | 648 | struct floppy_state *fs = (struct floppy_state *) data; |
613 | struct swim3 __iomem *sw = fs->swim3; | 649 | struct swim3 __iomem *sw = fs->swim3; |
614 | struct dbdma_regs __iomem *dr = fs->dma; | 650 | struct dbdma_regs __iomem *dr = fs->dma; |
651 | unsigned long flags; | ||
615 | int n; | 652 | int n; |
616 | 653 | ||
654 | swim3_dbg("* xfer timeout, state=%d\n", fs->state); | ||
655 | |||
656 | spin_lock_irqsave(&swim3_lock, flags); | ||
617 | fs->timeout_pending = 0; | 657 | fs->timeout_pending = 0; |
618 | out_le32(&dr->control, RUN << 16); | 658 | out_le32(&dr->control, RUN << 16); |
619 | /* We must wait a bit for dbdma to stop */ | 659 | /* We must wait a bit for dbdma to stop */ |
@@ -622,12 +662,13 @@ static void xfer_timeout(unsigned long data) | |||
622 | out_8(&sw->intr_enable, 0); | 662 | out_8(&sw->intr_enable, 0); |
623 | out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); | 663 | out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); |
624 | out_8(&sw->select, RELAX); | 664 | out_8(&sw->select, RELAX); |
625 | printk(KERN_ERR "swim3: timeout %sing sector %ld\n", | 665 | swim3_err("Timeout %sing sector %ld\n", |
626 | (rq_data_dir(fd_req)==WRITE? "writ": "read"), | 666 | (rq_data_dir(fs->cur_req)==WRITE? "writ": "read"), |
627 | (long)blk_rq_pos(fd_req)); | 667 | (long)blk_rq_pos(fs->cur_req)); |
628 | swim3_end_request_cur(-EIO); | 668 | swim3_end_request(fs, -EIO, 0); |
629 | fs->state = idle; | 669 | fs->state = idle; |
630 | start_request(fs); | 670 | start_request(fs); |
671 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
631 | } | 672 | } |
632 | 673 | ||
633 | static irqreturn_t swim3_interrupt(int irq, void *dev_id) | 674 | static irqreturn_t swim3_interrupt(int irq, void *dev_id) |
@@ -638,12 +679,17 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
638 | int stat, resid; | 679 | int stat, resid; |
639 | struct dbdma_regs __iomem *dr; | 680 | struct dbdma_regs __iomem *dr; |
640 | struct dbdma_cmd *cp; | 681 | struct dbdma_cmd *cp; |
682 | unsigned long flags; | ||
683 | struct request *req = fs->cur_req; | ||
684 | |||
685 | swim3_dbg("* interrupt, state=%d\n", fs->state); | ||
641 | 686 | ||
687 | spin_lock_irqsave(&swim3_lock, flags); | ||
642 | intr = in_8(&sw->intr); | 688 | intr = in_8(&sw->intr); |
643 | err = (intr & ERROR_INTR)? in_8(&sw->error): 0; | 689 | err = (intr & ERROR_INTR)? in_8(&sw->error): 0; |
644 | if ((intr & ERROR_INTR) && fs->state != do_transfer) | 690 | if ((intr & ERROR_INTR) && fs->state != do_transfer) |
645 | printk(KERN_ERR "swim3_interrupt, state=%d, dir=%x, intr=%x, err=%x\n", | 691 | swim3_err("Non-transfer error interrupt: state=%d, dir=%x, intr=%x, err=%x\n", |
646 | fs->state, rq_data_dir(fd_req), intr, err); | 692 | fs->state, rq_data_dir(req), intr, err); |
647 | switch (fs->state) { | 693 | switch (fs->state) { |
648 | case locating: | 694 | case locating: |
649 | if (intr & SEEN_SECTOR) { | 695 | if (intr & SEEN_SECTOR) { |
@@ -653,10 +699,10 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
653 | del_timer(&fs->timeout); | 699 | del_timer(&fs->timeout); |
654 | fs->timeout_pending = 0; | 700 | fs->timeout_pending = 0; |
655 | if (sw->ctrack == 0xff) { | 701 | if (sw->ctrack == 0xff) { |
656 | printk(KERN_ERR "swim3: seen sector but cyl=ff?\n"); | 702 | swim3_err("%s", "Seen sector but cyl=ff?\n"); |
657 | fs->cur_cyl = -1; | 703 | fs->cur_cyl = -1; |
658 | if (fs->retries > 5) { | 704 | if (fs->retries > 5) { |
659 | swim3_end_request_cur(-EIO); | 705 | swim3_end_request(fs, -EIO, 0); |
660 | fs->state = idle; | 706 | fs->state = idle; |
661 | start_request(fs); | 707 | start_request(fs); |
662 | } else { | 708 | } else { |
@@ -668,8 +714,8 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
668 | fs->cur_cyl = sw->ctrack; | 714 | fs->cur_cyl = sw->ctrack; |
669 | fs->cur_sector = sw->csect; | 715 | fs->cur_sector = sw->csect; |
670 | if (fs->expect_cyl != -1 && fs->expect_cyl != fs->cur_cyl) | 716 | if (fs->expect_cyl != -1 && fs->expect_cyl != fs->cur_cyl) |
671 | printk(KERN_ERR "swim3: expected cyl %d, got %d\n", | 717 | swim3_err("Expected cyl %d, got %d\n", |
672 | fs->expect_cyl, fs->cur_cyl); | 718 | fs->expect_cyl, fs->cur_cyl); |
673 | fs->state = do_transfer; | 719 | fs->state = do_transfer; |
674 | act(fs); | 720 | act(fs); |
675 | } | 721 | } |
@@ -704,7 +750,7 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
704 | fs->timeout_pending = 0; | 750 | fs->timeout_pending = 0; |
705 | dr = fs->dma; | 751 | dr = fs->dma; |
706 | cp = fs->dma_cmd; | 752 | cp = fs->dma_cmd; |
707 | if (rq_data_dir(fd_req) == WRITE) | 753 | if (rq_data_dir(req) == WRITE) |
708 | ++cp; | 754 | ++cp; |
709 | /* | 755 | /* |
710 | * Check that the main data transfer has finished. | 756 | * Check that the main data transfer has finished. |
@@ -729,31 +775,32 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
729 | if (intr & ERROR_INTR) { | 775 | if (intr & ERROR_INTR) { |
730 | n = fs->scount - 1 - resid / 512; | 776 | n = fs->scount - 1 - resid / 512; |
731 | if (n > 0) { | 777 | if (n > 0) { |
732 | blk_update_request(fd_req, 0, n << 9); | 778 | blk_update_request(req, 0, n << 9); |
733 | fs->req_sector += n; | 779 | fs->req_sector += n; |
734 | } | 780 | } |
735 | if (fs->retries < 5) { | 781 | if (fs->retries < 5) { |
736 | ++fs->retries; | 782 | ++fs->retries; |
737 | act(fs); | 783 | act(fs); |
738 | } else { | 784 | } else { |
739 | printk("swim3: error %sing block %ld (err=%x)\n", | 785 | swim3_err("Error %sing block %ld (err=%x)\n", |
740 | rq_data_dir(fd_req) == WRITE? "writ": "read", | 786 | rq_data_dir(req) == WRITE? "writ": "read", |
741 | (long)blk_rq_pos(fd_req), err); | 787 | (long)blk_rq_pos(req), err); |
742 | swim3_end_request_cur(-EIO); | 788 | swim3_end_request(fs, -EIO, 0); |
743 | fs->state = idle; | 789 | fs->state = idle; |
744 | } | 790 | } |
745 | } else { | 791 | } else { |
746 | if ((stat & ACTIVE) == 0 || resid != 0) { | 792 | if ((stat & ACTIVE) == 0 || resid != 0) { |
747 | /* musta been an error */ | 793 | /* musta been an error */ |
748 | printk(KERN_ERR "swim3: fd dma: stat=%x resid=%d\n", stat, resid); | 794 | swim3_err("fd dma error: stat=%x resid=%d\n", stat, resid); |
749 | printk(KERN_ERR " state=%d, dir=%x, intr=%x, err=%x\n", | 795 | swim3_err(" state=%d, dir=%x, intr=%x, err=%x\n", |
750 | fs->state, rq_data_dir(fd_req), intr, err); | 796 | fs->state, rq_data_dir(req), intr, err); |
751 | swim3_end_request_cur(-EIO); | 797 | swim3_end_request(fs, -EIO, 0); |
752 | fs->state = idle; | 798 | fs->state = idle; |
753 | start_request(fs); | 799 | start_request(fs); |
754 | break; | 800 | break; |
755 | } | 801 | } |
756 | if (swim3_end_request(0, fs->scount << 9)) { | 802 | fs->retries = 0; |
803 | if (swim3_end_request(fs, 0, fs->scount << 9)) { | ||
757 | fs->req_sector += fs->scount; | 804 | fs->req_sector += fs->scount; |
758 | if (fs->req_sector > fs->secpertrack) { | 805 | if (fs->req_sector > fs->secpertrack) { |
759 | fs->req_sector -= fs->secpertrack; | 806 | fs->req_sector -= fs->secpertrack; |
@@ -770,8 +817,9 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
770 | start_request(fs); | 817 | start_request(fs); |
771 | break; | 818 | break; |
772 | default: | 819 | default: |
773 | printk(KERN_ERR "swim3: don't know what to do in state %d\n", fs->state); | 820 | swim3_err("Don't know what to do in state %d\n", fs->state); |
774 | } | 821 | } |
822 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
775 | return IRQ_HANDLED; | 823 | return IRQ_HANDLED; |
776 | } | 824 | } |
777 | 825 | ||
@@ -781,26 +829,31 @@ static void fd_dma_interrupt(int irq, void *dev_id) | |||
781 | } | 829 | } |
782 | */ | 830 | */ |
783 | 831 | ||
832 | /* Called under the mutex to grab exclusive access to a drive */ | ||
784 | static int grab_drive(struct floppy_state *fs, enum swim_state state, | 833 | static int grab_drive(struct floppy_state *fs, enum swim_state state, |
785 | int interruptible) | 834 | int interruptible) |
786 | { | 835 | { |
787 | unsigned long flags; | 836 | unsigned long flags; |
788 | 837 | ||
789 | spin_lock_irqsave(&fs->lock, flags); | 838 | swim3_dbg("%s", "-> grab drive\n"); |
790 | if (fs->state != idle) { | 839 | |
840 | spin_lock_irqsave(&swim3_lock, flags); | ||
841 | if (fs->state != idle && fs->state != available) { | ||
791 | ++fs->wanted; | 842 | ++fs->wanted; |
792 | while (fs->state != available) { | 843 | while (fs->state != available) { |
844 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
793 | if (interruptible && signal_pending(current)) { | 845 | if (interruptible && signal_pending(current)) { |
794 | --fs->wanted; | 846 | --fs->wanted; |
795 | spin_unlock_irqrestore(&fs->lock, flags); | ||
796 | return -EINTR; | 847 | return -EINTR; |
797 | } | 848 | } |
798 | interruptible_sleep_on(&fs->wait); | 849 | interruptible_sleep_on(&fs->wait); |
850 | spin_lock_irqsave(&swim3_lock, flags); | ||
799 | } | 851 | } |
800 | --fs->wanted; | 852 | --fs->wanted; |
801 | } | 853 | } |
802 | fs->state = state; | 854 | fs->state = state; |
803 | spin_unlock_irqrestore(&fs->lock, flags); | 855 | spin_unlock_irqrestore(&swim3_lock, flags); |
856 | |||
804 | return 0; | 857 | return 0; |
805 | } | 858 | } |
806 | 859 | ||
@@ -808,10 +861,12 @@ static void release_drive(struct floppy_state *fs) | |||
808 | { | 861 | { |
809 | unsigned long flags; | 862 | unsigned long flags; |
810 | 863 | ||
811 | spin_lock_irqsave(&fs->lock, flags); | 864 | swim3_dbg("%s", "-> release drive\n"); |
865 | |||
866 | spin_lock_irqsave(&swim3_lock, flags); | ||
812 | fs->state = idle; | 867 | fs->state = idle; |
813 | start_request(fs); | 868 | start_request(fs); |
814 | spin_unlock_irqrestore(&fs->lock, flags); | 869 | spin_unlock_irqrestore(&swim3_lock, flags); |
815 | } | 870 | } |
816 | 871 | ||
817 | static int fd_eject(struct floppy_state *fs) | 872 | static int fd_eject(struct floppy_state *fs) |
@@ -966,6 +1021,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
966 | { | 1021 | { |
967 | struct floppy_state *fs = disk->private_data; | 1022 | struct floppy_state *fs = disk->private_data; |
968 | struct swim3 __iomem *sw = fs->swim3; | 1023 | struct swim3 __iomem *sw = fs->swim3; |
1024 | |||
969 | mutex_lock(&swim3_mutex); | 1025 | mutex_lock(&swim3_mutex); |
970 | if (fs->ref_count > 0 && --fs->ref_count == 0) { | 1026 | if (fs->ref_count > 0 && --fs->ref_count == 0) { |
971 | swim3_action(fs, MOTOR_OFF); | 1027 | swim3_action(fs, MOTOR_OFF); |
@@ -1031,30 +1087,48 @@ static const struct block_device_operations floppy_fops = { | |||
1031 | .revalidate_disk= floppy_revalidate, | 1087 | .revalidate_disk= floppy_revalidate, |
1032 | }; | 1088 | }; |
1033 | 1089 | ||
1090 | static void swim3_mb_event(struct macio_dev* mdev, int mb_state) | ||
1091 | { | ||
1092 | struct floppy_state *fs = macio_get_drvdata(mdev); | ||
1093 | struct swim3 __iomem *sw = fs->swim3; | ||
1094 | |||
1095 | if (!fs) | ||
1096 | return; | ||
1097 | if (mb_state != MB_FD) | ||
1098 | return; | ||
1099 | |||
1100 | /* Clear state */ | ||
1101 | out_8(&sw->intr_enable, 0); | ||
1102 | in_8(&sw->intr); | ||
1103 | in_8(&sw->error); | ||
1104 | } | ||
1105 | |||
1034 | static int swim3_add_device(struct macio_dev *mdev, int index) | 1106 | static int swim3_add_device(struct macio_dev *mdev, int index) |
1035 | { | 1107 | { |
1036 | struct device_node *swim = mdev->ofdev.dev.of_node; | 1108 | struct device_node *swim = mdev->ofdev.dev.of_node; |
1037 | struct floppy_state *fs = &floppy_states[index]; | 1109 | struct floppy_state *fs = &floppy_states[index]; |
1038 | int rc = -EBUSY; | 1110 | int rc = -EBUSY; |
1039 | 1111 | ||
1112 | /* Do this first for message macros */ | ||
1113 | memset(fs, 0, sizeof(*fs)); | ||
1114 | fs->mdev = mdev; | ||
1115 | fs->index = index; | ||
1116 | |||
1040 | /* Check & Request resources */ | 1117 | /* Check & Request resources */ |
1041 | if (macio_resource_count(mdev) < 2) { | 1118 | if (macio_resource_count(mdev) < 2) { |
1042 | printk(KERN_WARNING "ifd%d: no address for %s\n", | 1119 | swim3_err("%s", "No address in device-tree\n"); |
1043 | index, swim->full_name); | ||
1044 | return -ENXIO; | 1120 | return -ENXIO; |
1045 | } | 1121 | } |
1046 | if (macio_irq_count(mdev) < 2) { | 1122 | if (macio_irq_count(mdev) < 1) { |
1047 | printk(KERN_WARNING "fd%d: no intrs for device %s\n", | 1123 | swim3_err("%s", "No interrupt in device-tree\n"); |
1048 | index, swim->full_name); | 1124 | return -ENXIO; |
1049 | } | 1125 | } |
1050 | if (macio_request_resource(mdev, 0, "swim3 (mmio)")) { | 1126 | if (macio_request_resource(mdev, 0, "swim3 (mmio)")) { |
1051 | printk(KERN_ERR "fd%d: can't request mmio resource for %s\n", | 1127 | swim3_err("%s", "Can't request mmio resource\n"); |
1052 | index, swim->full_name); | ||
1053 | return -EBUSY; | 1128 | return -EBUSY; |
1054 | } | 1129 | } |
1055 | if (macio_request_resource(mdev, 1, "swim3 (dma)")) { | 1130 | if (macio_request_resource(mdev, 1, "swim3 (dma)")) { |
1056 | printk(KERN_ERR "fd%d: can't request dma resource for %s\n", | 1131 | swim3_err("%s", "Can't request dma resource\n"); |
1057 | index, swim->full_name); | ||
1058 | macio_release_resource(mdev, 0); | 1132 | macio_release_resource(mdev, 0); |
1059 | return -EBUSY; | 1133 | return -EBUSY; |
1060 | } | 1134 | } |
@@ -1063,22 +1137,18 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
1063 | if (mdev->media_bay == NULL) | 1137 | if (mdev->media_bay == NULL) |
1064 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1); | 1138 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1); |
1065 | 1139 | ||
1066 | memset(fs, 0, sizeof(*fs)); | ||
1067 | spin_lock_init(&fs->lock); | ||
1068 | fs->state = idle; | 1140 | fs->state = idle; |
1069 | fs->swim3 = (struct swim3 __iomem *) | 1141 | fs->swim3 = (struct swim3 __iomem *) |
1070 | ioremap(macio_resource_start(mdev, 0), 0x200); | 1142 | ioremap(macio_resource_start(mdev, 0), 0x200); |
1071 | if (fs->swim3 == NULL) { | 1143 | if (fs->swim3 == NULL) { |
1072 | printk("fd%d: couldn't map registers for %s\n", | 1144 | swim3_err("%s", "Couldn't map mmio registers\n"); |
1073 | index, swim->full_name); | ||
1074 | rc = -ENOMEM; | 1145 | rc = -ENOMEM; |
1075 | goto out_release; | 1146 | goto out_release; |
1076 | } | 1147 | } |
1077 | fs->dma = (struct dbdma_regs __iomem *) | 1148 | fs->dma = (struct dbdma_regs __iomem *) |
1078 | ioremap(macio_resource_start(mdev, 1), 0x200); | 1149 | ioremap(macio_resource_start(mdev, 1), 0x200); |
1079 | if (fs->dma == NULL) { | 1150 | if (fs->dma == NULL) { |
1080 | printk("fd%d: couldn't map DMA for %s\n", | 1151 | swim3_err("%s", "Couldn't map dma registers\n"); |
1081 | index, swim->full_name); | ||
1082 | iounmap(fs->swim3); | 1152 | iounmap(fs->swim3); |
1083 | rc = -ENOMEM; | 1153 | rc = -ENOMEM; |
1084 | goto out_release; | 1154 | goto out_release; |
@@ -1090,31 +1160,25 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
1090 | fs->secpercyl = 36; | 1160 | fs->secpercyl = 36; |
1091 | fs->secpertrack = 18; | 1161 | fs->secpertrack = 18; |
1092 | fs->total_secs = 2880; | 1162 | fs->total_secs = 2880; |
1093 | fs->mdev = mdev; | ||
1094 | init_waitqueue_head(&fs->wait); | 1163 | init_waitqueue_head(&fs->wait); |
1095 | 1164 | ||
1096 | fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space); | 1165 | fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space); |
1097 | memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd)); | 1166 | memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd)); |
1098 | st_le16(&fs->dma_cmd[1].command, DBDMA_STOP); | 1167 | st_le16(&fs->dma_cmd[1].command, DBDMA_STOP); |
1099 | 1168 | ||
1169 | if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD) | ||
1170 | swim3_mb_event(mdev, MB_FD); | ||
1171 | |||
1100 | if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) { | 1172 | if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) { |
1101 | printk(KERN_ERR "fd%d: couldn't request irq %d for %s\n", | 1173 | swim3_err("%s", "Couldn't request interrupt\n"); |
1102 | index, fs->swim3_intr, swim->full_name); | ||
1103 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0); | 1174 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0); |
1104 | goto out_unmap; | 1175 | goto out_unmap; |
1105 | return -EBUSY; | 1176 | return -EBUSY; |
1106 | } | 1177 | } |
1107 | /* | ||
1108 | if (request_irq(fs->dma_intr, fd_dma_interrupt, 0, "SWIM3-dma", fs)) { | ||
1109 | printk(KERN_ERR "Couldn't get irq %d for SWIM3 DMA", | ||
1110 | fs->dma_intr); | ||
1111 | return -EBUSY; | ||
1112 | } | ||
1113 | */ | ||
1114 | 1178 | ||
1115 | init_timer(&fs->timeout); | 1179 | init_timer(&fs->timeout); |
1116 | 1180 | ||
1117 | printk(KERN_INFO "fd%d: SWIM3 floppy controller %s\n", floppy_count, | 1181 | swim3_info("SWIM3 floppy controller %s\n", |
1118 | mdev->media_bay ? "in media bay" : ""); | 1182 | mdev->media_bay ? "in media bay" : ""); |
1119 | 1183 | ||
1120 | return 0; | 1184 | return 0; |
@@ -1132,41 +1196,42 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
1132 | 1196 | ||
1133 | static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device_id *match) | 1197 | static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device_id *match) |
1134 | { | 1198 | { |
1135 | int i, rc; | ||
1136 | struct gendisk *disk; | 1199 | struct gendisk *disk; |
1200 | int index, rc; | ||
1201 | |||
1202 | index = floppy_count++; | ||
1203 | if (index >= MAX_FLOPPIES) | ||
1204 | return -ENXIO; | ||
1137 | 1205 | ||
1138 | /* Add the drive */ | 1206 | /* Add the drive */ |
1139 | rc = swim3_add_device(mdev, floppy_count); | 1207 | rc = swim3_add_device(mdev, index); |
1140 | if (rc) | 1208 | if (rc) |
1141 | return rc; | 1209 | return rc; |
1210 | /* Now register that disk. Same comment about failure handling */ | ||
1211 | disk = disks[index] = alloc_disk(1); | ||
1212 | if (disk == NULL) | ||
1213 | return -ENOMEM; | ||
1214 | disk->queue = blk_init_queue(do_fd_request, &swim3_lock); | ||
1215 | if (disk->queue == NULL) { | ||
1216 | put_disk(disk); | ||
1217 | return -ENOMEM; | ||
1218 | } | ||
1219 | disk->queue->queuedata = &floppy_states[index]; | ||
1142 | 1220 | ||
1143 | /* Now create the queue if not there yet */ | 1221 | if (index == 0) { |
1144 | if (swim3_queue == NULL) { | ||
1145 | /* If we failed, there isn't much we can do as the driver is still | 1222 | /* If we failed, there isn't much we can do as the driver is still |
1146 | * too dumb to remove the device, just bail out | 1223 | * too dumb to remove the device, just bail out |
1147 | */ | 1224 | */ |
1148 | if (register_blkdev(FLOPPY_MAJOR, "fd")) | 1225 | if (register_blkdev(FLOPPY_MAJOR, "fd")) |
1149 | return 0; | 1226 | return 0; |
1150 | swim3_queue = blk_init_queue(do_fd_request, &swim3_lock); | ||
1151 | if (swim3_queue == NULL) { | ||
1152 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | ||
1153 | return 0; | ||
1154 | } | ||
1155 | } | 1227 | } |
1156 | 1228 | ||
1157 | /* Now register that disk. Same comment about failure handling */ | ||
1158 | i = floppy_count++; | ||
1159 | disk = disks[i] = alloc_disk(1); | ||
1160 | if (disk == NULL) | ||
1161 | return 0; | ||
1162 | |||
1163 | disk->major = FLOPPY_MAJOR; | 1229 | disk->major = FLOPPY_MAJOR; |
1164 | disk->first_minor = i; | 1230 | disk->first_minor = index; |
1165 | disk->fops = &floppy_fops; | 1231 | disk->fops = &floppy_fops; |
1166 | disk->private_data = &floppy_states[i]; | 1232 | disk->private_data = &floppy_states[index]; |
1167 | disk->queue = swim3_queue; | ||
1168 | disk->flags |= GENHD_FL_REMOVABLE; | 1233 | disk->flags |= GENHD_FL_REMOVABLE; |
1169 | sprintf(disk->disk_name, "fd%d", i); | 1234 | sprintf(disk->disk_name, "fd%d", index); |
1170 | set_capacity(disk, 2880); | 1235 | set_capacity(disk, 2880); |
1171 | add_disk(disk); | 1236 | add_disk(disk); |
1172 | 1237 | ||
@@ -1194,6 +1259,9 @@ static struct macio_driver swim3_driver = | |||
1194 | .of_match_table = swim3_match, | 1259 | .of_match_table = swim3_match, |
1195 | }, | 1260 | }, |
1196 | .probe = swim3_attach, | 1261 | .probe = swim3_attach, |
1262 | #ifdef CONFIG_PMAC_MEDIABAY | ||
1263 | .mediabay_event = swim3_mb_event, | ||
1264 | #endif | ||
1197 | #if 0 | 1265 | #if 0 |
1198 | .suspend = swim3_suspend, | 1266 | .suspend = swim3_suspend, |
1199 | .resume = swim3_resume, | 1267 | .resume = swim3_resume, |
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index c811cb107904..2cce44a1d7d0 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c | |||
@@ -746,6 +746,37 @@ static void __exit ibft_exit(void) | |||
746 | ibft_cleanup(); | 746 | ibft_cleanup(); |
747 | } | 747 | } |
748 | 748 | ||
749 | #ifdef CONFIG_ACPI | ||
750 | static const struct { | ||
751 | char *sign; | ||
752 | } ibft_signs[] = { | ||
753 | /* | ||
754 | * One spec says "IBFT", the other says "iBFT". We have to check | ||
755 | * for both. | ||
756 | */ | ||
757 | { ACPI_SIG_IBFT }, | ||
758 | { "iBFT" }, | ||
759 | }; | ||
760 | |||
761 | static void __init acpi_find_ibft_region(void) | ||
762 | { | ||
763 | int i; | ||
764 | struct acpi_table_header *table = NULL; | ||
765 | |||
766 | if (acpi_disabled) | ||
767 | return; | ||
768 | |||
769 | for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++) { | ||
770 | acpi_get_table(ibft_signs[i].sign, 0, &table); | ||
771 | ibft_addr = (struct acpi_table_ibft *)table; | ||
772 | } | ||
773 | } | ||
774 | #else | ||
775 | static void __init acpi_find_ibft_region(void) | ||
776 | { | ||
777 | } | ||
778 | #endif | ||
779 | |||
749 | /* | 780 | /* |
750 | * ibft_init() - creates sysfs tree entries for the iBFT data. | 781 | * ibft_init() - creates sysfs tree entries for the iBFT data. |
751 | */ | 782 | */ |
@@ -753,9 +784,16 @@ static int __init ibft_init(void) | |||
753 | { | 784 | { |
754 | int rc = 0; | 785 | int rc = 0; |
755 | 786 | ||
787 | /* | ||
788 | As on UEFI systems the setup_arch()/find_ibft_region() | ||
789 | is called before ACPI tables are parsed and it only does | ||
790 | legacy finding. | ||
791 | */ | ||
792 | if (!ibft_addr) | ||
793 | acpi_find_ibft_region(); | ||
794 | |||
756 | if (ibft_addr) { | 795 | if (ibft_addr) { |
757 | printk(KERN_INFO "iBFT detected at 0x%llx.\n", | 796 | pr_info("iBFT detected.\n"); |
758 | (u64)isa_virt_to_bus(ibft_addr)); | ||
759 | 797 | ||
760 | rc = ibft_check_device(); | 798 | rc = ibft_check_device(); |
761 | if (rc) | 799 | if (rc) |
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c index bfe723266fd8..4da4eb9ae926 100644 --- a/drivers/firmware/iscsi_ibft_find.c +++ b/drivers/firmware/iscsi_ibft_find.c | |||
@@ -45,13 +45,6 @@ EXPORT_SYMBOL_GPL(ibft_addr); | |||
45 | static const struct { | 45 | static const struct { |
46 | char *sign; | 46 | char *sign; |
47 | } ibft_signs[] = { | 47 | } ibft_signs[] = { |
48 | #ifdef CONFIG_ACPI | ||
49 | /* | ||
50 | * One spec says "IBFT", the other says "iBFT". We have to check | ||
51 | * for both. | ||
52 | */ | ||
53 | { ACPI_SIG_IBFT }, | ||
54 | #endif | ||
55 | { "iBFT" }, | 48 | { "iBFT" }, |
56 | { "BIFT" }, /* Broadcom iSCSI Offload */ | 49 | { "BIFT" }, /* Broadcom iSCSI Offload */ |
57 | }; | 50 | }; |
@@ -62,14 +55,6 @@ static const struct { | |||
62 | #define VGA_MEM 0xA0000 /* VGA buffer */ | 55 | #define VGA_MEM 0xA0000 /* VGA buffer */ |
63 | #define VGA_SIZE 0x20000 /* 128kB */ | 56 | #define VGA_SIZE 0x20000 /* 128kB */ |
64 | 57 | ||
65 | #ifdef CONFIG_ACPI | ||
66 | static int __init acpi_find_ibft(struct acpi_table_header *header) | ||
67 | { | ||
68 | ibft_addr = (struct acpi_table_ibft *)header; | ||
69 | return 0; | ||
70 | } | ||
71 | #endif /* CONFIG_ACPI */ | ||
72 | |||
73 | static int __init find_ibft_in_mem(void) | 58 | static int __init find_ibft_in_mem(void) |
74 | { | 59 | { |
75 | unsigned long pos; | 60 | unsigned long pos; |
@@ -94,6 +79,7 @@ static int __init find_ibft_in_mem(void) | |||
94 | * the table cannot be valid. */ | 79 | * the table cannot be valid. */ |
95 | if (pos + len <= (IBFT_END-1)) { | 80 | if (pos + len <= (IBFT_END-1)) { |
96 | ibft_addr = (struct acpi_table_ibft *)virt; | 81 | ibft_addr = (struct acpi_table_ibft *)virt; |
82 | pr_info("iBFT found at 0x%lx.\n", pos); | ||
97 | goto done; | 83 | goto done; |
98 | } | 84 | } |
99 | } | 85 | } |
@@ -108,20 +94,12 @@ done: | |||
108 | */ | 94 | */ |
109 | unsigned long __init find_ibft_region(unsigned long *sizep) | 95 | unsigned long __init find_ibft_region(unsigned long *sizep) |
110 | { | 96 | { |
111 | #ifdef CONFIG_ACPI | ||
112 | int i; | ||
113 | #endif | ||
114 | ibft_addr = NULL; | 97 | ibft_addr = NULL; |
115 | 98 | ||
116 | #ifdef CONFIG_ACPI | ||
117 | for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++) | ||
118 | acpi_table_parse(ibft_signs[i].sign, acpi_find_ibft); | ||
119 | #endif /* CONFIG_ACPI */ | ||
120 | |||
121 | /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will | 99 | /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will |
122 | * only use ACPI for this */ | 100 | * only use ACPI for this */ |
123 | 101 | ||
124 | if (!ibft_addr && !efi_enabled) | 102 | if (!efi_enabled) |
125 | find_ibft_in_mem(); | 103 | find_ibft_in_mem(); |
126 | 104 | ||
127 | if (ibft_addr) { | 105 | if (ibft_addr) { |
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c index 038f5eb8b13d..f8ce29ef9f88 100644 --- a/drivers/gpio/gpio-da9052.c +++ b/drivers/gpio/gpio-da9052.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/mfd/da9052/da9052.h> | 22 | #include <linux/mfd/da9052/da9052.h> |
23 | #include <linux/mfd/da9052/reg.h> | 23 | #include <linux/mfd/da9052/reg.h> |
24 | #include <linux/mfd/da9052/pdata.h> | 24 | #include <linux/mfd/da9052/pdata.h> |
25 | #include <linux/mfd/da9052/gpio.h> | ||
26 | 25 | ||
27 | #define DA9052_INPUT 1 | 26 | #define DA9052_INPUT 1 |
28 | #define DA9052_OUTPUT_OPENDRAIN 2 | 27 | #define DA9052_OUTPUT_OPENDRAIN 2 |
@@ -43,6 +42,9 @@ | |||
43 | #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 | 42 | #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 |
44 | #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F | 43 | #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F |
45 | #define DA9052_GPIO_NIBBLE_SHIFT 4 | 44 | #define DA9052_GPIO_NIBBLE_SHIFT 4 |
45 | #define DA9052_IRQ_GPI0 16 | ||
46 | #define DA9052_GPIO_ODD_SHIFT 7 | ||
47 | #define DA9052_GPIO_EVEN_SHIFT 3 | ||
46 | 48 | ||
47 | struct da9052_gpio { | 49 | struct da9052_gpio { |
48 | struct da9052 *da9052; | 50 | struct da9052 *da9052; |
@@ -104,33 +106,26 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset) | |||
104 | static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) | 106 | static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) |
105 | { | 107 | { |
106 | struct da9052_gpio *gpio = to_da9052_gpio(gc); | 108 | struct da9052_gpio *gpio = to_da9052_gpio(gc); |
107 | unsigned char register_value = 0; | ||
108 | int ret; | 109 | int ret; |
109 | 110 | ||
110 | if (da9052_gpio_port_odd(offset)) { | 111 | if (da9052_gpio_port_odd(offset)) { |
111 | if (value) { | ||
112 | register_value = DA9052_GPIO_ODD_PORT_MODE; | ||
113 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + | 112 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + |
114 | DA9052_GPIO_0_1_REG, | 113 | DA9052_GPIO_0_1_REG, |
115 | DA9052_GPIO_ODD_PORT_MODE, | 114 | DA9052_GPIO_ODD_PORT_MODE, |
116 | register_value); | 115 | value << DA9052_GPIO_ODD_SHIFT); |
117 | if (ret != 0) | 116 | if (ret != 0) |
118 | dev_err(gpio->da9052->dev, | 117 | dev_err(gpio->da9052->dev, |
119 | "Failed to updated gpio odd reg,%d", | 118 | "Failed to updated gpio odd reg,%d", |
120 | ret); | 119 | ret); |
121 | } | ||
122 | } else { | 120 | } else { |
123 | if (value) { | ||
124 | register_value = DA9052_GPIO_EVEN_PORT_MODE; | ||
125 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + | 121 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + |
126 | DA9052_GPIO_0_1_REG, | 122 | DA9052_GPIO_0_1_REG, |
127 | DA9052_GPIO_EVEN_PORT_MODE, | 123 | DA9052_GPIO_EVEN_PORT_MODE, |
128 | register_value); | 124 | value << DA9052_GPIO_EVEN_SHIFT); |
129 | if (ret != 0) | 125 | if (ret != 0) |
130 | dev_err(gpio->da9052->dev, | 126 | dev_err(gpio->da9052->dev, |
131 | "Failed to updated gpio even reg,%d", | 127 | "Failed to updated gpio even reg,%d", |
132 | ret); | 128 | ret); |
133 | } | ||
134 | } | 129 | } |
135 | } | 130 | } |
136 | 131 | ||
@@ -201,9 +196,9 @@ static struct gpio_chip reference_gp __devinitdata = { | |||
201 | .direction_input = da9052_gpio_direction_input, | 196 | .direction_input = da9052_gpio_direction_input, |
202 | .direction_output = da9052_gpio_direction_output, | 197 | .direction_output = da9052_gpio_direction_output, |
203 | .to_irq = da9052_gpio_to_irq, | 198 | .to_irq = da9052_gpio_to_irq, |
204 | .can_sleep = 1; | 199 | .can_sleep = 1, |
205 | .ngpio = 16; | 200 | .ngpio = 16, |
206 | .base = -1; | 201 | .base = -1, |
207 | }; | 202 | }; |
208 | 203 | ||
209 | static int __devinit da9052_gpio_probe(struct platform_device *pdev) | 204 | static int __devinit da9052_gpio_probe(struct platform_device *pdev) |
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index ea8e73869250..461958fc2264 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c | |||
@@ -332,6 +332,34 @@ static void ioh_irq_mask(struct irq_data *d) | |||
332 | &chip->reg->regs[chip->ch].imask); | 332 | &chip->reg->regs[chip->ch].imask); |
333 | } | 333 | } |
334 | 334 | ||
335 | static void ioh_irq_disable(struct irq_data *d) | ||
336 | { | ||
337 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
338 | struct ioh_gpio *chip = gc->private; | ||
339 | unsigned long flags; | ||
340 | u32 ien; | ||
341 | |||
342 | spin_lock_irqsave(&chip->spinlock, flags); | ||
343 | ien = ioread32(&chip->reg->regs[chip->ch].ien); | ||
344 | ien &= ~(1 << (d->irq - chip->irq_base)); | ||
345 | iowrite32(ien, &chip->reg->regs[chip->ch].ien); | ||
346 | spin_unlock_irqrestore(&chip->spinlock, flags); | ||
347 | } | ||
348 | |||
349 | static void ioh_irq_enable(struct irq_data *d) | ||
350 | { | ||
351 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
352 | struct ioh_gpio *chip = gc->private; | ||
353 | unsigned long flags; | ||
354 | u32 ien; | ||
355 | |||
356 | spin_lock_irqsave(&chip->spinlock, flags); | ||
357 | ien = ioread32(&chip->reg->regs[chip->ch].ien); | ||
358 | ien |= 1 << (d->irq - chip->irq_base); | ||
359 | iowrite32(ien, &chip->reg->regs[chip->ch].ien); | ||
360 | spin_unlock_irqrestore(&chip->spinlock, flags); | ||
361 | } | ||
362 | |||
335 | static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) | 363 | static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) |
336 | { | 364 | { |
337 | struct ioh_gpio *chip = dev_id; | 365 | struct ioh_gpio *chip = dev_id; |
@@ -339,7 +367,7 @@ static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) | |||
339 | int i, j; | 367 | int i, j; |
340 | int ret = IRQ_NONE; | 368 | int ret = IRQ_NONE; |
341 | 369 | ||
342 | for (i = 0; i < 8; i++) { | 370 | for (i = 0; i < 8; i++, chip++) { |
343 | reg_val = ioread32(&chip->reg->regs[i].istatus); | 371 | reg_val = ioread32(&chip->reg->regs[i].istatus); |
344 | for (j = 0; j < num_ports[i]; j++) { | 372 | for (j = 0; j < num_ports[i]; j++) { |
345 | if (reg_val & BIT(j)) { | 373 | if (reg_val & BIT(j)) { |
@@ -370,6 +398,8 @@ static __devinit void ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip, | |||
370 | ct->chip.irq_mask = ioh_irq_mask; | 398 | ct->chip.irq_mask = ioh_irq_mask; |
371 | ct->chip.irq_unmask = ioh_irq_unmask; | 399 | ct->chip.irq_unmask = ioh_irq_unmask; |
372 | ct->chip.irq_set_type = ioh_irq_type; | 400 | ct->chip.irq_set_type = ioh_irq_type; |
401 | ct->chip.irq_disable = ioh_irq_disable; | ||
402 | ct->chip.irq_enable = ioh_irq_enable; | ||
373 | 403 | ||
374 | irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, | 404 | irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, |
375 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | 405 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); |
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index ec3fcf0a7e12..5cd04b65c556 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
@@ -132,6 +132,15 @@ static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val | |||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | static int mpc5121_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | ||
136 | { | ||
137 | /* GPIO 28..31 are input only on MPC5121 */ | ||
138 | if (gpio >= 28) | ||
139 | return -EINVAL; | ||
140 | |||
141 | return mpc8xxx_gpio_dir_out(gc, gpio, val); | ||
142 | } | ||
143 | |||
135 | static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | 144 | static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset) |
136 | { | 145 | { |
137 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 146 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
@@ -340,11 +349,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np) | |||
340 | mm_gc->save_regs = mpc8xxx_gpio_save_regs; | 349 | mm_gc->save_regs = mpc8xxx_gpio_save_regs; |
341 | gc->ngpio = MPC8XXX_GPIO_PINS; | 350 | gc->ngpio = MPC8XXX_GPIO_PINS; |
342 | gc->direction_input = mpc8xxx_gpio_dir_in; | 351 | gc->direction_input = mpc8xxx_gpio_dir_in; |
343 | gc->direction_output = mpc8xxx_gpio_dir_out; | 352 | gc->direction_output = of_device_is_compatible(np, "fsl,mpc5121-gpio") ? |
344 | if (of_device_is_compatible(np, "fsl,mpc8572-gpio")) | 353 | mpc5121_gpio_dir_out : mpc8xxx_gpio_dir_out; |
345 | gc->get = mpc8572_gpio_get; | 354 | gc->get = of_device_is_compatible(np, "fsl,mpc8572-gpio") ? |
346 | else | 355 | mpc8572_gpio_get : mpc8xxx_gpio_get; |
347 | gc->get = mpc8xxx_gpio_get; | ||
348 | gc->set = mpc8xxx_gpio_set; | 356 | gc->set = mpc8xxx_gpio_set; |
349 | gc->to_irq = mpc8xxx_gpio_to_irq; | 357 | gc->to_irq = mpc8xxx_gpio_to_irq; |
350 | 358 | ||
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 093c90bd3c1d..4102f63230fd 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c | |||
@@ -238,10 +238,6 @@ static int pl061_probe(struct amba_device *dev, const struct amba_id *id) | |||
238 | int ret, irq, i; | 238 | int ret, irq, i; |
239 | static DECLARE_BITMAP(init_irq, NR_IRQS); | 239 | static DECLARE_BITMAP(init_irq, NR_IRQS); |
240 | 240 | ||
241 | pdata = dev->dev.platform_data; | ||
242 | if (pdata == NULL) | ||
243 | return -ENODEV; | ||
244 | |||
245 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 241 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
246 | if (chip == NULL) | 242 | if (chip == NULL) |
247 | return -ENOMEM; | 243 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index d09a6e02dc95..004b048c5192 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -62,6 +62,7 @@ static int i915_capabilities(struct seq_file *m, void *data) | |||
62 | const struct intel_device_info *info = INTEL_INFO(dev); | 62 | const struct intel_device_info *info = INTEL_INFO(dev); |
63 | 63 | ||
64 | seq_printf(m, "gen: %d\n", info->gen); | 64 | seq_printf(m, "gen: %d\n", info->gen); |
65 | seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev)); | ||
65 | #define B(x) seq_printf(m, #x ": %s\n", yesno(info->x)) | 66 | #define B(x) seq_printf(m, #x ": %s\n", yesno(info->x)) |
66 | B(is_mobile); | 67 | B(is_mobile); |
67 | B(is_i85x); | 68 | B(is_i85x); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index a9533c54c93c..a9ae374861e7 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1454,6 +1454,14 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) | |||
1454 | 1454 | ||
1455 | diff1 = now - dev_priv->last_time1; | 1455 | diff1 = now - dev_priv->last_time1; |
1456 | 1456 | ||
1457 | /* Prevent division-by-zero if we are asking too fast. | ||
1458 | * Also, we don't get interesting results if we are polling | ||
1459 | * faster than once in 10ms, so just return the saved value | ||
1460 | * in such cases. | ||
1461 | */ | ||
1462 | if (diff1 <= 10) | ||
1463 | return dev_priv->chipset_power; | ||
1464 | |||
1457 | count1 = I915_READ(DMIEC); | 1465 | count1 = I915_READ(DMIEC); |
1458 | count2 = I915_READ(DDREC); | 1466 | count2 = I915_READ(DDREC); |
1459 | count3 = I915_READ(CSIEC); | 1467 | count3 = I915_READ(CSIEC); |
@@ -1484,6 +1492,8 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) | |||
1484 | dev_priv->last_count1 = total_count; | 1492 | dev_priv->last_count1 = total_count; |
1485 | dev_priv->last_time1 = now; | 1493 | dev_priv->last_time1 = now; |
1486 | 1494 | ||
1495 | dev_priv->chipset_power = ret; | ||
1496 | |||
1487 | return ret; | 1497 | return ret; |
1488 | } | 1498 | } |
1489 | 1499 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 15bfa9145d2b..a1103fc6597d 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -58,15 +58,15 @@ module_param_named(powersave, i915_powersave, int, 0600); | |||
58 | MODULE_PARM_DESC(powersave, | 58 | MODULE_PARM_DESC(powersave, |
59 | "Enable powersavings, fbc, downclocking, etc. (default: true)"); | 59 | "Enable powersavings, fbc, downclocking, etc. (default: true)"); |
60 | 60 | ||
61 | unsigned int i915_semaphores __read_mostly = 0; | 61 | int i915_semaphores __read_mostly = -1; |
62 | module_param_named(semaphores, i915_semaphores, int, 0600); | 62 | module_param_named(semaphores, i915_semaphores, int, 0600); |
63 | MODULE_PARM_DESC(semaphores, | 63 | MODULE_PARM_DESC(semaphores, |
64 | "Use semaphores for inter-ring sync (default: false)"); | 64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); |
65 | 65 | ||
66 | unsigned int i915_enable_rc6 __read_mostly = 0; | 66 | int i915_enable_rc6 __read_mostly = -1; |
67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); |
68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
69 | "Enable power-saving render C-state 6 (default: true)"); | 69 | "Enable power-saving render C-state 6 (default: -1 (use per-chip default)"); |
70 | 70 | ||
71 | int i915_enable_fbc __read_mostly = -1; | 71 | int i915_enable_fbc __read_mostly = -1; |
72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); | 72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); |
@@ -328,7 +328,7 @@ void intel_detect_pch(struct drm_device *dev) | |||
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | 331 | void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) |
332 | { | 332 | { |
333 | int count; | 333 | int count; |
334 | 334 | ||
@@ -344,6 +344,22 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | |||
344 | udelay(10); | 344 | udelay(10); |
345 | } | 345 | } |
346 | 346 | ||
347 | void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) | ||
348 | { | ||
349 | int count; | ||
350 | |||
351 | count = 0; | ||
352 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1)) | ||
353 | udelay(10); | ||
354 | |||
355 | I915_WRITE_NOTRACE(FORCEWAKE_MT, (1<<16) | 1); | ||
356 | POSTING_READ(FORCEWAKE_MT); | ||
357 | |||
358 | count = 0; | ||
359 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1) == 0) | ||
360 | udelay(10); | ||
361 | } | ||
362 | |||
347 | /* | 363 | /* |
348 | * Generally this is called implicitly by the register read function. However, | 364 | * Generally this is called implicitly by the register read function. However, |
349 | * if some sequence requires the GT to not power down then this function should | 365 | * if some sequence requires the GT to not power down then this function should |
@@ -356,15 +372,21 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | |||
356 | 372 | ||
357 | /* Forcewake is atomic in case we get in here without the lock */ | 373 | /* Forcewake is atomic in case we get in here without the lock */ |
358 | if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) | 374 | if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) |
359 | __gen6_gt_force_wake_get(dev_priv); | 375 | dev_priv->display.force_wake_get(dev_priv); |
360 | } | 376 | } |
361 | 377 | ||
362 | static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) | 378 | void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) |
363 | { | 379 | { |
364 | I915_WRITE_NOTRACE(FORCEWAKE, 0); | 380 | I915_WRITE_NOTRACE(FORCEWAKE, 0); |
365 | POSTING_READ(FORCEWAKE); | 381 | POSTING_READ(FORCEWAKE); |
366 | } | 382 | } |
367 | 383 | ||
384 | void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) | ||
385 | { | ||
386 | I915_WRITE_NOTRACE(FORCEWAKE_MT, (1<<16) | 0); | ||
387 | POSTING_READ(FORCEWAKE_MT); | ||
388 | } | ||
389 | |||
368 | /* | 390 | /* |
369 | * see gen6_gt_force_wake_get() | 391 | * see gen6_gt_force_wake_get() |
370 | */ | 392 | */ |
@@ -373,7 +395,7 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) | |||
373 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); | 395 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); |
374 | 396 | ||
375 | if (atomic_dec_and_test(&dev_priv->forcewake_count)) | 397 | if (atomic_dec_and_test(&dev_priv->forcewake_count)) |
376 | __gen6_gt_force_wake_put(dev_priv); | 398 | dev_priv->display.force_wake_put(dev_priv); |
377 | } | 399 | } |
378 | 400 | ||
379 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) | 401 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) |
@@ -903,8 +925,9 @@ MODULE_LICENSE("GPL and additional rights"); | |||
903 | /* We give fast paths for the really cool registers */ | 925 | /* We give fast paths for the really cool registers */ |
904 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ | 926 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
905 | (((dev_priv)->info->gen >= 6) && \ | 927 | (((dev_priv)->info->gen >= 6) && \ |
906 | ((reg) < 0x40000) && \ | 928 | ((reg) < 0x40000) && \ |
907 | ((reg) != FORCEWAKE)) | 929 | ((reg) != FORCEWAKE) && \ |
930 | ((reg) != ECOBUS)) | ||
908 | 931 | ||
909 | #define __i915_read(x, y) \ | 932 | #define __i915_read(x, y) \ |
910 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ | 933 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 4a9c1b979804..554bef7a3b9c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -107,6 +107,7 @@ struct opregion_header; | |||
107 | struct opregion_acpi; | 107 | struct opregion_acpi; |
108 | struct opregion_swsci; | 108 | struct opregion_swsci; |
109 | struct opregion_asle; | 109 | struct opregion_asle; |
110 | struct drm_i915_private; | ||
110 | 111 | ||
111 | struct intel_opregion { | 112 | struct intel_opregion { |
112 | struct opregion_header *header; | 113 | struct opregion_header *header; |
@@ -221,6 +222,8 @@ struct drm_i915_display_funcs { | |||
221 | struct drm_i915_gem_object *obj); | 222 | struct drm_i915_gem_object *obj); |
222 | int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb, | 223 | int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
223 | int x, int y); | 224 | int x, int y); |
225 | void (*force_wake_get)(struct drm_i915_private *dev_priv); | ||
226 | void (*force_wake_put)(struct drm_i915_private *dev_priv); | ||
224 | /* clock updates for mode set */ | 227 | /* clock updates for mode set */ |
225 | /* cursor updates */ | 228 | /* cursor updates */ |
226 | /* render clock increase/decrease */ | 229 | /* render clock increase/decrease */ |
@@ -710,6 +713,7 @@ typedef struct drm_i915_private { | |||
710 | 713 | ||
711 | u64 last_count1; | 714 | u64 last_count1; |
712 | unsigned long last_time1; | 715 | unsigned long last_time1; |
716 | unsigned long chipset_power; | ||
713 | u64 last_count2; | 717 | u64 last_count2; |
714 | struct timespec last_time2; | 718 | struct timespec last_time2; |
715 | unsigned long gfx_power; | 719 | unsigned long gfx_power; |
@@ -998,11 +1002,11 @@ extern int i915_max_ioctl; | |||
998 | extern unsigned int i915_fbpercrtc __always_unused; | 1002 | extern unsigned int i915_fbpercrtc __always_unused; |
999 | extern int i915_panel_ignore_lid __read_mostly; | 1003 | extern int i915_panel_ignore_lid __read_mostly; |
1000 | extern unsigned int i915_powersave __read_mostly; | 1004 | extern unsigned int i915_powersave __read_mostly; |
1001 | extern unsigned int i915_semaphores __read_mostly; | 1005 | extern int i915_semaphores __read_mostly; |
1002 | extern unsigned int i915_lvds_downclock __read_mostly; | 1006 | extern unsigned int i915_lvds_downclock __read_mostly; |
1003 | extern int i915_panel_use_ssc __read_mostly; | 1007 | extern int i915_panel_use_ssc __read_mostly; |
1004 | extern int i915_vbt_sdvo_panel_type __read_mostly; | 1008 | extern int i915_vbt_sdvo_panel_type __read_mostly; |
1005 | extern unsigned int i915_enable_rc6 __read_mostly; | 1009 | extern int i915_enable_rc6 __read_mostly; |
1006 | extern int i915_enable_fbc __read_mostly; | 1010 | extern int i915_enable_fbc __read_mostly; |
1007 | extern bool i915_enable_hangcheck __read_mostly; | 1011 | extern bool i915_enable_hangcheck __read_mostly; |
1008 | 1012 | ||
@@ -1308,6 +1312,11 @@ extern void gen6_set_rps(struct drm_device *dev, u8 val); | |||
1308 | extern void intel_detect_pch(struct drm_device *dev); | 1312 | extern void intel_detect_pch(struct drm_device *dev); |
1309 | extern int intel_trans_dp_port_sel(struct drm_crtc *crtc); | 1313 | extern int intel_trans_dp_port_sel(struct drm_crtc *crtc); |
1310 | 1314 | ||
1315 | extern void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv); | ||
1316 | extern void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv); | ||
1317 | extern void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv); | ||
1318 | extern void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv); | ||
1319 | |||
1311 | /* overlay */ | 1320 | /* overlay */ |
1312 | #ifdef CONFIG_DEBUG_FS | 1321 | #ifdef CONFIG_DEBUG_FS |
1313 | extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev); | 1322 | extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev); |
@@ -1352,8 +1361,9 @@ void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); | |||
1352 | /* We give fast paths for the really cool registers */ | 1361 | /* We give fast paths for the really cool registers */ |
1353 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ | 1362 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
1354 | (((dev_priv)->info->gen >= 6) && \ | 1363 | (((dev_priv)->info->gen >= 6) && \ |
1355 | ((reg) < 0x40000) && \ | 1364 | ((reg) < 0x40000) && \ |
1356 | ((reg) != FORCEWAKE)) | 1365 | ((reg) != FORCEWAKE) && \ |
1366 | ((reg) != ECOBUS)) | ||
1357 | 1367 | ||
1358 | #define __i915_read(x, y) \ | 1368 | #define __i915_read(x, y) \ |
1359 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg); | 1369 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 3693e83a97f3..c681dc149d2a 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "i915_drv.h" | 32 | #include "i915_drv.h" |
33 | #include "i915_trace.h" | 33 | #include "i915_trace.h" |
34 | #include "intel_drv.h" | 34 | #include "intel_drv.h" |
35 | #include <linux/dma_remapping.h> | ||
35 | 36 | ||
36 | struct change_domains { | 37 | struct change_domains { |
37 | uint32_t invalidate_domains; | 38 | uint32_t invalidate_domains; |
@@ -746,6 +747,22 @@ i915_gem_execbuffer_flush(struct drm_device *dev, | |||
746 | return 0; | 747 | return 0; |
747 | } | 748 | } |
748 | 749 | ||
750 | static bool | ||
751 | intel_enable_semaphores(struct drm_device *dev) | ||
752 | { | ||
753 | if (INTEL_INFO(dev)->gen < 6) | ||
754 | return 0; | ||
755 | |||
756 | if (i915_semaphores >= 0) | ||
757 | return i915_semaphores; | ||
758 | |||
759 | /* Enable semaphores on SNB when IO remapping is off */ | ||
760 | if (INTEL_INFO(dev)->gen == 6) | ||
761 | return !intel_iommu_enabled; | ||
762 | |||
763 | return 1; | ||
764 | } | ||
765 | |||
749 | static int | 766 | static int |
750 | i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, | 767 | i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, |
751 | struct intel_ring_buffer *to) | 768 | struct intel_ring_buffer *to) |
@@ -758,7 +775,7 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, | |||
758 | return 0; | 775 | return 0; |
759 | 776 | ||
760 | /* XXX gpu semaphores are implicated in various hard hangs on SNB */ | 777 | /* XXX gpu semaphores are implicated in various hard hangs on SNB */ |
761 | if (INTEL_INFO(obj->base.dev)->gen < 6 || !i915_semaphores) | 778 | if (!intel_enable_semaphores(obj->base.dev)) |
762 | return i915_gem_object_wait_rendering(obj); | 779 | return i915_gem_object_wait_rendering(obj); |
763 | 780 | ||
764 | idx = intel_ring_sync_index(from, to); | 781 | idx = intel_ring_sync_index(from, to); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b080cc824001..a26d5b0a3690 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3303,10 +3303,10 @@ | |||
3303 | /* or SDVOB */ | 3303 | /* or SDVOB */ |
3304 | #define HDMIB 0xe1140 | 3304 | #define HDMIB 0xe1140 |
3305 | #define PORT_ENABLE (1 << 31) | 3305 | #define PORT_ENABLE (1 << 31) |
3306 | #define TRANSCODER_A (0) | 3306 | #define TRANSCODER(pipe) ((pipe) << 30) |
3307 | #define TRANSCODER_B (1 << 30) | 3307 | #define TRANSCODER_CPT(pipe) ((pipe) << 29) |
3308 | #define TRANSCODER(pipe) ((pipe) << 30) | 3308 | #define TRANSCODER_MASK (1 << 30) |
3309 | #define TRANSCODER_MASK (1 << 30) | 3309 | #define TRANSCODER_MASK_CPT (3 << 29) |
3310 | #define COLOR_FORMAT_8bpc (0) | 3310 | #define COLOR_FORMAT_8bpc (0) |
3311 | #define COLOR_FORMAT_12bpc (3 << 26) | 3311 | #define COLOR_FORMAT_12bpc (3 << 26) |
3312 | #define SDVOB_HOTPLUG_ENABLE (1 << 23) | 3312 | #define SDVOB_HOTPLUG_ENABLE (1 << 23) |
@@ -3447,8 +3447,30 @@ | |||
3447 | #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22) | 3447 | #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22) |
3448 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) | 3448 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) |
3449 | 3449 | ||
3450 | /* IVB */ | ||
3451 | #define EDP_LINK_TRAIN_400MV_0DB_IVB (0x24 <<22) | ||
3452 | #define EDP_LINK_TRAIN_400MV_3_5DB_IVB (0x2a <<22) | ||
3453 | #define EDP_LINK_TRAIN_400MV_6DB_IVB (0x2f <<22) | ||
3454 | #define EDP_LINK_TRAIN_600MV_0DB_IVB (0x30 <<22) | ||
3455 | #define EDP_LINK_TRAIN_600MV_3_5DB_IVB (0x36 <<22) | ||
3456 | #define EDP_LINK_TRAIN_800MV_0DB_IVB (0x38 <<22) | ||
3457 | #define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x33 <<22) | ||
3458 | |||
3459 | /* legacy values */ | ||
3460 | #define EDP_LINK_TRAIN_500MV_0DB_IVB (0x00 <<22) | ||
3461 | #define EDP_LINK_TRAIN_1000MV_0DB_IVB (0x20 <<22) | ||
3462 | #define EDP_LINK_TRAIN_500MV_3_5DB_IVB (0x02 <<22) | ||
3463 | #define EDP_LINK_TRAIN_1000MV_3_5DB_IVB (0x22 <<22) | ||
3464 | #define EDP_LINK_TRAIN_1000MV_6DB_IVB (0x23 <<22) | ||
3465 | |||
3466 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_IVB (0x3f<<22) | ||
3467 | |||
3450 | #define FORCEWAKE 0xA18C | 3468 | #define FORCEWAKE 0xA18C |
3451 | #define FORCEWAKE_ACK 0x130090 | 3469 | #define FORCEWAKE_ACK 0x130090 |
3470 | #define FORCEWAKE_MT 0xa188 /* multi-threaded */ | ||
3471 | #define FORCEWAKE_MT_ACK 0x130040 | ||
3472 | #define ECOBUS 0xa180 | ||
3473 | #define FORCEWAKE_MT_ENABLE (1<<5) | ||
3452 | 3474 | ||
3453 | #define GT_FIFO_FREE_ENTRIES 0x120008 | 3475 | #define GT_FIFO_FREE_ENTRIES 0x120008 |
3454 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3476 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e77a863a3833..d809b038ca88 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -38,8 +38,8 @@ | |||
38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
39 | #include "i915_trace.h" | 39 | #include "i915_trace.h" |
40 | #include "drm_dp_helper.h" | 40 | #include "drm_dp_helper.h" |
41 | |||
42 | #include "drm_crtc_helper.h" | 41 | #include "drm_crtc_helper.h" |
42 | #include <linux/dma_remapping.h> | ||
43 | 43 | ||
44 | #define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) | 44 | #define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) |
45 | 45 | ||
@@ -4670,6 +4670,7 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) | |||
4670 | /** | 4670 | /** |
4671 | * intel_choose_pipe_bpp_dither - figure out what color depth the pipe should send | 4671 | * intel_choose_pipe_bpp_dither - figure out what color depth the pipe should send |
4672 | * @crtc: CRTC structure | 4672 | * @crtc: CRTC structure |
4673 | * @mode: requested mode | ||
4673 | * | 4674 | * |
4674 | * A pipe may be connected to one or more outputs. Based on the depth of the | 4675 | * A pipe may be connected to one or more outputs. Based on the depth of the |
4675 | * attached framebuffer, choose a good color depth to use on the pipe. | 4676 | * attached framebuffer, choose a good color depth to use on the pipe. |
@@ -4681,13 +4682,15 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) | |||
4681 | * HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc | 4682 | * HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc |
4682 | * Displays may support a restricted set as well, check EDID and clamp as | 4683 | * Displays may support a restricted set as well, check EDID and clamp as |
4683 | * appropriate. | 4684 | * appropriate. |
4685 | * DP may want to dither down to 6bpc to fit larger modes | ||
4684 | * | 4686 | * |
4685 | * RETURNS: | 4687 | * RETURNS: |
4686 | * Dithering requirement (i.e. false if display bpc and pipe bpc match, | 4688 | * Dithering requirement (i.e. false if display bpc and pipe bpc match, |
4687 | * true if they don't match). | 4689 | * true if they don't match). |
4688 | */ | 4690 | */ |
4689 | static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | 4691 | static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, |
4690 | unsigned int *pipe_bpp) | 4692 | unsigned int *pipe_bpp, |
4693 | struct drm_display_mode *mode) | ||
4691 | { | 4694 | { |
4692 | struct drm_device *dev = crtc->dev; | 4695 | struct drm_device *dev = crtc->dev; |
4693 | struct drm_i915_private *dev_priv = dev->dev_private; | 4696 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -4758,6 +4761,11 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4758 | } | 4761 | } |
4759 | } | 4762 | } |
4760 | 4763 | ||
4764 | if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | ||
4765 | DRM_DEBUG_KMS("Dithering DP to 6bpc\n"); | ||
4766 | display_bpc = 6; | ||
4767 | } | ||
4768 | |||
4761 | /* | 4769 | /* |
4762 | * We could just drive the pipe at the highest bpc all the time and | 4770 | * We could just drive the pipe at the highest bpc all the time and |
4763 | * enable dithering as needed, but that costs bandwidth. So choose | 4771 | * enable dithering as needed, but that costs bandwidth. So choose |
@@ -5019,6 +5027,16 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
5019 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; | 5027 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; |
5020 | } | 5028 | } |
5021 | 5029 | ||
5030 | /* default to 8bpc */ | ||
5031 | pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN); | ||
5032 | if (is_dp) { | ||
5033 | if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | ||
5034 | pipeconf |= PIPECONF_BPP_6 | | ||
5035 | PIPECONF_DITHER_EN | | ||
5036 | PIPECONF_DITHER_TYPE_SP; | ||
5037 | } | ||
5038 | } | ||
5039 | |||
5022 | dpll |= DPLL_VCO_ENABLE; | 5040 | dpll |= DPLL_VCO_ENABLE; |
5023 | 5041 | ||
5024 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); | 5042 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); |
@@ -5480,7 +5498,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5480 | /* determine panel color depth */ | 5498 | /* determine panel color depth */ |
5481 | temp = I915_READ(PIPECONF(pipe)); | 5499 | temp = I915_READ(PIPECONF(pipe)); |
5482 | temp &= ~PIPE_BPC_MASK; | 5500 | temp &= ~PIPE_BPC_MASK; |
5483 | dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp); | 5501 | dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, mode); |
5484 | switch (pipe_bpp) { | 5502 | switch (pipe_bpp) { |
5485 | case 18: | 5503 | case 18: |
5486 | temp |= PIPE_6BPC; | 5504 | temp |= PIPE_6BPC; |
@@ -7189,11 +7207,16 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
7189 | work->old_fb_obj = intel_fb->obj; | 7207 | work->old_fb_obj = intel_fb->obj; |
7190 | INIT_WORK(&work->work, intel_unpin_work_fn); | 7208 | INIT_WORK(&work->work, intel_unpin_work_fn); |
7191 | 7209 | ||
7210 | ret = drm_vblank_get(dev, intel_crtc->pipe); | ||
7211 | if (ret) | ||
7212 | goto free_work; | ||
7213 | |||
7192 | /* We borrow the event spin lock for protecting unpin_work */ | 7214 | /* We borrow the event spin lock for protecting unpin_work */ |
7193 | spin_lock_irqsave(&dev->event_lock, flags); | 7215 | spin_lock_irqsave(&dev->event_lock, flags); |
7194 | if (intel_crtc->unpin_work) { | 7216 | if (intel_crtc->unpin_work) { |
7195 | spin_unlock_irqrestore(&dev->event_lock, flags); | 7217 | spin_unlock_irqrestore(&dev->event_lock, flags); |
7196 | kfree(work); | 7218 | kfree(work); |
7219 | drm_vblank_put(dev, intel_crtc->pipe); | ||
7197 | 7220 | ||
7198 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 7221 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
7199 | return -EBUSY; | 7222 | return -EBUSY; |
@@ -7212,10 +7235,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
7212 | 7235 | ||
7213 | crtc->fb = fb; | 7236 | crtc->fb = fb; |
7214 | 7237 | ||
7215 | ret = drm_vblank_get(dev, intel_crtc->pipe); | ||
7216 | if (ret) | ||
7217 | goto cleanup_objs; | ||
7218 | |||
7219 | work->pending_flip_obj = obj; | 7238 | work->pending_flip_obj = obj; |
7220 | 7239 | ||
7221 | work->enable_stall_check = true; | 7240 | work->enable_stall_check = true; |
@@ -7238,7 +7257,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
7238 | 7257 | ||
7239 | cleanup_pending: | 7258 | cleanup_pending: |
7240 | atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip); | 7259 | atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip); |
7241 | cleanup_objs: | ||
7242 | drm_gem_object_unreference(&work->old_fb_obj->base); | 7260 | drm_gem_object_unreference(&work->old_fb_obj->base); |
7243 | drm_gem_object_unreference(&obj->base); | 7261 | drm_gem_object_unreference(&obj->base); |
7244 | mutex_unlock(&dev->struct_mutex); | 7262 | mutex_unlock(&dev->struct_mutex); |
@@ -7247,6 +7265,8 @@ cleanup_objs: | |||
7247 | intel_crtc->unpin_work = NULL; | 7265 | intel_crtc->unpin_work = NULL; |
7248 | spin_unlock_irqrestore(&dev->event_lock, flags); | 7266 | spin_unlock_irqrestore(&dev->event_lock, flags); |
7249 | 7267 | ||
7268 | drm_vblank_put(dev, intel_crtc->pipe); | ||
7269 | free_work: | ||
7250 | kfree(work); | 7270 | kfree(work); |
7251 | 7271 | ||
7252 | return ret; | 7272 | return ret; |
@@ -7887,6 +7907,33 @@ void intel_init_emon(struct drm_device *dev) | |||
7887 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); | 7907 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); |
7888 | } | 7908 | } |
7889 | 7909 | ||
7910 | static bool intel_enable_rc6(struct drm_device *dev) | ||
7911 | { | ||
7912 | /* | ||
7913 | * Respect the kernel parameter if it is set | ||
7914 | */ | ||
7915 | if (i915_enable_rc6 >= 0) | ||
7916 | return i915_enable_rc6; | ||
7917 | |||
7918 | /* | ||
7919 | * Disable RC6 on Ironlake | ||
7920 | */ | ||
7921 | if (INTEL_INFO(dev)->gen == 5) | ||
7922 | return 0; | ||
7923 | |||
7924 | /* | ||
7925 | * Enable rc6 on Sandybridge if DMA remapping is disabled | ||
7926 | */ | ||
7927 | if (INTEL_INFO(dev)->gen == 6) { | ||
7928 | DRM_DEBUG_DRIVER("Sandybridge: intel_iommu_enabled %s -- RC6 %sabled\n", | ||
7929 | intel_iommu_enabled ? "true" : "false", | ||
7930 | !intel_iommu_enabled ? "en" : "dis"); | ||
7931 | return !intel_iommu_enabled; | ||
7932 | } | ||
7933 | DRM_DEBUG_DRIVER("RC6 enabled\n"); | ||
7934 | return 1; | ||
7935 | } | ||
7936 | |||
7890 | void gen6_enable_rps(struct drm_i915_private *dev_priv) | 7937 | void gen6_enable_rps(struct drm_i915_private *dev_priv) |
7891 | { | 7938 | { |
7892 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); | 7939 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
@@ -7923,7 +7970,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
7923 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); | 7970 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
7924 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ | 7971 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
7925 | 7972 | ||
7926 | if (i915_enable_rc6) | 7973 | if (intel_enable_rc6(dev_priv->dev)) |
7927 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | | 7974 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | |
7928 | GEN6_RC_CTL_RC6_ENABLE; | 7975 | GEN6_RC_CTL_RC6_ENABLE; |
7929 | 7976 | ||
@@ -8372,7 +8419,7 @@ void ironlake_enable_rc6(struct drm_device *dev) | |||
8372 | /* rc6 disabled by default due to repeated reports of hanging during | 8419 | /* rc6 disabled by default due to repeated reports of hanging during |
8373 | * boot and resume. | 8420 | * boot and resume. |
8374 | */ | 8421 | */ |
8375 | if (!i915_enable_rc6) | 8422 | if (!intel_enable_rc6(dev)) |
8376 | return; | 8423 | return; |
8377 | 8424 | ||
8378 | mutex_lock(&dev->struct_mutex); | 8425 | mutex_lock(&dev->struct_mutex); |
@@ -8491,6 +8538,28 @@ static void intel_init_display(struct drm_device *dev) | |||
8491 | 8538 | ||
8492 | /* For FIFO watermark updates */ | 8539 | /* For FIFO watermark updates */ |
8493 | if (HAS_PCH_SPLIT(dev)) { | 8540 | if (HAS_PCH_SPLIT(dev)) { |
8541 | dev_priv->display.force_wake_get = __gen6_gt_force_wake_get; | ||
8542 | dev_priv->display.force_wake_put = __gen6_gt_force_wake_put; | ||
8543 | |||
8544 | /* IVB configs may use multi-threaded forcewake */ | ||
8545 | if (IS_IVYBRIDGE(dev)) { | ||
8546 | u32 ecobus; | ||
8547 | |||
8548 | mutex_lock(&dev->struct_mutex); | ||
8549 | __gen6_gt_force_wake_mt_get(dev_priv); | ||
8550 | ecobus = I915_READ(ECOBUS); | ||
8551 | __gen6_gt_force_wake_mt_put(dev_priv); | ||
8552 | mutex_unlock(&dev->struct_mutex); | ||
8553 | |||
8554 | if (ecobus & FORCEWAKE_MT_ENABLE) { | ||
8555 | DRM_DEBUG_KMS("Using MT version of forcewake\n"); | ||
8556 | dev_priv->display.force_wake_get = | ||
8557 | __gen6_gt_force_wake_mt_get; | ||
8558 | dev_priv->display.force_wake_put = | ||
8559 | __gen6_gt_force_wake_mt_put; | ||
8560 | } | ||
8561 | } | ||
8562 | |||
8494 | if (HAS_PCH_IBX(dev)) | 8563 | if (HAS_PCH_IBX(dev)) |
8495 | dev_priv->display.init_pch_clock_gating = ibx_init_clock_gating; | 8564 | dev_priv->display.init_pch_clock_gating = ibx_init_clock_gating; |
8496 | else if (HAS_PCH_CPT(dev)) | 8565 | else if (HAS_PCH_CPT(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4d0358fad937..92b041b66e49 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -208,13 +208,15 @@ intel_dp_link_clock(uint8_t link_bw) | |||
208 | */ | 208 | */ |
209 | 209 | ||
210 | static int | 210 | static int |
211 | intel_dp_link_required(struct intel_dp *intel_dp, int pixel_clock) | 211 | intel_dp_link_required(struct intel_dp *intel_dp, int pixel_clock, int check_bpp) |
212 | { | 212 | { |
213 | struct drm_crtc *crtc = intel_dp->base.base.crtc; | 213 | struct drm_crtc *crtc = intel_dp->base.base.crtc; |
214 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 214 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
215 | int bpp = 24; | 215 | int bpp = 24; |
216 | 216 | ||
217 | if (intel_crtc) | 217 | if (check_bpp) |
218 | bpp = check_bpp; | ||
219 | else if (intel_crtc) | ||
218 | bpp = intel_crtc->bpp; | 220 | bpp = intel_crtc->bpp; |
219 | 221 | ||
220 | return (pixel_clock * bpp + 9) / 10; | 222 | return (pixel_clock * bpp + 9) / 10; |
@@ -233,6 +235,7 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
233 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 235 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
234 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | 236 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); |
235 | int max_lanes = intel_dp_max_lane_count(intel_dp); | 237 | int max_lanes = intel_dp_max_lane_count(intel_dp); |
238 | int max_rate, mode_rate; | ||
236 | 239 | ||
237 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 240 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
238 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) | 241 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) |
@@ -242,9 +245,17 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
242 | return MODE_PANEL; | 245 | return MODE_PANEL; |
243 | } | 246 | } |
244 | 247 | ||
245 | if (intel_dp_link_required(intel_dp, mode->clock) | 248 | mode_rate = intel_dp_link_required(intel_dp, mode->clock, 0); |
246 | > intel_dp_max_data_rate(max_link_clock, max_lanes)) | 249 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); |
247 | return MODE_CLOCK_HIGH; | 250 | |
251 | if (mode_rate > max_rate) { | ||
252 | mode_rate = intel_dp_link_required(intel_dp, | ||
253 | mode->clock, 18); | ||
254 | if (mode_rate > max_rate) | ||
255 | return MODE_CLOCK_HIGH; | ||
256 | else | ||
257 | mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC; | ||
258 | } | ||
248 | 259 | ||
249 | if (mode->clock < 10000) | 260 | if (mode->clock < 10000) |
250 | return MODE_CLOCK_LOW; | 261 | return MODE_CLOCK_LOW; |
@@ -362,8 +373,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
362 | * clock divider. | 373 | * clock divider. |
363 | */ | 374 | */ |
364 | if (is_cpu_edp(intel_dp)) { | 375 | if (is_cpu_edp(intel_dp)) { |
365 | if (IS_GEN6(dev)) | 376 | if (IS_GEN6(dev) || IS_GEN7(dev)) |
366 | aux_clock_divider = 200; /* SNB eDP input clock at 400Mhz */ | 377 | aux_clock_divider = 200; /* SNB & IVB eDP input clock at 400Mhz */ |
367 | else | 378 | else |
368 | aux_clock_divider = 225; /* eDP input clock at 450Mhz */ | 379 | aux_clock_divider = 225; /* eDP input clock at 450Mhz */ |
369 | } else if (HAS_PCH_SPLIT(dev)) | 380 | } else if (HAS_PCH_SPLIT(dev)) |
@@ -672,6 +683,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
672 | int lane_count, clock; | 683 | int lane_count, clock; |
673 | int max_lane_count = intel_dp_max_lane_count(intel_dp); | 684 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
674 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 685 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
686 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 0; | ||
675 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 687 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
676 | 688 | ||
677 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 689 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
@@ -689,7 +701,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
689 | for (clock = 0; clock <= max_clock; clock++) { | 701 | for (clock = 0; clock <= max_clock; clock++) { |
690 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 702 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
691 | 703 | ||
692 | if (intel_dp_link_required(intel_dp, mode->clock) | 704 | if (intel_dp_link_required(intel_dp, mode->clock, bpp) |
693 | <= link_avail) { | 705 | <= link_avail) { |
694 | intel_dp->link_bw = bws[clock]; | 706 | intel_dp->link_bw = bws[clock]; |
695 | intel_dp->lane_count = lane_count; | 707 | intel_dp->lane_count = lane_count; |
@@ -817,10 +829,11 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
817 | } | 829 | } |
818 | 830 | ||
819 | /* | 831 | /* |
820 | * There are three kinds of DP registers: | 832 | * There are four kinds of DP registers: |
821 | * | 833 | * |
822 | * IBX PCH | 834 | * IBX PCH |
823 | * CPU | 835 | * SNB CPU |
836 | * IVB CPU | ||
824 | * CPT PCH | 837 | * CPT PCH |
825 | * | 838 | * |
826 | * IBX PCH and CPU are the same for almost everything, | 839 | * IBX PCH and CPU are the same for almost everything, |
@@ -873,7 +886,25 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
873 | 886 | ||
874 | /* Split out the IBX/CPU vs CPT settings */ | 887 | /* Split out the IBX/CPU vs CPT settings */ |
875 | 888 | ||
876 | if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { | 889 | if (is_cpu_edp(intel_dp) && IS_GEN7(dev)) { |
890 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | ||
891 | intel_dp->DP |= DP_SYNC_HS_HIGH; | ||
892 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | ||
893 | intel_dp->DP |= DP_SYNC_VS_HIGH; | ||
894 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | ||
895 | |||
896 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) | ||
897 | intel_dp->DP |= DP_ENHANCED_FRAMING; | ||
898 | |||
899 | intel_dp->DP |= intel_crtc->pipe << 29; | ||
900 | |||
901 | /* don't miss out required setting for eDP */ | ||
902 | intel_dp->DP |= DP_PLL_ENABLE; | ||
903 | if (adjusted_mode->clock < 200000) | ||
904 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
905 | else | ||
906 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
907 | } else if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { | ||
877 | intel_dp->DP |= intel_dp->color_range; | 908 | intel_dp->DP |= intel_dp->color_range; |
878 | 909 | ||
879 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 910 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
@@ -1375,34 +1406,59 @@ static char *link_train_names[] = { | |||
1375 | * These are source-specific values; current Intel hardware supports | 1406 | * These are source-specific values; current Intel hardware supports |
1376 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB | 1407 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB |
1377 | */ | 1408 | */ |
1378 | #define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800 | ||
1379 | #define I830_DP_VOLTAGE_MAX_CPT DP_TRAIN_VOLTAGE_SWING_1200 | ||
1380 | 1409 | ||
1381 | static uint8_t | 1410 | static uint8_t |
1382 | intel_dp_pre_emphasis_max(uint8_t voltage_swing) | 1411 | intel_dp_voltage_max(struct intel_dp *intel_dp) |
1383 | { | 1412 | { |
1384 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | 1413 | struct drm_device *dev = intel_dp->base.base.dev; |
1385 | case DP_TRAIN_VOLTAGE_SWING_400: | 1414 | |
1386 | return DP_TRAIN_PRE_EMPHASIS_6; | 1415 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) |
1387 | case DP_TRAIN_VOLTAGE_SWING_600: | 1416 | return DP_TRAIN_VOLTAGE_SWING_800; |
1388 | return DP_TRAIN_PRE_EMPHASIS_6; | 1417 | else if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) |
1389 | case DP_TRAIN_VOLTAGE_SWING_800: | 1418 | return DP_TRAIN_VOLTAGE_SWING_1200; |
1390 | return DP_TRAIN_PRE_EMPHASIS_3_5; | 1419 | else |
1391 | case DP_TRAIN_VOLTAGE_SWING_1200: | 1420 | return DP_TRAIN_VOLTAGE_SWING_800; |
1392 | default: | 1421 | } |
1393 | return DP_TRAIN_PRE_EMPHASIS_0; | 1422 | |
1423 | static uint8_t | ||
1424 | intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing) | ||
1425 | { | ||
1426 | struct drm_device *dev = intel_dp->base.base.dev; | ||
1427 | |||
1428 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { | ||
1429 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | ||
1430 | case DP_TRAIN_VOLTAGE_SWING_400: | ||
1431 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
1432 | case DP_TRAIN_VOLTAGE_SWING_600: | ||
1433 | case DP_TRAIN_VOLTAGE_SWING_800: | ||
1434 | return DP_TRAIN_PRE_EMPHASIS_3_5; | ||
1435 | default: | ||
1436 | return DP_TRAIN_PRE_EMPHASIS_0; | ||
1437 | } | ||
1438 | } else { | ||
1439 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | ||
1440 | case DP_TRAIN_VOLTAGE_SWING_400: | ||
1441 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
1442 | case DP_TRAIN_VOLTAGE_SWING_600: | ||
1443 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
1444 | case DP_TRAIN_VOLTAGE_SWING_800: | ||
1445 | return DP_TRAIN_PRE_EMPHASIS_3_5; | ||
1446 | case DP_TRAIN_VOLTAGE_SWING_1200: | ||
1447 | default: | ||
1448 | return DP_TRAIN_PRE_EMPHASIS_0; | ||
1449 | } | ||
1394 | } | 1450 | } |
1395 | } | 1451 | } |
1396 | 1452 | ||
1397 | static void | 1453 | static void |
1398 | intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) | 1454 | intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) |
1399 | { | 1455 | { |
1400 | struct drm_device *dev = intel_dp->base.base.dev; | ||
1401 | uint8_t v = 0; | 1456 | uint8_t v = 0; |
1402 | uint8_t p = 0; | 1457 | uint8_t p = 0; |
1403 | int lane; | 1458 | int lane; |
1404 | uint8_t *adjust_request = link_status + (DP_ADJUST_REQUEST_LANE0_1 - DP_LANE0_1_STATUS); | 1459 | uint8_t *adjust_request = link_status + (DP_ADJUST_REQUEST_LANE0_1 - DP_LANE0_1_STATUS); |
1405 | int voltage_max; | 1460 | uint8_t voltage_max; |
1461 | uint8_t preemph_max; | ||
1406 | 1462 | ||
1407 | for (lane = 0; lane < intel_dp->lane_count; lane++) { | 1463 | for (lane = 0; lane < intel_dp->lane_count; lane++) { |
1408 | uint8_t this_v = intel_get_adjust_request_voltage(adjust_request, lane); | 1464 | uint8_t this_v = intel_get_adjust_request_voltage(adjust_request, lane); |
@@ -1414,15 +1470,13 @@ intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_ST | |||
1414 | p = this_p; | 1470 | p = this_p; |
1415 | } | 1471 | } |
1416 | 1472 | ||
1417 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1473 | voltage_max = intel_dp_voltage_max(intel_dp); |
1418 | voltage_max = I830_DP_VOLTAGE_MAX_CPT; | ||
1419 | else | ||
1420 | voltage_max = I830_DP_VOLTAGE_MAX; | ||
1421 | if (v >= voltage_max) | 1474 | if (v >= voltage_max) |
1422 | v = voltage_max | DP_TRAIN_MAX_SWING_REACHED; | 1475 | v = voltage_max | DP_TRAIN_MAX_SWING_REACHED; |
1423 | 1476 | ||
1424 | if (p >= intel_dp_pre_emphasis_max(v)) | 1477 | preemph_max = intel_dp_pre_emphasis_max(intel_dp, v); |
1425 | p = intel_dp_pre_emphasis_max(v) | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; | 1478 | if (p >= preemph_max) |
1479 | p = preemph_max | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; | ||
1426 | 1480 | ||
1427 | for (lane = 0; lane < 4; lane++) | 1481 | for (lane = 0; lane < 4; lane++) |
1428 | intel_dp->train_set[lane] = v | p; | 1482 | intel_dp->train_set[lane] = v | p; |
@@ -1494,6 +1548,37 @@ intel_gen6_edp_signal_levels(uint8_t train_set) | |||
1494 | } | 1548 | } |
1495 | } | 1549 | } |
1496 | 1550 | ||
1551 | /* Gen7's DP voltage swing and pre-emphasis control */ | ||
1552 | static uint32_t | ||
1553 | intel_gen7_edp_signal_levels(uint8_t train_set) | ||
1554 | { | ||
1555 | int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK | | ||
1556 | DP_TRAIN_PRE_EMPHASIS_MASK); | ||
1557 | switch (signal_levels) { | ||
1558 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: | ||
1559 | return EDP_LINK_TRAIN_400MV_0DB_IVB; | ||
1560 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
1561 | return EDP_LINK_TRAIN_400MV_3_5DB_IVB; | ||
1562 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: | ||
1563 | return EDP_LINK_TRAIN_400MV_6DB_IVB; | ||
1564 | |||
1565 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0: | ||
1566 | return EDP_LINK_TRAIN_600MV_0DB_IVB; | ||
1567 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
1568 | return EDP_LINK_TRAIN_600MV_3_5DB_IVB; | ||
1569 | |||
1570 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: | ||
1571 | return EDP_LINK_TRAIN_800MV_0DB_IVB; | ||
1572 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
1573 | return EDP_LINK_TRAIN_800MV_3_5DB_IVB; | ||
1574 | |||
1575 | default: | ||
1576 | DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:" | ||
1577 | "0x%x\n", signal_levels); | ||
1578 | return EDP_LINK_TRAIN_500MV_0DB_IVB; | ||
1579 | } | ||
1580 | } | ||
1581 | |||
1497 | static uint8_t | 1582 | static uint8_t |
1498 | intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE], | 1583 | intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE], |
1499 | int lane) | 1584 | int lane) |
@@ -1599,7 +1684,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1599 | DP_LINK_CONFIGURATION_SIZE); | 1684 | DP_LINK_CONFIGURATION_SIZE); |
1600 | 1685 | ||
1601 | DP |= DP_PORT_EN; | 1686 | DP |= DP_PORT_EN; |
1602 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1687 | |
1688 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) | ||
1603 | DP &= ~DP_LINK_TRAIN_MASK_CPT; | 1689 | DP &= ~DP_LINK_TRAIN_MASK_CPT; |
1604 | else | 1690 | else |
1605 | DP &= ~DP_LINK_TRAIN_MASK; | 1691 | DP &= ~DP_LINK_TRAIN_MASK; |
@@ -1613,7 +1699,11 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1613 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | 1699 | uint8_t link_status[DP_LINK_STATUS_SIZE]; |
1614 | uint32_t signal_levels; | 1700 | uint32_t signal_levels; |
1615 | 1701 | ||
1616 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | 1702 | |
1703 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { | ||
1704 | signal_levels = intel_gen7_edp_signal_levels(intel_dp->train_set[0]); | ||
1705 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_IVB) | signal_levels; | ||
1706 | } else if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | ||
1617 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1707 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1618 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1708 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1619 | } else { | 1709 | } else { |
@@ -1622,7 +1712,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1622 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1712 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1623 | } | 1713 | } |
1624 | 1714 | ||
1625 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1715 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
1626 | reg = DP | DP_LINK_TRAIN_PAT_1_CPT; | 1716 | reg = DP | DP_LINK_TRAIN_PAT_1_CPT; |
1627 | else | 1717 | else |
1628 | reg = DP | DP_LINK_TRAIN_PAT_1; | 1718 | reg = DP | DP_LINK_TRAIN_PAT_1; |
@@ -1703,7 +1793,10 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1703 | break; | 1793 | break; |
1704 | } | 1794 | } |
1705 | 1795 | ||
1706 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | 1796 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { |
1797 | signal_levels = intel_gen7_edp_signal_levels(intel_dp->train_set[0]); | ||
1798 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_IVB) | signal_levels; | ||
1799 | } else if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | ||
1707 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1800 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1708 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1801 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1709 | } else { | 1802 | } else { |
@@ -1711,7 +1804,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1711 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1804 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1712 | } | 1805 | } |
1713 | 1806 | ||
1714 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1807 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
1715 | reg = DP | DP_LINK_TRAIN_PAT_2_CPT; | 1808 | reg = DP | DP_LINK_TRAIN_PAT_2_CPT; |
1716 | else | 1809 | else |
1717 | reg = DP | DP_LINK_TRAIN_PAT_2; | 1810 | reg = DP | DP_LINK_TRAIN_PAT_2; |
@@ -1752,7 +1845,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1752 | ++tries; | 1845 | ++tries; |
1753 | } | 1846 | } |
1754 | 1847 | ||
1755 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1848 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
1756 | reg = DP | DP_LINK_TRAIN_OFF_CPT; | 1849 | reg = DP | DP_LINK_TRAIN_OFF_CPT; |
1757 | else | 1850 | else |
1758 | reg = DP | DP_LINK_TRAIN_OFF; | 1851 | reg = DP | DP_LINK_TRAIN_OFF; |
@@ -1782,7 +1875,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1782 | udelay(100); | 1875 | udelay(100); |
1783 | } | 1876 | } |
1784 | 1877 | ||
1785 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) { | 1878 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) { |
1786 | DP &= ~DP_LINK_TRAIN_MASK_CPT; | 1879 | DP &= ~DP_LINK_TRAIN_MASK_CPT; |
1787 | I915_WRITE(intel_dp->output_reg, DP | DP_LINK_TRAIN_PAT_IDLE_CPT); | 1880 | I915_WRITE(intel_dp->output_reg, DP | DP_LINK_TRAIN_PAT_IDLE_CPT); |
1788 | } else { | 1881 | } else { |
@@ -1794,7 +1887,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1794 | msleep(17); | 1887 | msleep(17); |
1795 | 1888 | ||
1796 | if (is_edp(intel_dp)) { | 1889 | if (is_edp(intel_dp)) { |
1797 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1890 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
1798 | DP |= DP_LINK_TRAIN_OFF_CPT; | 1891 | DP |= DP_LINK_TRAIN_OFF_CPT; |
1799 | else | 1892 | else |
1800 | DP |= DP_LINK_TRAIN_OFF; | 1893 | DP |= DP_LINK_TRAIN_OFF; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bd9a604b73da..a1b4343814e8 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -110,6 +110,7 @@ | |||
110 | /* drm_display_mode->private_flags */ | 110 | /* drm_display_mode->private_flags */ |
111 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) | 111 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) |
112 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) | 112 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) |
113 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) | ||
113 | 114 | ||
114 | static inline void | 115 | static inline void |
115 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, | 116 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 42f165a520de..e44191132ac4 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -715,6 +715,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
715 | DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"), | 715 | DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"), |
716 | }, | 716 | }, |
717 | }, | 717 | }, |
718 | { | ||
719 | .callback = intel_no_lvds_dmi_callback, | ||
720 | .ident = "Asus AT5NM10T-I", | ||
721 | .matches = { | ||
722 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
723 | DMI_MATCH(DMI_BOARD_NAME, "AT5NM10T-I"), | ||
724 | }, | ||
725 | }, | ||
718 | 726 | ||
719 | { } /* terminating entry */ | 727 | { } /* terminating entry */ |
720 | }; | 728 | }; |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 21f60b7d69a3..04d79fd1dc9d 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -178,13 +178,10 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev) | |||
178 | if (HAS_PCH_SPLIT(dev)) { | 178 | if (HAS_PCH_SPLIT(dev)) { |
179 | max >>= 16; | 179 | max >>= 16; |
180 | } else { | 180 | } else { |
181 | if (IS_PINEVIEW(dev)) { | 181 | if (INTEL_INFO(dev)->gen < 4) |
182 | max >>= 17; | 182 | max >>= 17; |
183 | } else { | 183 | else |
184 | max >>= 16; | 184 | max >>= 16; |
185 | if (INTEL_INFO(dev)->gen < 4) | ||
186 | max &= ~1; | ||
187 | } | ||
188 | 185 | ||
189 | if (is_backlight_combination_mode(dev)) | 186 | if (is_backlight_combination_mode(dev)) |
190 | max *= 0xff; | 187 | max *= 0xff; |
@@ -203,13 +200,12 @@ u32 intel_panel_get_backlight(struct drm_device *dev) | |||
203 | val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | 200 | val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; |
204 | } else { | 201 | } else { |
205 | val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | 202 | val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; |
206 | if (IS_PINEVIEW(dev)) | 203 | if (INTEL_INFO(dev)->gen < 4) |
207 | val >>= 1; | 204 | val >>= 1; |
208 | 205 | ||
209 | if (is_backlight_combination_mode(dev)) { | 206 | if (is_backlight_combination_mode(dev)) { |
210 | u8 lbpc; | 207 | u8 lbpc; |
211 | 208 | ||
212 | val &= ~1; | ||
213 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); | 209 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); |
214 | val *= lbpc; | 210 | val *= lbpc; |
215 | } | 211 | } |
@@ -246,11 +242,9 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level | |||
246 | } | 242 | } |
247 | 243 | ||
248 | tmp = I915_READ(BLC_PWM_CTL); | 244 | tmp = I915_READ(BLC_PWM_CTL); |
249 | if (IS_PINEVIEW(dev)) { | 245 | if (INTEL_INFO(dev)->gen < 4) |
250 | tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1); | ||
251 | level <<= 1; | 246 | level <<= 1; |
252 | } else | 247 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; |
253 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; | ||
254 | I915_WRITE(BLC_PWM_CTL, tmp | level); | 248 | I915_WRITE(BLC_PWM_CTL, tmp | level); |
255 | } | 249 | } |
256 | 250 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 3003fb25aefd..f7b9268df266 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK) | 50 | #define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK) |
51 | #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) | 51 | #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) |
52 | #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) | 52 | #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) |
53 | #define IS_DIGITAL(c) (c->output_flag & (SDVO_TMDS_MASK | SDVO_LVDS_MASK)) | ||
53 | 54 | ||
54 | 55 | ||
55 | static const char *tv_format_names[] = { | 56 | static const char *tv_format_names[] = { |
@@ -1086,8 +1087,12 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1086 | } | 1087 | } |
1087 | sdvox |= (9 << 19) | SDVO_BORDER_ENABLE; | 1088 | sdvox |= (9 << 19) | SDVO_BORDER_ENABLE; |
1088 | } | 1089 | } |
1089 | if (intel_crtc->pipe == 1) | 1090 | |
1090 | sdvox |= SDVO_PIPE_B_SELECT; | 1091 | if (INTEL_PCH_TYPE(dev) >= PCH_CPT) |
1092 | sdvox |= TRANSCODER_CPT(intel_crtc->pipe); | ||
1093 | else | ||
1094 | sdvox |= TRANSCODER(intel_crtc->pipe); | ||
1095 | |||
1091 | if (intel_sdvo->has_hdmi_audio) | 1096 | if (intel_sdvo->has_hdmi_audio) |
1092 | sdvox |= SDVO_AUDIO_ENABLE; | 1097 | sdvox |= SDVO_AUDIO_ENABLE; |
1093 | 1098 | ||
@@ -1314,6 +1319,18 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector) | |||
1314 | return status; | 1319 | return status; |
1315 | } | 1320 | } |
1316 | 1321 | ||
1322 | static bool | ||
1323 | intel_sdvo_connector_matches_edid(struct intel_sdvo_connector *sdvo, | ||
1324 | struct edid *edid) | ||
1325 | { | ||
1326 | bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); | ||
1327 | bool connector_is_digital = !!IS_DIGITAL(sdvo); | ||
1328 | |||
1329 | DRM_DEBUG_KMS("connector_is_digital? %d, monitor_is_digital? %d\n", | ||
1330 | connector_is_digital, monitor_is_digital); | ||
1331 | return connector_is_digital == monitor_is_digital; | ||
1332 | } | ||
1333 | |||
1317 | static enum drm_connector_status | 1334 | static enum drm_connector_status |
1318 | intel_sdvo_detect(struct drm_connector *connector, bool force) | 1335 | intel_sdvo_detect(struct drm_connector *connector, bool force) |
1319 | { | 1336 | { |
@@ -1358,10 +1375,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) | |||
1358 | if (edid == NULL) | 1375 | if (edid == NULL) |
1359 | edid = intel_sdvo_get_analog_edid(connector); | 1376 | edid = intel_sdvo_get_analog_edid(connector); |
1360 | if (edid != NULL) { | 1377 | if (edid != NULL) { |
1361 | if (edid->input & DRM_EDID_INPUT_DIGITAL) | 1378 | if (intel_sdvo_connector_matches_edid(intel_sdvo_connector, |
1362 | ret = connector_status_disconnected; | 1379 | edid)) |
1363 | else | ||
1364 | ret = connector_status_connected; | 1380 | ret = connector_status_connected; |
1381 | else | ||
1382 | ret = connector_status_disconnected; | ||
1383 | |||
1365 | connector->display_info.raw_edid = NULL; | 1384 | connector->display_info.raw_edid = NULL; |
1366 | kfree(edid); | 1385 | kfree(edid); |
1367 | } else | 1386 | } else |
@@ -1402,11 +1421,8 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) | |||
1402 | edid = intel_sdvo_get_analog_edid(connector); | 1421 | edid = intel_sdvo_get_analog_edid(connector); |
1403 | 1422 | ||
1404 | if (edid != NULL) { | 1423 | if (edid != NULL) { |
1405 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); | 1424 | if (intel_sdvo_connector_matches_edid(to_intel_sdvo_connector(connector), |
1406 | bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); | 1425 | edid)) { |
1407 | bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector); | ||
1408 | |||
1409 | if (connector_is_digital == monitor_is_digital) { | ||
1410 | drm_mode_connector_update_edid_property(connector, edid); | 1426 | drm_mode_connector_update_edid_property(connector, edid); |
1411 | drm_add_edid_modes(connector, edid); | 1427 | drm_add_edid_modes(connector, edid); |
1412 | } | 1428 | } |
diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c index 7a48b1eb4233..5253d23361d9 100644 --- a/drivers/hwmon/jz4740-hwmon.c +++ b/drivers/hwmon/jz4740-hwmon.c | |||
@@ -59,7 +59,7 @@ static ssize_t jz4740_hwmon_read_adcin(struct device *dev, | |||
59 | { | 59 | { |
60 | struct jz4740_hwmon *hwmon = dev_get_drvdata(dev); | 60 | struct jz4740_hwmon *hwmon = dev_get_drvdata(dev); |
61 | struct completion *completion = &hwmon->read_completion; | 61 | struct completion *completion = &hwmon->read_completion; |
62 | unsigned long t; | 62 | long t; |
63 | unsigned long val; | 63 | unsigned long val; |
64 | int ret; | 64 | int ret; |
65 | 65 | ||
@@ -203,7 +203,7 @@ static int __devexit jz4740_hwmon_remove(struct platform_device *pdev) | |||
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | 205 | ||
206 | struct platform_driver jz4740_hwmon_driver = { | 206 | static struct platform_driver jz4740_hwmon_driver = { |
207 | .probe = jz4740_hwmon_probe, | 207 | .probe = jz4740_hwmon_probe, |
208 | .remove = __devexit_p(jz4740_hwmon_remove), | 208 | .remove = __devexit_p(jz4740_hwmon_remove), |
209 | .driver = { | 209 | .driver = { |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a004c3945c67..bdc447fd4766 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -405,6 +405,9 @@ int dmar_disabled = 0; | |||
405 | int dmar_disabled = 1; | 405 | int dmar_disabled = 1; |
406 | #endif /*CONFIG_INTEL_IOMMU_DEFAULT_ON*/ | 406 | #endif /*CONFIG_INTEL_IOMMU_DEFAULT_ON*/ |
407 | 407 | ||
408 | int intel_iommu_enabled = 0; | ||
409 | EXPORT_SYMBOL_GPL(intel_iommu_enabled); | ||
410 | |||
408 | static int dmar_map_gfx = 1; | 411 | static int dmar_map_gfx = 1; |
409 | static int dmar_forcedac; | 412 | static int dmar_forcedac; |
410 | static int intel_iommu_strict; | 413 | static int intel_iommu_strict; |
@@ -3647,6 +3650,8 @@ int __init intel_iommu_init(void) | |||
3647 | 3650 | ||
3648 | bus_register_notifier(&pci_bus_type, &device_nb); | 3651 | bus_register_notifier(&pci_bus_type, &device_nb); |
3649 | 3652 | ||
3653 | intel_iommu_enabled = 1; | ||
3654 | |||
3650 | return 0; | 3655 | return 0; |
3651 | } | 3656 | } |
3652 | 3657 | ||
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index a1cb21f95302..1e0e27cbe987 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -1606,6 +1606,14 @@ static const struct mmc_fixup blk_fixups[] = | |||
1606 | MMC_QUIRK_BLK_NO_CMD23), | 1606 | MMC_QUIRK_BLK_NO_CMD23), |
1607 | MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc, | 1607 | MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc, |
1608 | MMC_QUIRK_BLK_NO_CMD23), | 1608 | MMC_QUIRK_BLK_NO_CMD23), |
1609 | |||
1610 | /* | ||
1611 | * Some Micron MMC cards needs longer data read timeout than | ||
1612 | * indicated in CSD. | ||
1613 | */ | ||
1614 | MMC_FIXUP(CID_NAME_ANY, 0x13, 0x200, add_quirk_mmc, | ||
1615 | MMC_QUIRK_LONG_READ_TIME), | ||
1616 | |||
1609 | END_FIXUP | 1617 | END_FIXUP |
1610 | }; | 1618 | }; |
1611 | 1619 | ||
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5278ffb20e74..950b97d7412a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -529,6 +529,18 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) | |||
529 | data->timeout_clks = 0; | 529 | data->timeout_clks = 0; |
530 | } | 530 | } |
531 | } | 531 | } |
532 | |||
533 | /* | ||
534 | * Some cards require longer data read timeout than indicated in CSD. | ||
535 | * Address this by setting the read timeout to a "reasonably high" | ||
536 | * value. For the cards tested, 300ms has proven enough. If necessary, | ||
537 | * this value can be increased if other problematic cards require this. | ||
538 | */ | ||
539 | if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) { | ||
540 | data->timeout_ns = 300000000; | ||
541 | data->timeout_clks = 0; | ||
542 | } | ||
543 | |||
532 | /* | 544 | /* |
533 | * Some cards need very high timeouts if driven in SPI mode. | 545 | * Some cards need very high timeouts if driven in SPI mode. |
534 | * The worst observed timeout was 900ms after writing a | 546 | * The worst observed timeout was 900ms after writing a |
@@ -1213,6 +1225,46 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) | |||
1213 | mmc_host_clk_release(host); | 1225 | mmc_host_clk_release(host); |
1214 | } | 1226 | } |
1215 | 1227 | ||
1228 | static void mmc_poweroff_notify(struct mmc_host *host) | ||
1229 | { | ||
1230 | struct mmc_card *card; | ||
1231 | unsigned int timeout; | ||
1232 | unsigned int notify_type = EXT_CSD_NO_POWER_NOTIFICATION; | ||
1233 | int err = 0; | ||
1234 | |||
1235 | card = host->card; | ||
1236 | |||
1237 | /* | ||
1238 | * Send power notify command only if card | ||
1239 | * is mmc and notify state is powered ON | ||
1240 | */ | ||
1241 | if (card && mmc_card_mmc(card) && | ||
1242 | (card->poweroff_notify_state == MMC_POWERED_ON)) { | ||
1243 | |||
1244 | if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { | ||
1245 | notify_type = EXT_CSD_POWER_OFF_SHORT; | ||
1246 | timeout = card->ext_csd.generic_cmd6_time; | ||
1247 | card->poweroff_notify_state = MMC_POWEROFF_SHORT; | ||
1248 | } else { | ||
1249 | notify_type = EXT_CSD_POWER_OFF_LONG; | ||
1250 | timeout = card->ext_csd.power_off_longtime; | ||
1251 | card->poweroff_notify_state = MMC_POWEROFF_LONG; | ||
1252 | } | ||
1253 | |||
1254 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1255 | EXT_CSD_POWER_OFF_NOTIFICATION, | ||
1256 | notify_type, timeout); | ||
1257 | |||
1258 | if (err && err != -EBADMSG) | ||
1259 | pr_err("Device failed to respond within %d poweroff " | ||
1260 | "time. Forcefully powering down the device\n", | ||
1261 | timeout); | ||
1262 | |||
1263 | /* Set the card state to no notification after the poweroff */ | ||
1264 | card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; | ||
1265 | } | ||
1266 | } | ||
1267 | |||
1216 | /* | 1268 | /* |
1217 | * Apply power to the MMC stack. This is a two-stage process. | 1269 | * Apply power to the MMC stack. This is a two-stage process. |
1218 | * First, we enable power to the card without the clock running. | 1270 | * First, we enable power to the card without the clock running. |
@@ -1269,42 +1321,12 @@ static void mmc_power_up(struct mmc_host *host) | |||
1269 | 1321 | ||
1270 | void mmc_power_off(struct mmc_host *host) | 1322 | void mmc_power_off(struct mmc_host *host) |
1271 | { | 1323 | { |
1272 | struct mmc_card *card; | ||
1273 | unsigned int notify_type; | ||
1274 | unsigned int timeout; | ||
1275 | int err; | ||
1276 | |||
1277 | mmc_host_clk_hold(host); | 1324 | mmc_host_clk_hold(host); |
1278 | 1325 | ||
1279 | card = host->card; | ||
1280 | host->ios.clock = 0; | 1326 | host->ios.clock = 0; |
1281 | host->ios.vdd = 0; | 1327 | host->ios.vdd = 0; |
1282 | 1328 | ||
1283 | if (card && mmc_card_mmc(card) && | 1329 | mmc_poweroff_notify(host); |
1284 | (card->poweroff_notify_state == MMC_POWERED_ON)) { | ||
1285 | |||
1286 | if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { | ||
1287 | notify_type = EXT_CSD_POWER_OFF_SHORT; | ||
1288 | timeout = card->ext_csd.generic_cmd6_time; | ||
1289 | card->poweroff_notify_state = MMC_POWEROFF_SHORT; | ||
1290 | } else { | ||
1291 | notify_type = EXT_CSD_POWER_OFF_LONG; | ||
1292 | timeout = card->ext_csd.power_off_longtime; | ||
1293 | card->poweroff_notify_state = MMC_POWEROFF_LONG; | ||
1294 | } | ||
1295 | |||
1296 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1297 | EXT_CSD_POWER_OFF_NOTIFICATION, | ||
1298 | notify_type, timeout); | ||
1299 | |||
1300 | if (err && err != -EBADMSG) | ||
1301 | pr_err("Device failed to respond within %d poweroff " | ||
1302 | "time. Forcefully powering down the device\n", | ||
1303 | timeout); | ||
1304 | |||
1305 | /* Set the card state to no notification after the poweroff */ | ||
1306 | card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; | ||
1307 | } | ||
1308 | 1330 | ||
1309 | /* | 1331 | /* |
1310 | * Reset ocr mask to be the highest possible voltage supported for | 1332 | * Reset ocr mask to be the highest possible voltage supported for |
@@ -2196,7 +2218,7 @@ int mmc_card_sleep(struct mmc_host *host) | |||
2196 | 2218 | ||
2197 | mmc_bus_get(host); | 2219 | mmc_bus_get(host); |
2198 | 2220 | ||
2199 | if (host->bus_ops && !host->bus_dead && host->bus_ops->awake) | 2221 | if (host->bus_ops && !host->bus_dead && host->bus_ops->sleep) |
2200 | err = host->bus_ops->sleep(host); | 2222 | err = host->bus_ops->sleep(host); |
2201 | 2223 | ||
2202 | mmc_bus_put(host); | 2224 | mmc_bus_put(host); |
@@ -2302,8 +2324,17 @@ int mmc_suspend_host(struct mmc_host *host) | |||
2302 | * pre-claim the host. | 2324 | * pre-claim the host. |
2303 | */ | 2325 | */ |
2304 | if (mmc_try_claim_host(host)) { | 2326 | if (mmc_try_claim_host(host)) { |
2305 | if (host->bus_ops->suspend) | 2327 | if (host->bus_ops->suspend) { |
2328 | /* | ||
2329 | * For eMMC 4.5 device send notify command | ||
2330 | * before sleep, because in sleep state eMMC 4.5 | ||
2331 | * devices respond to only RESET and AWAKE cmd | ||
2332 | */ | ||
2333 | mmc_poweroff_notify(host); | ||
2306 | err = host->bus_ops->suspend(host); | 2334 | err = host->bus_ops->suspend(host); |
2335 | } | ||
2336 | mmc_do_release_host(host); | ||
2337 | |||
2307 | if (err == -ENOSYS || !host->bus_ops->resume) { | 2338 | if (err == -ENOSYS || !host->bus_ops->resume) { |
2308 | /* | 2339 | /* |
2309 | * We simply "remove" the card in this case. | 2340 | * We simply "remove" the card in this case. |
@@ -2318,7 +2349,6 @@ int mmc_suspend_host(struct mmc_host *host) | |||
2318 | host->pm_flags = 0; | 2349 | host->pm_flags = 0; |
2319 | err = 0; | 2350 | err = 0; |
2320 | } | 2351 | } |
2321 | mmc_do_release_host(host); | ||
2322 | } else { | 2352 | } else { |
2323 | err = -EBUSY; | 2353 | err = -EBUSY; |
2324 | } | 2354 | } |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index dbf421a6279c..d240427c1246 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -876,17 +876,21 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
876 | * set the notification byte in the ext_csd register of device | 876 | * set the notification byte in the ext_csd register of device |
877 | */ | 877 | */ |
878 | if ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) && | 878 | if ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) && |
879 | (card->poweroff_notify_state == MMC_NO_POWER_NOTIFICATION)) { | 879 | (card->ext_csd.rev >= 6)) { |
880 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 880 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
881 | EXT_CSD_POWER_OFF_NOTIFICATION, | 881 | EXT_CSD_POWER_OFF_NOTIFICATION, |
882 | EXT_CSD_POWER_ON, | 882 | EXT_CSD_POWER_ON, |
883 | card->ext_csd.generic_cmd6_time); | 883 | card->ext_csd.generic_cmd6_time); |
884 | if (err && err != -EBADMSG) | 884 | if (err && err != -EBADMSG) |
885 | goto free_card; | 885 | goto free_card; |
886 | } | ||
887 | 886 | ||
888 | if (!err) | 887 | /* |
889 | card->poweroff_notify_state = MMC_POWERED_ON; | 888 | * The err can be -EBADMSG or 0, |
889 | * so check for success and update the flag | ||
890 | */ | ||
891 | if (!err) | ||
892 | card->poweroff_notify_state = MMC_POWERED_ON; | ||
893 | } | ||
890 | 894 | ||
891 | /* | 895 | /* |
892 | * Activate high speed (if supported) | 896 | * Activate high speed (if supported) |
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 325ea61e12d3..8e0fbe994047 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
@@ -732,6 +732,7 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
732 | "failed to config DMA channel. Falling back to PIO\n"); | 732 | "failed to config DMA channel. Falling back to PIO\n"); |
733 | dma_release_channel(host->dma); | 733 | dma_release_channel(host->dma); |
734 | host->do_dma = 0; | 734 | host->do_dma = 0; |
735 | host->dma = NULL; | ||
735 | } | 736 | } |
736 | } | 737 | } |
737 | 738 | ||
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 101cd31c8220..d5fe43d53c51 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -1010,6 +1010,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) | |||
1010 | host->data->sg_len, | 1010 | host->data->sg_len, |
1011 | omap_hsmmc_get_dma_dir(host, host->data)); | 1011 | omap_hsmmc_get_dma_dir(host, host->data)); |
1012 | omap_free_dma(dma_ch); | 1012 | omap_free_dma(dma_ch); |
1013 | host->data->host_cookie = 0; | ||
1013 | } | 1014 | } |
1014 | host->data = NULL; | 1015 | host->data = NULL; |
1015 | } | 1016 | } |
@@ -1575,8 +1576,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, | |||
1575 | struct mmc_data *data = mrq->data; | 1576 | struct mmc_data *data = mrq->data; |
1576 | 1577 | ||
1577 | if (host->use_dma) { | 1578 | if (host->use_dma) { |
1578 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, | 1579 | if (data->host_cookie) |
1579 | omap_hsmmc_get_dma_dir(host, data)); | 1580 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, |
1581 | data->sg_len, | ||
1582 | omap_hsmmc_get_dma_dir(host, data)); | ||
1580 | data->host_cookie = 0; | 1583 | data->host_cookie = 0; |
1581 | } | 1584 | } |
1582 | } | 1585 | } |
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c index 4b920b7621cf..87b6f079b6e0 100644 --- a/drivers/mmc/host/sdhci-cns3xxx.c +++ b/drivers/mmc/host/sdhci-cns3xxx.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/mmc/host.h> | 17 | #include <linux/mmc/host.h> |
18 | #include <linux/module.h> | ||
18 | #include <mach/cns3xxx.h> | 19 | #include <mach/cns3xxx.h> |
19 | #include "sdhci-pltfm.h" | 20 | #include "sdhci-pltfm.h" |
20 | 21 | ||
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 3d00e722efc9..cb60c4197e0a 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -644,8 +644,6 @@ static int sdhci_s3c_resume(struct platform_device *dev) | |||
644 | static struct platform_driver sdhci_s3c_driver = { | 644 | static struct platform_driver sdhci_s3c_driver = { |
645 | .probe = sdhci_s3c_probe, | 645 | .probe = sdhci_s3c_probe, |
646 | .remove = __devexit_p(sdhci_s3c_remove), | 646 | .remove = __devexit_p(sdhci_s3c_remove), |
647 | .suspend = sdhci_s3c_suspend, | ||
648 | .resume = sdhci_s3c_resume, | ||
649 | .driver = { | 647 | .driver = { |
650 | .owner = THIS_MODULE, | 648 | .owner = THIS_MODULE, |
651 | .name = "s3c-sdhci", | 649 | .name = "s3c-sdhci", |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 369366c8e205..d5505f3fe2a1 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -908,7 +908,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
908 | if (host->power) { | 908 | if (host->power) { |
909 | pm_runtime_put(&host->pd->dev); | 909 | pm_runtime_put(&host->pd->dev); |
910 | host->power = false; | 910 | host->power = false; |
911 | if (p->down_pwr) | 911 | if (p->down_pwr && ios->power_mode == MMC_POWER_OFF) |
912 | p->down_pwr(host->pd); | 912 | p->down_pwr(host->pd); |
913 | } | 913 | } |
914 | host->state = STATE_IDLE; | 914 | host->state = STATE_IDLE; |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index d85a60cda167..4208b3958069 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
@@ -798,7 +798,7 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
798 | /* start bus clock */ | 798 | /* start bus clock */ |
799 | tmio_mmc_clk_start(host); | 799 | tmio_mmc_clk_start(host); |
800 | } else if (ios->power_mode != MMC_POWER_UP) { | 800 | } else if (ios->power_mode != MMC_POWER_UP) { |
801 | if (host->set_pwr) | 801 | if (host->set_pwr && ios->power_mode == MMC_POWER_OFF) |
802 | host->set_pwr(host->pdev, 0); | 802 | host->set_pwr(host->pdev, 0); |
803 | if ((pdata->flags & TMIO_MMC_HAS_COLD_CD) && | 803 | if ((pdata->flags & TMIO_MMC_HAS_COLD_CD) && |
804 | pdata->power) { | 804 | pdata->power) { |
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index fb2e89c3056c..5385da2e9cdb 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c | |||
@@ -89,6 +89,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { | |||
89 | {USB_DEVICE(0x0DF6, 0x0045)}, | 89 | {USB_DEVICE(0x0DF6, 0x0045)}, |
90 | {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ | 90 | {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ |
91 | {USB_DEVICE(0x0DF6, 0x004B)}, | 91 | {USB_DEVICE(0x0DF6, 0x004B)}, |
92 | {USB_DEVICE(0x0DF6, 0x005D)}, | ||
92 | {USB_DEVICE(0x0DF6, 0x0063)}, | 93 | {USB_DEVICE(0x0DF6, 0x0063)}, |
93 | /* Sweex */ | 94 | /* Sweex */ |
94 | {USB_DEVICE(0x177F, 0x0154)}, | 95 | {USB_DEVICE(0x177F, 0x0154)}, |
diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c index 3d1279c424a8..7eb56178fb64 100644 --- a/drivers/staging/tidspbridge/core/dsp-clock.c +++ b/drivers/staging/tidspbridge/core/dsp-clock.c | |||
@@ -54,6 +54,7 @@ | |||
54 | 54 | ||
55 | /* Bridge GPT id (1 - 4), DM Timer id (5 - 8) */ | 55 | /* Bridge GPT id (1 - 4), DM Timer id (5 - 8) */ |
56 | #define DMT_ID(id) ((id) + 4) | 56 | #define DMT_ID(id) ((id) + 4) |
57 | #define DM_TIMER_CLOCKS 4 | ||
57 | 58 | ||
58 | /* Bridge MCBSP id (6 - 10), OMAP Mcbsp id (0 - 4) */ | 59 | /* Bridge MCBSP id (6 - 10), OMAP Mcbsp id (0 - 4) */ |
59 | #define MCBSP_ID(id) ((id) - 6) | 60 | #define MCBSP_ID(id) ((id) - 6) |
@@ -114,8 +115,13 @@ static s8 get_clk_type(u8 id) | |||
114 | */ | 115 | */ |
115 | void dsp_clk_exit(void) | 116 | void dsp_clk_exit(void) |
116 | { | 117 | { |
118 | int i; | ||
119 | |||
117 | dsp_clock_disable_all(dsp_clocks); | 120 | dsp_clock_disable_all(dsp_clocks); |
118 | 121 | ||
122 | for (i = 0; i < DM_TIMER_CLOCKS; i++) | ||
123 | omap_dm_timer_free(timer[i]); | ||
124 | |||
119 | clk_put(iva2_clk); | 125 | clk_put(iva2_clk); |
120 | clk_put(ssi.sst_fck); | 126 | clk_put(ssi.sst_fck); |
121 | clk_put(ssi.ssr_fck); | 127 | clk_put(ssi.ssr_fck); |
@@ -130,9 +136,13 @@ void dsp_clk_exit(void) | |||
130 | void dsp_clk_init(void) | 136 | void dsp_clk_init(void) |
131 | { | 137 | { |
132 | static struct platform_device dspbridge_device; | 138 | static struct platform_device dspbridge_device; |
139 | int i, id; | ||
133 | 140 | ||
134 | dspbridge_device.dev.bus = &platform_bus_type; | 141 | dspbridge_device.dev.bus = &platform_bus_type; |
135 | 142 | ||
143 | for (i = 0, id = 5; i < DM_TIMER_CLOCKS; i++, id++) | ||
144 | timer[i] = omap_dm_timer_request_specific(id); | ||
145 | |||
136 | iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck"); | 146 | iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck"); |
137 | if (IS_ERR(iva2_clk)) | 147 | if (IS_ERR(iva2_clk)) |
138 | dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk); | 148 | dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk); |
@@ -204,8 +214,7 @@ int dsp_clk_enable(enum dsp_clk_id clk_id) | |||
204 | clk_enable(iva2_clk); | 214 | clk_enable(iva2_clk); |
205 | break; | 215 | break; |
206 | case GPT_CLK: | 216 | case GPT_CLK: |
207 | timer[clk_id - 1] = | 217 | status = omap_dm_timer_start(timer[clk_id - 1]); |
208 | omap_dm_timer_request_specific(DMT_ID(clk_id)); | ||
209 | break; | 218 | break; |
210 | #ifdef CONFIG_OMAP_MCBSP | 219 | #ifdef CONFIG_OMAP_MCBSP |
211 | case MCBSP_CLK: | 220 | case MCBSP_CLK: |
@@ -281,7 +290,7 @@ int dsp_clk_disable(enum dsp_clk_id clk_id) | |||
281 | clk_disable(iva2_clk); | 290 | clk_disable(iva2_clk); |
282 | break; | 291 | break; |
283 | case GPT_CLK: | 292 | case GPT_CLK: |
284 | omap_dm_timer_free(timer[clk_id - 1]); | 293 | status = omap_dm_timer_stop(timer[clk_id - 1]); |
285 | break; | 294 | break; |
286 | #ifdef CONFIG_OMAP_MCBSP | 295 | #ifdef CONFIG_OMAP_MCBSP |
287 | case MCBSP_CLK: | 296 | case MCBSP_CLK: |
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c index c43c7e3421c8..76cfc6edecd9 100644 --- a/drivers/staging/tidspbridge/rmgr/drv_interface.c +++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c | |||
@@ -24,11 +24,7 @@ | |||
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
27 | |||
28 | #ifdef MODULE | ||
29 | #include <linux/module.h> | 27 | #include <linux/module.h> |
30 | #endif | ||
31 | |||
32 | #include <linux/device.h> | 28 | #include <linux/device.h> |
33 | #include <linux/init.h> | 29 | #include <linux/init.h> |
34 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e8c564a53346..a8078d0638fa 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1458,6 +1458,16 @@ static const struct usb_device_id acm_ids[] = { | |||
1458 | }, | 1458 | }, |
1459 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | 1459 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ |
1460 | }, | 1460 | }, |
1461 | /* Motorola H24 HSPA module: */ | ||
1462 | { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */ | ||
1463 | { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */ | ||
1464 | { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */ | ||
1465 | { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */ | ||
1466 | { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */ | ||
1467 | { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */ | ||
1468 | { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */ | ||
1469 | { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */ | ||
1470 | |||
1461 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ | 1471 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ |
1462 | .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on | 1472 | .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on |
1463 | data interface instead of | 1473 | data interface instead of |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index c39d58860fa0..1a6f415c0d02 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -2975,6 +2975,7 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) | |||
2975 | fsg_common_put(common); | 2975 | fsg_common_put(common); |
2976 | usb_free_descriptors(fsg->function.descriptors); | 2976 | usb_free_descriptors(fsg->function.descriptors); |
2977 | usb_free_descriptors(fsg->function.hs_descriptors); | 2977 | usb_free_descriptors(fsg->function.hs_descriptors); |
2978 | usb_free_descriptors(fsg->function.ss_descriptors); | ||
2978 | kfree(fsg); | 2979 | kfree(fsg); |
2979 | } | 2980 | } |
2980 | 2981 | ||
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 053f86d70009..ad96a3896729 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
@@ -349,7 +349,7 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod) | |||
349 | if (mod->irq_attch) | 349 | if (mod->irq_attch) |
350 | intenb1 |= ATTCHE; | 350 | intenb1 |= ATTCHE; |
351 | 351 | ||
352 | if (mod->irq_attch) | 352 | if (mod->irq_dtch) |
353 | intenb1 |= DTCHE; | 353 | intenb1 |= DTCHE; |
354 | 354 | ||
355 | if (mod->irq_sign) | 355 | if (mod->irq_sign) |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index bade761a1e52..7955de589951 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
@@ -1267,6 +1267,7 @@ int usbhs_mod_host_probe(struct usbhs_priv *priv) | |||
1267 | dev_err(dev, "Failed to create hcd\n"); | 1267 | dev_err(dev, "Failed to create hcd\n"); |
1268 | return -ENOMEM; | 1268 | return -ENOMEM; |
1269 | } | 1269 | } |
1270 | hcd->has_tt = 1; /* for low/full speed */ | ||
1270 | 1271 | ||
1271 | pipe_info = kzalloc(sizeof(*pipe_info) * pipe_size, GFP_KERNEL); | 1272 | pipe_info = kzalloc(sizeof(*pipe_info) * pipe_size, GFP_KERNEL); |
1272 | if (!pipe_info) { | 1273 | if (!pipe_info) { |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e3426602dc82..6dd64534fad0 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -663,7 +663,12 @@ static const struct usb_device_id option_ids[] = { | |||
663 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, | 663 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, |
664 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, | 664 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, |
665 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, | 665 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, |
666 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x08) }, | 666 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x10) }, |
667 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x12) }, | ||
668 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x13) }, | ||
669 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x01) }, /* E398 3G Modem */ | ||
670 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x02) }, /* E398 3G PC UI Interface */ | ||
671 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x03) }, /* E398 3G Application Interface */ | ||
667 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, | 672 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, |
668 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, | 673 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, |
669 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, | 674 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 8e964b91c447..284798aaf8b1 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -166,7 +166,7 @@ retry: | |||
166 | /* | 166 | /* |
167 | * Get IO TLB memory from any location. | 167 | * Get IO TLB memory from any location. |
168 | */ | 168 | */ |
169 | xen_io_tlb_start = alloc_bootmem(bytes); | 169 | xen_io_tlb_start = alloc_bootmem_pages(PAGE_ALIGN(bytes)); |
170 | if (!xen_io_tlb_start) { | 170 | if (!xen_io_tlb_start) { |
171 | m = "Cannot allocate Xen-SWIOTLB buffer!\n"; | 171 | m = "Cannot allocate Xen-SWIOTLB buffer!\n"; |
172 | goto error; | 172 | goto error; |
@@ -179,7 +179,7 @@ retry: | |||
179 | bytes, | 179 | bytes, |
180 | xen_io_tlb_nslabs); | 180 | xen_io_tlb_nslabs); |
181 | if (rc) { | 181 | if (rc) { |
182 | free_bootmem(__pa(xen_io_tlb_start), bytes); | 182 | free_bootmem(__pa(xen_io_tlb_start), PAGE_ALIGN(bytes)); |
183 | m = "Failed to get contiguous memory for DMA from Xen!\n"\ | 183 | m = "Failed to get contiguous memory for DMA from Xen!\n"\ |
184 | "You either: don't have the permissions, do not have"\ | 184 | "You either: don't have the permissions, do not have"\ |
185 | " enough free memory under 4GB, or the hypervisor memory"\ | 185 | " enough free memory under 4GB, or the hypervisor memory"\ |
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 7ec14097fef1..cb97174e2366 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -64,6 +64,8 @@ struct btrfs_worker_thread { | |||
64 | int idle; | 64 | int idle; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static int __btrfs_start_workers(struct btrfs_workers *workers); | ||
68 | |||
67 | /* | 69 | /* |
68 | * btrfs_start_workers uses kthread_run, which can block waiting for memory | 70 | * btrfs_start_workers uses kthread_run, which can block waiting for memory |
69 | * for a very long time. It will actually throttle on page writeback, | 71 | * for a very long time. It will actually throttle on page writeback, |
@@ -88,27 +90,10 @@ static void start_new_worker_func(struct btrfs_work *work) | |||
88 | { | 90 | { |
89 | struct worker_start *start; | 91 | struct worker_start *start; |
90 | start = container_of(work, struct worker_start, work); | 92 | start = container_of(work, struct worker_start, work); |
91 | btrfs_start_workers(start->queue, 1); | 93 | __btrfs_start_workers(start->queue); |
92 | kfree(start); | 94 | kfree(start); |
93 | } | 95 | } |
94 | 96 | ||
95 | static int start_new_worker(struct btrfs_workers *queue) | ||
96 | { | ||
97 | struct worker_start *start; | ||
98 | int ret; | ||
99 | |||
100 | start = kzalloc(sizeof(*start), GFP_NOFS); | ||
101 | if (!start) | ||
102 | return -ENOMEM; | ||
103 | |||
104 | start->work.func = start_new_worker_func; | ||
105 | start->queue = queue; | ||
106 | ret = btrfs_queue_worker(queue->atomic_worker_start, &start->work); | ||
107 | if (ret) | ||
108 | kfree(start); | ||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | /* | 97 | /* |
113 | * helper function to move a thread onto the idle list after it | 98 | * helper function to move a thread onto the idle list after it |
114 | * has finished some requests. | 99 | * has finished some requests. |
@@ -153,12 +138,20 @@ static void check_busy_worker(struct btrfs_worker_thread *worker) | |||
153 | static void check_pending_worker_creates(struct btrfs_worker_thread *worker) | 138 | static void check_pending_worker_creates(struct btrfs_worker_thread *worker) |
154 | { | 139 | { |
155 | struct btrfs_workers *workers = worker->workers; | 140 | struct btrfs_workers *workers = worker->workers; |
141 | struct worker_start *start; | ||
156 | unsigned long flags; | 142 | unsigned long flags; |
157 | 143 | ||
158 | rmb(); | 144 | rmb(); |
159 | if (!workers->atomic_start_pending) | 145 | if (!workers->atomic_start_pending) |
160 | return; | 146 | return; |
161 | 147 | ||
148 | start = kzalloc(sizeof(*start), GFP_NOFS); | ||
149 | if (!start) | ||
150 | return; | ||
151 | |||
152 | start->work.func = start_new_worker_func; | ||
153 | start->queue = workers; | ||
154 | |||
162 | spin_lock_irqsave(&workers->lock, flags); | 155 | spin_lock_irqsave(&workers->lock, flags); |
163 | if (!workers->atomic_start_pending) | 156 | if (!workers->atomic_start_pending) |
164 | goto out; | 157 | goto out; |
@@ -170,10 +163,11 @@ static void check_pending_worker_creates(struct btrfs_worker_thread *worker) | |||
170 | 163 | ||
171 | workers->num_workers_starting += 1; | 164 | workers->num_workers_starting += 1; |
172 | spin_unlock_irqrestore(&workers->lock, flags); | 165 | spin_unlock_irqrestore(&workers->lock, flags); |
173 | start_new_worker(workers); | 166 | btrfs_queue_worker(workers->atomic_worker_start, &start->work); |
174 | return; | 167 | return; |
175 | 168 | ||
176 | out: | 169 | out: |
170 | kfree(start); | ||
177 | spin_unlock_irqrestore(&workers->lock, flags); | 171 | spin_unlock_irqrestore(&workers->lock, flags); |
178 | } | 172 | } |
179 | 173 | ||
@@ -331,7 +325,7 @@ again: | |||
331 | run_ordered_completions(worker->workers, work); | 325 | run_ordered_completions(worker->workers, work); |
332 | 326 | ||
333 | check_pending_worker_creates(worker); | 327 | check_pending_worker_creates(worker); |
334 | 328 | cond_resched(); | |
335 | } | 329 | } |
336 | 330 | ||
337 | spin_lock_irq(&worker->lock); | 331 | spin_lock_irq(&worker->lock); |
@@ -462,56 +456,55 @@ void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max, | |||
462 | * starts new worker threads. This does not enforce the max worker | 456 | * starts new worker threads. This does not enforce the max worker |
463 | * count in case you need to temporarily go past it. | 457 | * count in case you need to temporarily go past it. |
464 | */ | 458 | */ |
465 | static int __btrfs_start_workers(struct btrfs_workers *workers, | 459 | static int __btrfs_start_workers(struct btrfs_workers *workers) |
466 | int num_workers) | ||
467 | { | 460 | { |
468 | struct btrfs_worker_thread *worker; | 461 | struct btrfs_worker_thread *worker; |
469 | int ret = 0; | 462 | int ret = 0; |
470 | int i; | ||
471 | 463 | ||
472 | for (i = 0; i < num_workers; i++) { | 464 | worker = kzalloc(sizeof(*worker), GFP_NOFS); |
473 | worker = kzalloc(sizeof(*worker), GFP_NOFS); | 465 | if (!worker) { |
474 | if (!worker) { | 466 | ret = -ENOMEM; |
475 | ret = -ENOMEM; | 467 | goto fail; |
476 | goto fail; | 468 | } |
477 | } | ||
478 | 469 | ||
479 | INIT_LIST_HEAD(&worker->pending); | 470 | INIT_LIST_HEAD(&worker->pending); |
480 | INIT_LIST_HEAD(&worker->prio_pending); | 471 | INIT_LIST_HEAD(&worker->prio_pending); |
481 | INIT_LIST_HEAD(&worker->worker_list); | 472 | INIT_LIST_HEAD(&worker->worker_list); |
482 | spin_lock_init(&worker->lock); | 473 | spin_lock_init(&worker->lock); |
483 | 474 | ||
484 | atomic_set(&worker->num_pending, 0); | 475 | atomic_set(&worker->num_pending, 0); |
485 | atomic_set(&worker->refs, 1); | 476 | atomic_set(&worker->refs, 1); |
486 | worker->workers = workers; | 477 | worker->workers = workers; |
487 | worker->task = kthread_run(worker_loop, worker, | 478 | worker->task = kthread_run(worker_loop, worker, |
488 | "btrfs-%s-%d", workers->name, | 479 | "btrfs-%s-%d", workers->name, |
489 | workers->num_workers + i); | 480 | workers->num_workers + 1); |
490 | if (IS_ERR(worker->task)) { | 481 | if (IS_ERR(worker->task)) { |
491 | ret = PTR_ERR(worker->task); | 482 | ret = PTR_ERR(worker->task); |
492 | kfree(worker); | 483 | kfree(worker); |
493 | goto fail; | 484 | goto fail; |
494 | } | ||
495 | spin_lock_irq(&workers->lock); | ||
496 | list_add_tail(&worker->worker_list, &workers->idle_list); | ||
497 | worker->idle = 1; | ||
498 | workers->num_workers++; | ||
499 | workers->num_workers_starting--; | ||
500 | WARN_ON(workers->num_workers_starting < 0); | ||
501 | spin_unlock_irq(&workers->lock); | ||
502 | } | 485 | } |
486 | spin_lock_irq(&workers->lock); | ||
487 | list_add_tail(&worker->worker_list, &workers->idle_list); | ||
488 | worker->idle = 1; | ||
489 | workers->num_workers++; | ||
490 | workers->num_workers_starting--; | ||
491 | WARN_ON(workers->num_workers_starting < 0); | ||
492 | spin_unlock_irq(&workers->lock); | ||
493 | |||
503 | return 0; | 494 | return 0; |
504 | fail: | 495 | fail: |
505 | btrfs_stop_workers(workers); | 496 | spin_lock_irq(&workers->lock); |
497 | workers->num_workers_starting--; | ||
498 | spin_unlock_irq(&workers->lock); | ||
506 | return ret; | 499 | return ret; |
507 | } | 500 | } |
508 | 501 | ||
509 | int btrfs_start_workers(struct btrfs_workers *workers, int num_workers) | 502 | int btrfs_start_workers(struct btrfs_workers *workers) |
510 | { | 503 | { |
511 | spin_lock_irq(&workers->lock); | 504 | spin_lock_irq(&workers->lock); |
512 | workers->num_workers_starting += num_workers; | 505 | workers->num_workers_starting++; |
513 | spin_unlock_irq(&workers->lock); | 506 | spin_unlock_irq(&workers->lock); |
514 | return __btrfs_start_workers(workers, num_workers); | 507 | return __btrfs_start_workers(workers); |
515 | } | 508 | } |
516 | 509 | ||
517 | /* | 510 | /* |
@@ -568,6 +561,7 @@ static struct btrfs_worker_thread *find_worker(struct btrfs_workers *workers) | |||
568 | struct btrfs_worker_thread *worker; | 561 | struct btrfs_worker_thread *worker; |
569 | unsigned long flags; | 562 | unsigned long flags; |
570 | struct list_head *fallback; | 563 | struct list_head *fallback; |
564 | int ret; | ||
571 | 565 | ||
572 | again: | 566 | again: |
573 | spin_lock_irqsave(&workers->lock, flags); | 567 | spin_lock_irqsave(&workers->lock, flags); |
@@ -584,7 +578,9 @@ again: | |||
584 | workers->num_workers_starting++; | 578 | workers->num_workers_starting++; |
585 | spin_unlock_irqrestore(&workers->lock, flags); | 579 | spin_unlock_irqrestore(&workers->lock, flags); |
586 | /* we're below the limit, start another worker */ | 580 | /* we're below the limit, start another worker */ |
587 | __btrfs_start_workers(workers, 1); | 581 | ret = __btrfs_start_workers(workers); |
582 | if (ret) | ||
583 | goto fallback; | ||
588 | goto again; | 584 | goto again; |
589 | } | 585 | } |
590 | } | 586 | } |
@@ -665,7 +661,7 @@ void btrfs_set_work_high_prio(struct btrfs_work *work) | |||
665 | /* | 661 | /* |
666 | * places a struct btrfs_work into the pending queue of one of the kthreads | 662 | * places a struct btrfs_work into the pending queue of one of the kthreads |
667 | */ | 663 | */ |
668 | int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | 664 | void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) |
669 | { | 665 | { |
670 | struct btrfs_worker_thread *worker; | 666 | struct btrfs_worker_thread *worker; |
671 | unsigned long flags; | 667 | unsigned long flags; |
@@ -673,7 +669,7 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | |||
673 | 669 | ||
674 | /* don't requeue something already on a list */ | 670 | /* don't requeue something already on a list */ |
675 | if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) | 671 | if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) |
676 | goto out; | 672 | return; |
677 | 673 | ||
678 | worker = find_worker(workers); | 674 | worker = find_worker(workers); |
679 | if (workers->ordered) { | 675 | if (workers->ordered) { |
@@ -712,7 +708,4 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | |||
712 | if (wake) | 708 | if (wake) |
713 | wake_up_process(worker->task); | 709 | wake_up_process(worker->task); |
714 | spin_unlock_irqrestore(&worker->lock, flags); | 710 | spin_unlock_irqrestore(&worker->lock, flags); |
715 | |||
716 | out: | ||
717 | return 0; | ||
718 | } | 711 | } |
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h index 5077746cf85e..f34cc31fa3c9 100644 --- a/fs/btrfs/async-thread.h +++ b/fs/btrfs/async-thread.h | |||
@@ -109,8 +109,8 @@ struct btrfs_workers { | |||
109 | char *name; | 109 | char *name; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work); | 112 | void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work); |
113 | int btrfs_start_workers(struct btrfs_workers *workers, int num_workers); | 113 | int btrfs_start_workers(struct btrfs_workers *workers); |
114 | int btrfs_stop_workers(struct btrfs_workers *workers); | 114 | int btrfs_stop_workers(struct btrfs_workers *workers); |
115 | void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max, | 115 | void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max, |
116 | struct btrfs_workers *async_starter); | 116 | struct btrfs_workers *async_starter); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 50634abef9b4..67385033323d 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2692,7 +2692,8 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | |||
2692 | int btrfs_readpage(struct file *file, struct page *page); | 2692 | int btrfs_readpage(struct file *file, struct page *page); |
2693 | void btrfs_evict_inode(struct inode *inode); | 2693 | void btrfs_evict_inode(struct inode *inode); |
2694 | int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); | 2694 | int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); |
2695 | void btrfs_dirty_inode(struct inode *inode, int flags); | 2695 | int btrfs_dirty_inode(struct inode *inode); |
2696 | int btrfs_update_time(struct file *file); | ||
2696 | struct inode *btrfs_alloc_inode(struct super_block *sb); | 2697 | struct inode *btrfs_alloc_inode(struct super_block *sb); |
2697 | void btrfs_destroy_inode(struct inode *inode); | 2698 | void btrfs_destroy_inode(struct inode *inode); |
2698 | int btrfs_drop_inode(struct inode *inode); | 2699 | int btrfs_drop_inode(struct inode *inode); |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 5b163572e0ca..9c1eccc2c503 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
@@ -640,8 +640,8 @@ static int btrfs_delayed_inode_reserve_metadata( | |||
640 | * Now if src_rsv == delalloc_block_rsv we'll let it just steal since | 640 | * Now if src_rsv == delalloc_block_rsv we'll let it just steal since |
641 | * we're accounted for. | 641 | * we're accounted for. |
642 | */ | 642 | */ |
643 | if (!trans->bytes_reserved && | 643 | if (!src_rsv || (!trans->bytes_reserved && |
644 | src_rsv != &root->fs_info->delalloc_block_rsv) { | 644 | src_rsv != &root->fs_info->delalloc_block_rsv)) { |
645 | ret = btrfs_block_rsv_add_noflush(root, dst_rsv, num_bytes); | 645 | ret = btrfs_block_rsv_add_noflush(root, dst_rsv, num_bytes); |
646 | /* | 646 | /* |
647 | * Since we're under a transaction reserve_metadata_bytes could | 647 | * Since we're under a transaction reserve_metadata_bytes could |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 632f8f3cc9db..f44b3928dc2d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2194,19 +2194,27 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
2194 | fs_info->endio_meta_write_workers.idle_thresh = 2; | 2194 | fs_info->endio_meta_write_workers.idle_thresh = 2; |
2195 | fs_info->readahead_workers.idle_thresh = 2; | 2195 | fs_info->readahead_workers.idle_thresh = 2; |
2196 | 2196 | ||
2197 | btrfs_start_workers(&fs_info->workers, 1); | 2197 | /* |
2198 | btrfs_start_workers(&fs_info->generic_worker, 1); | 2198 | * btrfs_start_workers can really only fail because of ENOMEM so just |
2199 | btrfs_start_workers(&fs_info->submit_workers, 1); | 2199 | * return -ENOMEM if any of these fail. |
2200 | btrfs_start_workers(&fs_info->delalloc_workers, 1); | 2200 | */ |
2201 | btrfs_start_workers(&fs_info->fixup_workers, 1); | 2201 | ret = btrfs_start_workers(&fs_info->workers); |
2202 | btrfs_start_workers(&fs_info->endio_workers, 1); | 2202 | ret |= btrfs_start_workers(&fs_info->generic_worker); |
2203 | btrfs_start_workers(&fs_info->endio_meta_workers, 1); | 2203 | ret |= btrfs_start_workers(&fs_info->submit_workers); |
2204 | btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); | 2204 | ret |= btrfs_start_workers(&fs_info->delalloc_workers); |
2205 | btrfs_start_workers(&fs_info->endio_write_workers, 1); | 2205 | ret |= btrfs_start_workers(&fs_info->fixup_workers); |
2206 | btrfs_start_workers(&fs_info->endio_freespace_worker, 1); | 2206 | ret |= btrfs_start_workers(&fs_info->endio_workers); |
2207 | btrfs_start_workers(&fs_info->delayed_workers, 1); | 2207 | ret |= btrfs_start_workers(&fs_info->endio_meta_workers); |
2208 | btrfs_start_workers(&fs_info->caching_workers, 1); | 2208 | ret |= btrfs_start_workers(&fs_info->endio_meta_write_workers); |
2209 | btrfs_start_workers(&fs_info->readahead_workers, 1); | 2209 | ret |= btrfs_start_workers(&fs_info->endio_write_workers); |
2210 | ret |= btrfs_start_workers(&fs_info->endio_freespace_worker); | ||
2211 | ret |= btrfs_start_workers(&fs_info->delayed_workers); | ||
2212 | ret |= btrfs_start_workers(&fs_info->caching_workers); | ||
2213 | ret |= btrfs_start_workers(&fs_info->readahead_workers); | ||
2214 | if (ret) { | ||
2215 | ret = -ENOMEM; | ||
2216 | goto fail_sb_buffer; | ||
2217 | } | ||
2210 | 2218 | ||
2211 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); | 2219 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); |
2212 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, | 2220 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2ad813674d77..f5fbe576d2ba 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2822,7 +2822,7 @@ out_free: | |||
2822 | btrfs_release_path(path); | 2822 | btrfs_release_path(path); |
2823 | out: | 2823 | out: |
2824 | spin_lock(&block_group->lock); | 2824 | spin_lock(&block_group->lock); |
2825 | if (!ret) | 2825 | if (!ret && dcs == BTRFS_DC_SETUP) |
2826 | block_group->cache_generation = trans->transid; | 2826 | block_group->cache_generation = trans->transid; |
2827 | block_group->disk_cache_state = dcs; | 2827 | block_group->disk_cache_state = dcs; |
2828 | spin_unlock(&block_group->lock); | 2828 | spin_unlock(&block_group->lock); |
@@ -4204,12 +4204,17 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
4204 | struct btrfs_root *root = BTRFS_I(inode)->root; | 4204 | struct btrfs_root *root = BTRFS_I(inode)->root; |
4205 | struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv; | 4205 | struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv; |
4206 | u64 to_reserve = 0; | 4206 | u64 to_reserve = 0; |
4207 | u64 csum_bytes; | ||
4207 | unsigned nr_extents = 0; | 4208 | unsigned nr_extents = 0; |
4209 | int extra_reserve = 0; | ||
4208 | int flush = 1; | 4210 | int flush = 1; |
4209 | int ret; | 4211 | int ret; |
4210 | 4212 | ||
4213 | /* Need to be holding the i_mutex here if we aren't free space cache */ | ||
4211 | if (btrfs_is_free_space_inode(root, inode)) | 4214 | if (btrfs_is_free_space_inode(root, inode)) |
4212 | flush = 0; | 4215 | flush = 0; |
4216 | else | ||
4217 | WARN_ON(!mutex_is_locked(&inode->i_mutex)); | ||
4213 | 4218 | ||
4214 | if (flush && btrfs_transaction_in_commit(root->fs_info)) | 4219 | if (flush && btrfs_transaction_in_commit(root->fs_info)) |
4215 | schedule_timeout(1); | 4220 | schedule_timeout(1); |
@@ -4220,11 +4225,9 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
4220 | BTRFS_I(inode)->outstanding_extents++; | 4225 | BTRFS_I(inode)->outstanding_extents++; |
4221 | 4226 | ||
4222 | if (BTRFS_I(inode)->outstanding_extents > | 4227 | if (BTRFS_I(inode)->outstanding_extents > |
4223 | BTRFS_I(inode)->reserved_extents) { | 4228 | BTRFS_I(inode)->reserved_extents) |
4224 | nr_extents = BTRFS_I(inode)->outstanding_extents - | 4229 | nr_extents = BTRFS_I(inode)->outstanding_extents - |
4225 | BTRFS_I(inode)->reserved_extents; | 4230 | BTRFS_I(inode)->reserved_extents; |
4226 | BTRFS_I(inode)->reserved_extents += nr_extents; | ||
4227 | } | ||
4228 | 4231 | ||
4229 | /* | 4232 | /* |
4230 | * Add an item to reserve for updating the inode when we complete the | 4233 | * Add an item to reserve for updating the inode when we complete the |
@@ -4232,11 +4235,12 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
4232 | */ | 4235 | */ |
4233 | if (!BTRFS_I(inode)->delalloc_meta_reserved) { | 4236 | if (!BTRFS_I(inode)->delalloc_meta_reserved) { |
4234 | nr_extents++; | 4237 | nr_extents++; |
4235 | BTRFS_I(inode)->delalloc_meta_reserved = 1; | 4238 | extra_reserve = 1; |
4236 | } | 4239 | } |
4237 | 4240 | ||
4238 | to_reserve = btrfs_calc_trans_metadata_size(root, nr_extents); | 4241 | to_reserve = btrfs_calc_trans_metadata_size(root, nr_extents); |
4239 | to_reserve += calc_csum_metadata_size(inode, num_bytes, 1); | 4242 | to_reserve += calc_csum_metadata_size(inode, num_bytes, 1); |
4243 | csum_bytes = BTRFS_I(inode)->csum_bytes; | ||
4240 | spin_unlock(&BTRFS_I(inode)->lock); | 4244 | spin_unlock(&BTRFS_I(inode)->lock); |
4241 | 4245 | ||
4242 | ret = reserve_metadata_bytes(root, block_rsv, to_reserve, flush); | 4246 | ret = reserve_metadata_bytes(root, block_rsv, to_reserve, flush); |
@@ -4246,22 +4250,35 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
4246 | 4250 | ||
4247 | spin_lock(&BTRFS_I(inode)->lock); | 4251 | spin_lock(&BTRFS_I(inode)->lock); |
4248 | dropped = drop_outstanding_extent(inode); | 4252 | dropped = drop_outstanding_extent(inode); |
4249 | to_free = calc_csum_metadata_size(inode, num_bytes, 0); | ||
4250 | spin_unlock(&BTRFS_I(inode)->lock); | ||
4251 | to_free += btrfs_calc_trans_metadata_size(root, dropped); | ||
4252 | |||
4253 | /* | 4253 | /* |
4254 | * Somebody could have come in and twiddled with the | 4254 | * If the inodes csum_bytes is the same as the original |
4255 | * reservation, so if we have to free more than we would have | 4255 | * csum_bytes then we know we haven't raced with any free()ers |
4256 | * reserved from this reservation go ahead and release those | 4256 | * so we can just reduce our inodes csum bytes and carry on. |
4257 | * bytes. | 4257 | * Otherwise we have to do the normal free thing to account for |
4258 | * the case that the free side didn't free up its reserve | ||
4259 | * because of this outstanding reservation. | ||
4258 | */ | 4260 | */ |
4259 | to_free -= to_reserve; | 4261 | if (BTRFS_I(inode)->csum_bytes == csum_bytes) |
4262 | calc_csum_metadata_size(inode, num_bytes, 0); | ||
4263 | else | ||
4264 | to_free = calc_csum_metadata_size(inode, num_bytes, 0); | ||
4265 | spin_unlock(&BTRFS_I(inode)->lock); | ||
4266 | if (dropped) | ||
4267 | to_free += btrfs_calc_trans_metadata_size(root, dropped); | ||
4268 | |||
4260 | if (to_free) | 4269 | if (to_free) |
4261 | btrfs_block_rsv_release(root, block_rsv, to_free); | 4270 | btrfs_block_rsv_release(root, block_rsv, to_free); |
4262 | return ret; | 4271 | return ret; |
4263 | } | 4272 | } |
4264 | 4273 | ||
4274 | spin_lock(&BTRFS_I(inode)->lock); | ||
4275 | if (extra_reserve) { | ||
4276 | BTRFS_I(inode)->delalloc_meta_reserved = 1; | ||
4277 | nr_extents--; | ||
4278 | } | ||
4279 | BTRFS_I(inode)->reserved_extents += nr_extents; | ||
4280 | spin_unlock(&BTRFS_I(inode)->lock); | ||
4281 | |||
4265 | block_rsv_add_bytes(block_rsv, to_reserve, 1); | 4282 | block_rsv_add_bytes(block_rsv, to_reserve, 1); |
4266 | 4283 | ||
4267 | return 0; | 4284 | return 0; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 52305a885c3f..97fbe939c050 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1389,7 +1389,11 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1389 | goto out; | 1389 | goto out; |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | file_update_time(file); | 1392 | err = btrfs_update_time(file); |
1393 | if (err) { | ||
1394 | mutex_unlock(&inode->i_mutex); | ||
1395 | goto out; | ||
1396 | } | ||
1393 | BTRFS_I(inode)->sequence++; | 1397 | BTRFS_I(inode)->sequence++; |
1394 | 1398 | ||
1395 | start_pos = round_down(pos, root->sectorsize); | 1399 | start_pos = round_down(pos, root->sectorsize); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2c984f7d4c2a..0a6b928813a4 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/falloc.h> | 38 | #include <linux/falloc.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/ratelimit.h> | 40 | #include <linux/ratelimit.h> |
41 | #include <linux/mount.h> | ||
41 | #include "compat.h" | 42 | #include "compat.h" |
42 | #include "ctree.h" | 43 | #include "ctree.h" |
43 | #include "disk-io.h" | 44 | #include "disk-io.h" |
@@ -2031,7 +2032,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) | |||
2031 | /* insert an orphan item to track this unlinked/truncated file */ | 2032 | /* insert an orphan item to track this unlinked/truncated file */ |
2032 | if (insert >= 1) { | 2033 | if (insert >= 1) { |
2033 | ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); | 2034 | ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); |
2034 | BUG_ON(ret); | 2035 | BUG_ON(ret && ret != -EEXIST); |
2035 | } | 2036 | } |
2036 | 2037 | ||
2037 | /* insert an orphan item to track subvolume contains orphan files */ | 2038 | /* insert an orphan item to track subvolume contains orphan files */ |
@@ -2158,6 +2159,38 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | |||
2158 | if (ret && ret != -ESTALE) | 2159 | if (ret && ret != -ESTALE) |
2159 | goto out; | 2160 | goto out; |
2160 | 2161 | ||
2162 | if (ret == -ESTALE && root == root->fs_info->tree_root) { | ||
2163 | struct btrfs_root *dead_root; | ||
2164 | struct btrfs_fs_info *fs_info = root->fs_info; | ||
2165 | int is_dead_root = 0; | ||
2166 | |||
2167 | /* | ||
2168 | * this is an orphan in the tree root. Currently these | ||
2169 | * could come from 2 sources: | ||
2170 | * a) a snapshot deletion in progress | ||
2171 | * b) a free space cache inode | ||
2172 | * We need to distinguish those two, as the snapshot | ||
2173 | * orphan must not get deleted. | ||
2174 | * find_dead_roots already ran before us, so if this | ||
2175 | * is a snapshot deletion, we should find the root | ||
2176 | * in the dead_roots list | ||
2177 | */ | ||
2178 | spin_lock(&fs_info->trans_lock); | ||
2179 | list_for_each_entry(dead_root, &fs_info->dead_roots, | ||
2180 | root_list) { | ||
2181 | if (dead_root->root_key.objectid == | ||
2182 | found_key.objectid) { | ||
2183 | is_dead_root = 1; | ||
2184 | break; | ||
2185 | } | ||
2186 | } | ||
2187 | spin_unlock(&fs_info->trans_lock); | ||
2188 | if (is_dead_root) { | ||
2189 | /* prevent this orphan from being found again */ | ||
2190 | key.offset = found_key.objectid - 1; | ||
2191 | continue; | ||
2192 | } | ||
2193 | } | ||
2161 | /* | 2194 | /* |
2162 | * Inode is already gone but the orphan item is still there, | 2195 | * Inode is already gone but the orphan item is still there, |
2163 | * kill the orphan item. | 2196 | * kill the orphan item. |
@@ -2191,7 +2224,14 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | |||
2191 | continue; | 2224 | continue; |
2192 | } | 2225 | } |
2193 | nr_truncate++; | 2226 | nr_truncate++; |
2227 | /* | ||
2228 | * Need to hold the imutex for reservation purposes, not | ||
2229 | * a huge deal here but I have a WARN_ON in | ||
2230 | * btrfs_delalloc_reserve_space to catch offenders. | ||
2231 | */ | ||
2232 | mutex_lock(&inode->i_mutex); | ||
2194 | ret = btrfs_truncate(inode); | 2233 | ret = btrfs_truncate(inode); |
2234 | mutex_unlock(&inode->i_mutex); | ||
2195 | } else { | 2235 | } else { |
2196 | nr_unlink++; | 2236 | nr_unlink++; |
2197 | } | 2237 | } |
@@ -3327,7 +3367,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3327 | u64 hint_byte = 0; | 3367 | u64 hint_byte = 0; |
3328 | hole_size = last_byte - cur_offset; | 3368 | hole_size = last_byte - cur_offset; |
3329 | 3369 | ||
3330 | trans = btrfs_start_transaction(root, 2); | 3370 | trans = btrfs_start_transaction(root, 3); |
3331 | if (IS_ERR(trans)) { | 3371 | if (IS_ERR(trans)) { |
3332 | err = PTR_ERR(trans); | 3372 | err = PTR_ERR(trans); |
3333 | break; | 3373 | break; |
@@ -3337,6 +3377,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3337 | cur_offset + hole_size, | 3377 | cur_offset + hole_size, |
3338 | &hint_byte, 1); | 3378 | &hint_byte, 1); |
3339 | if (err) { | 3379 | if (err) { |
3380 | btrfs_update_inode(trans, root, inode); | ||
3340 | btrfs_end_transaction(trans, root); | 3381 | btrfs_end_transaction(trans, root); |
3341 | break; | 3382 | break; |
3342 | } | 3383 | } |
@@ -3346,6 +3387,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3346 | 0, hole_size, 0, hole_size, | 3387 | 0, hole_size, 0, hole_size, |
3347 | 0, 0, 0); | 3388 | 0, 0, 0); |
3348 | if (err) { | 3389 | if (err) { |
3390 | btrfs_update_inode(trans, root, inode); | ||
3349 | btrfs_end_transaction(trans, root); | 3391 | btrfs_end_transaction(trans, root); |
3350 | break; | 3392 | break; |
3351 | } | 3393 | } |
@@ -3353,6 +3395,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3353 | btrfs_drop_extent_cache(inode, hole_start, | 3395 | btrfs_drop_extent_cache(inode, hole_start, |
3354 | last_byte - 1, 0); | 3396 | last_byte - 1, 0); |
3355 | 3397 | ||
3398 | btrfs_update_inode(trans, root, inode); | ||
3356 | btrfs_end_transaction(trans, root); | 3399 | btrfs_end_transaction(trans, root); |
3357 | } | 3400 | } |
3358 | free_extent_map(em); | 3401 | free_extent_map(em); |
@@ -3370,6 +3413,8 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3370 | 3413 | ||
3371 | static int btrfs_setsize(struct inode *inode, loff_t newsize) | 3414 | static int btrfs_setsize(struct inode *inode, loff_t newsize) |
3372 | { | 3415 | { |
3416 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
3417 | struct btrfs_trans_handle *trans; | ||
3373 | loff_t oldsize = i_size_read(inode); | 3418 | loff_t oldsize = i_size_read(inode); |
3374 | int ret; | 3419 | int ret; |
3375 | 3420 | ||
@@ -3377,16 +3422,19 @@ static int btrfs_setsize(struct inode *inode, loff_t newsize) | |||
3377 | return 0; | 3422 | return 0; |
3378 | 3423 | ||
3379 | if (newsize > oldsize) { | 3424 | if (newsize > oldsize) { |
3380 | i_size_write(inode, newsize); | ||
3381 | btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL); | ||
3382 | truncate_pagecache(inode, oldsize, newsize); | 3425 | truncate_pagecache(inode, oldsize, newsize); |
3383 | ret = btrfs_cont_expand(inode, oldsize, newsize); | 3426 | ret = btrfs_cont_expand(inode, oldsize, newsize); |
3384 | if (ret) { | 3427 | if (ret) |
3385 | btrfs_setsize(inode, oldsize); | ||
3386 | return ret; | 3428 | return ret; |
3387 | } | ||
3388 | 3429 | ||
3389 | mark_inode_dirty(inode); | 3430 | trans = btrfs_start_transaction(root, 1); |
3431 | if (IS_ERR(trans)) | ||
3432 | return PTR_ERR(trans); | ||
3433 | |||
3434 | i_size_write(inode, newsize); | ||
3435 | btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL); | ||
3436 | ret = btrfs_update_inode(trans, root, inode); | ||
3437 | btrfs_end_transaction_throttle(trans, root); | ||
3390 | } else { | 3438 | } else { |
3391 | 3439 | ||
3392 | /* | 3440 | /* |
@@ -3426,9 +3474,9 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3426 | 3474 | ||
3427 | if (attr->ia_valid) { | 3475 | if (attr->ia_valid) { |
3428 | setattr_copy(inode, attr); | 3476 | setattr_copy(inode, attr); |
3429 | mark_inode_dirty(inode); | 3477 | err = btrfs_dirty_inode(inode); |
3430 | 3478 | ||
3431 | if (attr->ia_valid & ATTR_MODE) | 3479 | if (!err && attr->ia_valid & ATTR_MODE) |
3432 | err = btrfs_acl_chmod(inode); | 3480 | err = btrfs_acl_chmod(inode); |
3433 | } | 3481 | } |
3434 | 3482 | ||
@@ -4204,42 +4252,80 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
4204 | * FIXME, needs more benchmarking...there are no reasons other than performance | 4252 | * FIXME, needs more benchmarking...there are no reasons other than performance |
4205 | * to keep or drop this code. | 4253 | * to keep or drop this code. |
4206 | */ | 4254 | */ |
4207 | void btrfs_dirty_inode(struct inode *inode, int flags) | 4255 | int btrfs_dirty_inode(struct inode *inode) |
4208 | { | 4256 | { |
4209 | struct btrfs_root *root = BTRFS_I(inode)->root; | 4257 | struct btrfs_root *root = BTRFS_I(inode)->root; |
4210 | struct btrfs_trans_handle *trans; | 4258 | struct btrfs_trans_handle *trans; |
4211 | int ret; | 4259 | int ret; |
4212 | 4260 | ||
4213 | if (BTRFS_I(inode)->dummy_inode) | 4261 | if (BTRFS_I(inode)->dummy_inode) |
4214 | return; | 4262 | return 0; |
4215 | 4263 | ||
4216 | trans = btrfs_join_transaction(root); | 4264 | trans = btrfs_join_transaction(root); |
4217 | BUG_ON(IS_ERR(trans)); | 4265 | if (IS_ERR(trans)) |
4266 | return PTR_ERR(trans); | ||
4218 | 4267 | ||
4219 | ret = btrfs_update_inode(trans, root, inode); | 4268 | ret = btrfs_update_inode(trans, root, inode); |
4220 | if (ret && ret == -ENOSPC) { | 4269 | if (ret && ret == -ENOSPC) { |
4221 | /* whoops, lets try again with the full transaction */ | 4270 | /* whoops, lets try again with the full transaction */ |
4222 | btrfs_end_transaction(trans, root); | 4271 | btrfs_end_transaction(trans, root); |
4223 | trans = btrfs_start_transaction(root, 1); | 4272 | trans = btrfs_start_transaction(root, 1); |
4224 | if (IS_ERR(trans)) { | 4273 | if (IS_ERR(trans)) |
4225 | printk_ratelimited(KERN_ERR "btrfs: fail to " | 4274 | return PTR_ERR(trans); |
4226 | "dirty inode %llu error %ld\n", | ||
4227 | (unsigned long long)btrfs_ino(inode), | ||
4228 | PTR_ERR(trans)); | ||
4229 | return; | ||
4230 | } | ||
4231 | 4275 | ||
4232 | ret = btrfs_update_inode(trans, root, inode); | 4276 | ret = btrfs_update_inode(trans, root, inode); |
4233 | if (ret) { | ||
4234 | printk_ratelimited(KERN_ERR "btrfs: fail to " | ||
4235 | "dirty inode %llu error %d\n", | ||
4236 | (unsigned long long)btrfs_ino(inode), | ||
4237 | ret); | ||
4238 | } | ||
4239 | } | 4277 | } |
4240 | btrfs_end_transaction(trans, root); | 4278 | btrfs_end_transaction(trans, root); |
4241 | if (BTRFS_I(inode)->delayed_node) | 4279 | if (BTRFS_I(inode)->delayed_node) |
4242 | btrfs_balance_delayed_items(root); | 4280 | btrfs_balance_delayed_items(root); |
4281 | |||
4282 | return ret; | ||
4283 | } | ||
4284 | |||
4285 | /* | ||
4286 | * This is a copy of file_update_time. We need this so we can return error on | ||
4287 | * ENOSPC for updating the inode in the case of file write and mmap writes. | ||
4288 | */ | ||
4289 | int btrfs_update_time(struct file *file) | ||
4290 | { | ||
4291 | struct inode *inode = file->f_path.dentry->d_inode; | ||
4292 | struct timespec now; | ||
4293 | int ret; | ||
4294 | enum { S_MTIME = 1, S_CTIME = 2, S_VERSION = 4 } sync_it = 0; | ||
4295 | |||
4296 | /* First try to exhaust all avenues to not sync */ | ||
4297 | if (IS_NOCMTIME(inode)) | ||
4298 | return 0; | ||
4299 | |||
4300 | now = current_fs_time(inode->i_sb); | ||
4301 | if (!timespec_equal(&inode->i_mtime, &now)) | ||
4302 | sync_it = S_MTIME; | ||
4303 | |||
4304 | if (!timespec_equal(&inode->i_ctime, &now)) | ||
4305 | sync_it |= S_CTIME; | ||
4306 | |||
4307 | if (IS_I_VERSION(inode)) | ||
4308 | sync_it |= S_VERSION; | ||
4309 | |||
4310 | if (!sync_it) | ||
4311 | return 0; | ||
4312 | |||
4313 | /* Finally allowed to write? Takes lock. */ | ||
4314 | if (mnt_want_write_file(file)) | ||
4315 | return 0; | ||
4316 | |||
4317 | /* Only change inode inside the lock region */ | ||
4318 | if (sync_it & S_VERSION) | ||
4319 | inode_inc_iversion(inode); | ||
4320 | if (sync_it & S_CTIME) | ||
4321 | inode->i_ctime = now; | ||
4322 | if (sync_it & S_MTIME) | ||
4323 | inode->i_mtime = now; | ||
4324 | ret = btrfs_dirty_inode(inode); | ||
4325 | if (!ret) | ||
4326 | mark_inode_dirty_sync(inode); | ||
4327 | mnt_drop_write(file->f_path.mnt); | ||
4328 | return ret; | ||
4243 | } | 4329 | } |
4244 | 4330 | ||
4245 | /* | 4331 | /* |
@@ -4555,11 +4641,18 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
4555 | goto out_unlock; | 4641 | goto out_unlock; |
4556 | } | 4642 | } |
4557 | 4643 | ||
4644 | /* | ||
4645 | * If the active LSM wants to access the inode during | ||
4646 | * d_instantiate it needs these. Smack checks to see | ||
4647 | * if the filesystem supports xattrs by looking at the | ||
4648 | * ops vector. | ||
4649 | */ | ||
4650 | |||
4651 | inode->i_op = &btrfs_special_inode_operations; | ||
4558 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 4652 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
4559 | if (err) | 4653 | if (err) |
4560 | drop_inode = 1; | 4654 | drop_inode = 1; |
4561 | else { | 4655 | else { |
4562 | inode->i_op = &btrfs_special_inode_operations; | ||
4563 | init_special_inode(inode, inode->i_mode, rdev); | 4656 | init_special_inode(inode, inode->i_mode, rdev); |
4564 | btrfs_update_inode(trans, root, inode); | 4657 | btrfs_update_inode(trans, root, inode); |
4565 | } | 4658 | } |
@@ -4613,14 +4706,21 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
4613 | goto out_unlock; | 4706 | goto out_unlock; |
4614 | } | 4707 | } |
4615 | 4708 | ||
4709 | /* | ||
4710 | * If the active LSM wants to access the inode during | ||
4711 | * d_instantiate it needs these. Smack checks to see | ||
4712 | * if the filesystem supports xattrs by looking at the | ||
4713 | * ops vector. | ||
4714 | */ | ||
4715 | inode->i_fop = &btrfs_file_operations; | ||
4716 | inode->i_op = &btrfs_file_inode_operations; | ||
4717 | |||
4616 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 4718 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
4617 | if (err) | 4719 | if (err) |
4618 | drop_inode = 1; | 4720 | drop_inode = 1; |
4619 | else { | 4721 | else { |
4620 | inode->i_mapping->a_ops = &btrfs_aops; | 4722 | inode->i_mapping->a_ops = &btrfs_aops; |
4621 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 4723 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
4622 | inode->i_fop = &btrfs_file_operations; | ||
4623 | inode->i_op = &btrfs_file_inode_operations; | ||
4624 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 4724 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
4625 | } | 4725 | } |
4626 | out_unlock: | 4726 | out_unlock: |
@@ -6303,7 +6403,12 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
6303 | u64 page_start; | 6403 | u64 page_start; |
6304 | u64 page_end; | 6404 | u64 page_end; |
6305 | 6405 | ||
6406 | /* Need this to keep space reservations serialized */ | ||
6407 | mutex_lock(&inode->i_mutex); | ||
6306 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); | 6408 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); |
6409 | mutex_unlock(&inode->i_mutex); | ||
6410 | if (!ret) | ||
6411 | ret = btrfs_update_time(vma->vm_file); | ||
6307 | if (ret) { | 6412 | if (ret) { |
6308 | if (ret == -ENOMEM) | 6413 | if (ret == -ENOMEM) |
6309 | ret = VM_FAULT_OOM; | 6414 | ret = VM_FAULT_OOM; |
@@ -6515,8 +6620,9 @@ static int btrfs_truncate(struct inode *inode) | |||
6515 | /* Just need the 1 for updating the inode */ | 6620 | /* Just need the 1 for updating the inode */ |
6516 | trans = btrfs_start_transaction(root, 1); | 6621 | trans = btrfs_start_transaction(root, 1); |
6517 | if (IS_ERR(trans)) { | 6622 | if (IS_ERR(trans)) { |
6518 | err = PTR_ERR(trans); | 6623 | ret = err = PTR_ERR(trans); |
6519 | goto out; | 6624 | trans = NULL; |
6625 | break; | ||
6520 | } | 6626 | } |
6521 | } | 6627 | } |
6522 | 6628 | ||
@@ -7076,14 +7182,21 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
7076 | goto out_unlock; | 7182 | goto out_unlock; |
7077 | } | 7183 | } |
7078 | 7184 | ||
7185 | /* | ||
7186 | * If the active LSM wants to access the inode during | ||
7187 | * d_instantiate it needs these. Smack checks to see | ||
7188 | * if the filesystem supports xattrs by looking at the | ||
7189 | * ops vector. | ||
7190 | */ | ||
7191 | inode->i_fop = &btrfs_file_operations; | ||
7192 | inode->i_op = &btrfs_file_inode_operations; | ||
7193 | |||
7079 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 7194 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
7080 | if (err) | 7195 | if (err) |
7081 | drop_inode = 1; | 7196 | drop_inode = 1; |
7082 | else { | 7197 | else { |
7083 | inode->i_mapping->a_ops = &btrfs_aops; | 7198 | inode->i_mapping->a_ops = &btrfs_aops; |
7084 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 7199 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
7085 | inode->i_fop = &btrfs_file_operations; | ||
7086 | inode->i_op = &btrfs_file_inode_operations; | ||
7087 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 7200 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
7088 | } | 7201 | } |
7089 | if (drop_inode) | 7202 | if (drop_inode) |
@@ -7353,6 +7466,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = { | |||
7353 | .follow_link = page_follow_link_light, | 7466 | .follow_link = page_follow_link_light, |
7354 | .put_link = page_put_link, | 7467 | .put_link = page_put_link, |
7355 | .getattr = btrfs_getattr, | 7468 | .getattr = btrfs_getattr, |
7469 | .setattr = btrfs_setattr, | ||
7356 | .permission = btrfs_permission, | 7470 | .permission = btrfs_permission, |
7357 | .setxattr = btrfs_setxattr, | 7471 | .setxattr = btrfs_setxattr, |
7358 | .getxattr = btrfs_getxattr, | 7472 | .getxattr = btrfs_getxattr, |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 72d461656f60..c04f02c7d5bb 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -252,11 +252,11 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
252 | trans = btrfs_join_transaction(root); | 252 | trans = btrfs_join_transaction(root); |
253 | BUG_ON(IS_ERR(trans)); | 253 | BUG_ON(IS_ERR(trans)); |
254 | 254 | ||
255 | btrfs_update_iflags(inode); | ||
256 | inode->i_ctime = CURRENT_TIME; | ||
255 | ret = btrfs_update_inode(trans, root, inode); | 257 | ret = btrfs_update_inode(trans, root, inode); |
256 | BUG_ON(ret); | 258 | BUG_ON(ret); |
257 | 259 | ||
258 | btrfs_update_iflags(inode); | ||
259 | inode->i_ctime = CURRENT_TIME; | ||
260 | btrfs_end_transaction(trans, root); | 260 | btrfs_end_transaction(trans, root); |
261 | 261 | ||
262 | mnt_drop_write(file->f_path.mnt); | 262 | mnt_drop_write(file->f_path.mnt); |
@@ -858,8 +858,10 @@ static int cluster_pages_for_defrag(struct inode *inode, | |||
858 | return 0; | 858 | return 0; |
859 | file_end = (isize - 1) >> PAGE_CACHE_SHIFT; | 859 | file_end = (isize - 1) >> PAGE_CACHE_SHIFT; |
860 | 860 | ||
861 | mutex_lock(&inode->i_mutex); | ||
861 | ret = btrfs_delalloc_reserve_space(inode, | 862 | ret = btrfs_delalloc_reserve_space(inode, |
862 | num_pages << PAGE_CACHE_SHIFT); | 863 | num_pages << PAGE_CACHE_SHIFT); |
864 | mutex_unlock(&inode->i_mutex); | ||
863 | if (ret) | 865 | if (ret) |
864 | return ret; | 866 | return ret; |
865 | again: | 867 | again: |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index dff29d5e151a..cfb55434a469 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -2947,7 +2947,9 @@ static int relocate_file_extent_cluster(struct inode *inode, | |||
2947 | index = (cluster->start - offset) >> PAGE_CACHE_SHIFT; | 2947 | index = (cluster->start - offset) >> PAGE_CACHE_SHIFT; |
2948 | last_index = (cluster->end - offset) >> PAGE_CACHE_SHIFT; | 2948 | last_index = (cluster->end - offset) >> PAGE_CACHE_SHIFT; |
2949 | while (index <= last_index) { | 2949 | while (index <= last_index) { |
2950 | mutex_lock(&inode->i_mutex); | ||
2950 | ret = btrfs_delalloc_reserve_metadata(inode, PAGE_CACHE_SIZE); | 2951 | ret = btrfs_delalloc_reserve_metadata(inode, PAGE_CACHE_SIZE); |
2952 | mutex_unlock(&inode->i_mutex); | ||
2951 | if (ret) | 2953 | if (ret) |
2952 | goto out; | 2954 | goto out; |
2953 | 2955 | ||
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index c27bcb67f330..ddf2c90d3fc0 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -1535,18 +1535,22 @@ static noinline_for_stack int scrub_supers(struct scrub_dev *sdev) | |||
1535 | static noinline_for_stack int scrub_workers_get(struct btrfs_root *root) | 1535 | static noinline_for_stack int scrub_workers_get(struct btrfs_root *root) |
1536 | { | 1536 | { |
1537 | struct btrfs_fs_info *fs_info = root->fs_info; | 1537 | struct btrfs_fs_info *fs_info = root->fs_info; |
1538 | int ret = 0; | ||
1538 | 1539 | ||
1539 | mutex_lock(&fs_info->scrub_lock); | 1540 | mutex_lock(&fs_info->scrub_lock); |
1540 | if (fs_info->scrub_workers_refcnt == 0) { | 1541 | if (fs_info->scrub_workers_refcnt == 0) { |
1541 | btrfs_init_workers(&fs_info->scrub_workers, "scrub", | 1542 | btrfs_init_workers(&fs_info->scrub_workers, "scrub", |
1542 | fs_info->thread_pool_size, &fs_info->generic_worker); | 1543 | fs_info->thread_pool_size, &fs_info->generic_worker); |
1543 | fs_info->scrub_workers.idle_thresh = 4; | 1544 | fs_info->scrub_workers.idle_thresh = 4; |
1544 | btrfs_start_workers(&fs_info->scrub_workers, 1); | 1545 | ret = btrfs_start_workers(&fs_info->scrub_workers); |
1546 | if (ret) | ||
1547 | goto out; | ||
1545 | } | 1548 | } |
1546 | ++fs_info->scrub_workers_refcnt; | 1549 | ++fs_info->scrub_workers_refcnt; |
1550 | out: | ||
1547 | mutex_unlock(&fs_info->scrub_lock); | 1551 | mutex_unlock(&fs_info->scrub_lock); |
1548 | 1552 | ||
1549 | return 0; | 1553 | return ret; |
1550 | } | 1554 | } |
1551 | 1555 | ||
1552 | static noinline_for_stack void scrub_workers_put(struct btrfs_root *root) | 1556 | static noinline_for_stack void scrub_workers_put(struct btrfs_root *root) |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index e28ad4baf483..200f63bc6675 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/cleancache.h> | 42 | #include <linux/cleancache.h> |
43 | #include <linux/mnt_namespace.h> | 43 | #include <linux/mnt_namespace.h> |
44 | #include <linux/ratelimit.h> | ||
44 | #include "compat.h" | 45 | #include "compat.h" |
45 | #include "delayed-inode.h" | 46 | #include "delayed-inode.h" |
46 | #include "ctree.h" | 47 | #include "ctree.h" |
@@ -1053,7 +1054,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
1053 | u64 avail_space; | 1054 | u64 avail_space; |
1054 | u64 used_space; | 1055 | u64 used_space; |
1055 | u64 min_stripe_size; | 1056 | u64 min_stripe_size; |
1056 | int min_stripes = 1; | 1057 | int min_stripes = 1, num_stripes = 1; |
1057 | int i = 0, nr_devices; | 1058 | int i = 0, nr_devices; |
1058 | int ret; | 1059 | int ret; |
1059 | 1060 | ||
@@ -1067,12 +1068,16 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
1067 | 1068 | ||
1068 | /* calc min stripe number for data space alloction */ | 1069 | /* calc min stripe number for data space alloction */ |
1069 | type = btrfs_get_alloc_profile(root, 1); | 1070 | type = btrfs_get_alloc_profile(root, 1); |
1070 | if (type & BTRFS_BLOCK_GROUP_RAID0) | 1071 | if (type & BTRFS_BLOCK_GROUP_RAID0) { |
1071 | min_stripes = 2; | 1072 | min_stripes = 2; |
1072 | else if (type & BTRFS_BLOCK_GROUP_RAID1) | 1073 | num_stripes = nr_devices; |
1074 | } else if (type & BTRFS_BLOCK_GROUP_RAID1) { | ||
1073 | min_stripes = 2; | 1075 | min_stripes = 2; |
1074 | else if (type & BTRFS_BLOCK_GROUP_RAID10) | 1076 | num_stripes = 2; |
1077 | } else if (type & BTRFS_BLOCK_GROUP_RAID10) { | ||
1075 | min_stripes = 4; | 1078 | min_stripes = 4; |
1079 | num_stripes = 4; | ||
1080 | } | ||
1076 | 1081 | ||
1077 | if (type & BTRFS_BLOCK_GROUP_DUP) | 1082 | if (type & BTRFS_BLOCK_GROUP_DUP) |
1078 | min_stripe_size = 2 * BTRFS_STRIPE_LEN; | 1083 | min_stripe_size = 2 * BTRFS_STRIPE_LEN; |
@@ -1141,13 +1146,16 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
1141 | i = nr_devices - 1; | 1146 | i = nr_devices - 1; |
1142 | avail_space = 0; | 1147 | avail_space = 0; |
1143 | while (nr_devices >= min_stripes) { | 1148 | while (nr_devices >= min_stripes) { |
1149 | if (num_stripes > nr_devices) | ||
1150 | num_stripes = nr_devices; | ||
1151 | |||
1144 | if (devices_info[i].max_avail >= min_stripe_size) { | 1152 | if (devices_info[i].max_avail >= min_stripe_size) { |
1145 | int j; | 1153 | int j; |
1146 | u64 alloc_size; | 1154 | u64 alloc_size; |
1147 | 1155 | ||
1148 | avail_space += devices_info[i].max_avail * min_stripes; | 1156 | avail_space += devices_info[i].max_avail * num_stripes; |
1149 | alloc_size = devices_info[i].max_avail; | 1157 | alloc_size = devices_info[i].max_avail; |
1150 | for (j = i + 1 - min_stripes; j <= i; j++) | 1158 | for (j = i + 1 - num_stripes; j <= i; j++) |
1151 | devices_info[j].max_avail -= alloc_size; | 1159 | devices_info[j].max_avail -= alloc_size; |
1152 | } | 1160 | } |
1153 | i--; | 1161 | i--; |
@@ -1264,6 +1272,16 @@ static int btrfs_unfreeze(struct super_block *sb) | |||
1264 | return 0; | 1272 | return 0; |
1265 | } | 1273 | } |
1266 | 1274 | ||
1275 | static void btrfs_fs_dirty_inode(struct inode *inode, int flags) | ||
1276 | { | ||
1277 | int ret; | ||
1278 | |||
1279 | ret = btrfs_dirty_inode(inode); | ||
1280 | if (ret) | ||
1281 | printk_ratelimited(KERN_ERR "btrfs: fail to dirty inode %Lu " | ||
1282 | "error %d\n", btrfs_ino(inode), ret); | ||
1283 | } | ||
1284 | |||
1267 | static const struct super_operations btrfs_super_ops = { | 1285 | static const struct super_operations btrfs_super_ops = { |
1268 | .drop_inode = btrfs_drop_inode, | 1286 | .drop_inode = btrfs_drop_inode, |
1269 | .evict_inode = btrfs_evict_inode, | 1287 | .evict_inode = btrfs_evict_inode, |
@@ -1271,7 +1289,7 @@ static const struct super_operations btrfs_super_ops = { | |||
1271 | .sync_fs = btrfs_sync_fs, | 1289 | .sync_fs = btrfs_sync_fs, |
1272 | .show_options = btrfs_show_options, | 1290 | .show_options = btrfs_show_options, |
1273 | .write_inode = btrfs_write_inode, | 1291 | .write_inode = btrfs_write_inode, |
1274 | .dirty_inode = btrfs_dirty_inode, | 1292 | .dirty_inode = btrfs_fs_dirty_inode, |
1275 | .alloc_inode = btrfs_alloc_inode, | 1293 | .alloc_inode = btrfs_alloc_inode, |
1276 | .destroy_inode = btrfs_destroy_inode, | 1294 | .destroy_inode = btrfs_destroy_inode, |
1277 | .statfs = btrfs_statfs, | 1295 | .statfs = btrfs_statfs, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0a8c8f8304b1..f4b839fd3c9d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -295,6 +295,12 @@ loop_lock: | |||
295 | btrfs_requeue_work(&device->work); | 295 | btrfs_requeue_work(&device->work); |
296 | goto done; | 296 | goto done; |
297 | } | 297 | } |
298 | /* unplug every 64 requests just for good measure */ | ||
299 | if (batch_run % 64 == 0) { | ||
300 | blk_finish_plug(&plug); | ||
301 | blk_start_plug(&plug); | ||
302 | sync_pending = 0; | ||
303 | } | ||
298 | } | 304 | } |
299 | 305 | ||
300 | cond_resched(); | 306 | cond_resched(); |
@@ -3258,7 +3264,7 @@ static void btrfs_end_bio(struct bio *bio, int err) | |||
3258 | */ | 3264 | */ |
3259 | if (atomic_read(&bbio->error) > bbio->max_errors) { | 3265 | if (atomic_read(&bbio->error) > bbio->max_errors) { |
3260 | err = -EIO; | 3266 | err = -EIO; |
3261 | } else if (err) { | 3267 | } else { |
3262 | /* | 3268 | /* |
3263 | * this bio is actually up to date, we didn't | 3269 | * this bio is actually up to date, we didn't |
3264 | * go over the max number of errors | 3270 | * go over the max number of errors |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 4144caf2f9d3..173b1d22e59b 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -87,7 +87,7 @@ static int ceph_set_page_dirty(struct page *page) | |||
87 | snapc = ceph_get_snap_context(ci->i_snap_realm->cached_context); | 87 | snapc = ceph_get_snap_context(ci->i_snap_realm->cached_context); |
88 | 88 | ||
89 | /* dirty the head */ | 89 | /* dirty the head */ |
90 | spin_lock(&inode->i_lock); | 90 | spin_lock(&ci->i_ceph_lock); |
91 | if (ci->i_head_snapc == NULL) | 91 | if (ci->i_head_snapc == NULL) |
92 | ci->i_head_snapc = ceph_get_snap_context(snapc); | 92 | ci->i_head_snapc = ceph_get_snap_context(snapc); |
93 | ++ci->i_wrbuffer_ref_head; | 93 | ++ci->i_wrbuffer_ref_head; |
@@ -100,7 +100,7 @@ static int ceph_set_page_dirty(struct page *page) | |||
100 | ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref_head-1, | 100 | ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref_head-1, |
101 | ci->i_wrbuffer_ref, ci->i_wrbuffer_ref_head, | 101 | ci->i_wrbuffer_ref, ci->i_wrbuffer_ref_head, |
102 | snapc, snapc->seq, snapc->num_snaps); | 102 | snapc, snapc->seq, snapc->num_snaps); |
103 | spin_unlock(&inode->i_lock); | 103 | spin_unlock(&ci->i_ceph_lock); |
104 | 104 | ||
105 | /* now adjust page */ | 105 | /* now adjust page */ |
106 | spin_lock_irq(&mapping->tree_lock); | 106 | spin_lock_irq(&mapping->tree_lock); |
@@ -391,7 +391,7 @@ static struct ceph_snap_context *get_oldest_context(struct inode *inode, | |||
391 | struct ceph_snap_context *snapc = NULL; | 391 | struct ceph_snap_context *snapc = NULL; |
392 | struct ceph_cap_snap *capsnap = NULL; | 392 | struct ceph_cap_snap *capsnap = NULL; |
393 | 393 | ||
394 | spin_lock(&inode->i_lock); | 394 | spin_lock(&ci->i_ceph_lock); |
395 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { | 395 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { |
396 | dout(" cap_snap %p snapc %p has %d dirty pages\n", capsnap, | 396 | dout(" cap_snap %p snapc %p has %d dirty pages\n", capsnap, |
397 | capsnap->context, capsnap->dirty_pages); | 397 | capsnap->context, capsnap->dirty_pages); |
@@ -407,7 +407,7 @@ static struct ceph_snap_context *get_oldest_context(struct inode *inode, | |||
407 | dout(" head snapc %p has %d dirty pages\n", | 407 | dout(" head snapc %p has %d dirty pages\n", |
408 | snapc, ci->i_wrbuffer_ref_head); | 408 | snapc, ci->i_wrbuffer_ref_head); |
409 | } | 409 | } |
410 | spin_unlock(&inode->i_lock); | 410 | spin_unlock(&ci->i_ceph_lock); |
411 | return snapc; | 411 | return snapc; |
412 | } | 412 | } |
413 | 413 | ||
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 0f327c6c9679..8b53193e4f7c 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -309,7 +309,7 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, | |||
309 | /* | 309 | /* |
310 | * Find ceph_cap for given mds, if any. | 310 | * Find ceph_cap for given mds, if any. |
311 | * | 311 | * |
312 | * Called with i_lock held. | 312 | * Called with i_ceph_lock held. |
313 | */ | 313 | */ |
314 | static struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds) | 314 | static struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds) |
315 | { | 315 | { |
@@ -332,9 +332,9 @@ struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci, int mds) | |||
332 | { | 332 | { |
333 | struct ceph_cap *cap; | 333 | struct ceph_cap *cap; |
334 | 334 | ||
335 | spin_lock(&ci->vfs_inode.i_lock); | 335 | spin_lock(&ci->i_ceph_lock); |
336 | cap = __get_cap_for_mds(ci, mds); | 336 | cap = __get_cap_for_mds(ci, mds); |
337 | spin_unlock(&ci->vfs_inode.i_lock); | 337 | spin_unlock(&ci->i_ceph_lock); |
338 | return cap; | 338 | return cap; |
339 | } | 339 | } |
340 | 340 | ||
@@ -361,15 +361,16 @@ static int __ceph_get_cap_mds(struct ceph_inode_info *ci) | |||
361 | 361 | ||
362 | int ceph_get_cap_mds(struct inode *inode) | 362 | int ceph_get_cap_mds(struct inode *inode) |
363 | { | 363 | { |
364 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
364 | int mds; | 365 | int mds; |
365 | spin_lock(&inode->i_lock); | 366 | spin_lock(&ci->i_ceph_lock); |
366 | mds = __ceph_get_cap_mds(ceph_inode(inode)); | 367 | mds = __ceph_get_cap_mds(ceph_inode(inode)); |
367 | spin_unlock(&inode->i_lock); | 368 | spin_unlock(&ci->i_ceph_lock); |
368 | return mds; | 369 | return mds; |
369 | } | 370 | } |
370 | 371 | ||
371 | /* | 372 | /* |
372 | * Called under i_lock. | 373 | * Called under i_ceph_lock. |
373 | */ | 374 | */ |
374 | static void __insert_cap_node(struct ceph_inode_info *ci, | 375 | static void __insert_cap_node(struct ceph_inode_info *ci, |
375 | struct ceph_cap *new) | 376 | struct ceph_cap *new) |
@@ -415,7 +416,7 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc, | |||
415 | * | 416 | * |
416 | * If I_FLUSH is set, leave the inode at the front of the list. | 417 | * If I_FLUSH is set, leave the inode at the front of the list. |
417 | * | 418 | * |
418 | * Caller holds i_lock | 419 | * Caller holds i_ceph_lock |
419 | * -> we take mdsc->cap_delay_lock | 420 | * -> we take mdsc->cap_delay_lock |
420 | */ | 421 | */ |
421 | static void __cap_delay_requeue(struct ceph_mds_client *mdsc, | 422 | static void __cap_delay_requeue(struct ceph_mds_client *mdsc, |
@@ -457,7 +458,7 @@ static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc, | |||
457 | /* | 458 | /* |
458 | * Cancel delayed work on cap. | 459 | * Cancel delayed work on cap. |
459 | * | 460 | * |
460 | * Caller must hold i_lock. | 461 | * Caller must hold i_ceph_lock. |
461 | */ | 462 | */ |
462 | static void __cap_delay_cancel(struct ceph_mds_client *mdsc, | 463 | static void __cap_delay_cancel(struct ceph_mds_client *mdsc, |
463 | struct ceph_inode_info *ci) | 464 | struct ceph_inode_info *ci) |
@@ -532,14 +533,14 @@ int ceph_add_cap(struct inode *inode, | |||
532 | wanted |= ceph_caps_for_mode(fmode); | 533 | wanted |= ceph_caps_for_mode(fmode); |
533 | 534 | ||
534 | retry: | 535 | retry: |
535 | spin_lock(&inode->i_lock); | 536 | spin_lock(&ci->i_ceph_lock); |
536 | cap = __get_cap_for_mds(ci, mds); | 537 | cap = __get_cap_for_mds(ci, mds); |
537 | if (!cap) { | 538 | if (!cap) { |
538 | if (new_cap) { | 539 | if (new_cap) { |
539 | cap = new_cap; | 540 | cap = new_cap; |
540 | new_cap = NULL; | 541 | new_cap = NULL; |
541 | } else { | 542 | } else { |
542 | spin_unlock(&inode->i_lock); | 543 | spin_unlock(&ci->i_ceph_lock); |
543 | new_cap = get_cap(mdsc, caps_reservation); | 544 | new_cap = get_cap(mdsc, caps_reservation); |
544 | if (new_cap == NULL) | 545 | if (new_cap == NULL) |
545 | return -ENOMEM; | 546 | return -ENOMEM; |
@@ -625,7 +626,7 @@ retry: | |||
625 | 626 | ||
626 | if (fmode >= 0) | 627 | if (fmode >= 0) |
627 | __ceph_get_fmode(ci, fmode); | 628 | __ceph_get_fmode(ci, fmode); |
628 | spin_unlock(&inode->i_lock); | 629 | spin_unlock(&ci->i_ceph_lock); |
629 | wake_up_all(&ci->i_cap_wq); | 630 | wake_up_all(&ci->i_cap_wq); |
630 | return 0; | 631 | return 0; |
631 | } | 632 | } |
@@ -792,7 +793,7 @@ int ceph_caps_revoking(struct ceph_inode_info *ci, int mask) | |||
792 | struct rb_node *p; | 793 | struct rb_node *p; |
793 | int ret = 0; | 794 | int ret = 0; |
794 | 795 | ||
795 | spin_lock(&inode->i_lock); | 796 | spin_lock(&ci->i_ceph_lock); |
796 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { | 797 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { |
797 | cap = rb_entry(p, struct ceph_cap, ci_node); | 798 | cap = rb_entry(p, struct ceph_cap, ci_node); |
798 | if (__cap_is_valid(cap) && | 799 | if (__cap_is_valid(cap) && |
@@ -801,7 +802,7 @@ int ceph_caps_revoking(struct ceph_inode_info *ci, int mask) | |||
801 | break; | 802 | break; |
802 | } | 803 | } |
803 | } | 804 | } |
804 | spin_unlock(&inode->i_lock); | 805 | spin_unlock(&ci->i_ceph_lock); |
805 | dout("ceph_caps_revoking %p %s = %d\n", inode, | 806 | dout("ceph_caps_revoking %p %s = %d\n", inode, |
806 | ceph_cap_string(mask), ret); | 807 | ceph_cap_string(mask), ret); |
807 | return ret; | 808 | return ret; |
@@ -855,7 +856,7 @@ int __ceph_caps_mds_wanted(struct ceph_inode_info *ci) | |||
855 | } | 856 | } |
856 | 857 | ||
857 | /* | 858 | /* |
858 | * called under i_lock | 859 | * called under i_ceph_lock |
859 | */ | 860 | */ |
860 | static int __ceph_is_any_caps(struct ceph_inode_info *ci) | 861 | static int __ceph_is_any_caps(struct ceph_inode_info *ci) |
861 | { | 862 | { |
@@ -865,7 +866,7 @@ static int __ceph_is_any_caps(struct ceph_inode_info *ci) | |||
865 | /* | 866 | /* |
866 | * Remove a cap. Take steps to deal with a racing iterate_session_caps. | 867 | * Remove a cap. Take steps to deal with a racing iterate_session_caps. |
867 | * | 868 | * |
868 | * caller should hold i_lock. | 869 | * caller should hold i_ceph_lock. |
869 | * caller will not hold session s_mutex if called from destroy_inode. | 870 | * caller will not hold session s_mutex if called from destroy_inode. |
870 | */ | 871 | */ |
871 | void __ceph_remove_cap(struct ceph_cap *cap) | 872 | void __ceph_remove_cap(struct ceph_cap *cap) |
@@ -1028,7 +1029,7 @@ static void __queue_cap_release(struct ceph_mds_session *session, | |||
1028 | 1029 | ||
1029 | /* | 1030 | /* |
1030 | * Queue cap releases when an inode is dropped from our cache. Since | 1031 | * Queue cap releases when an inode is dropped from our cache. Since |
1031 | * inode is about to be destroyed, there is no need for i_lock. | 1032 | * inode is about to be destroyed, there is no need for i_ceph_lock. |
1032 | */ | 1033 | */ |
1033 | void ceph_queue_caps_release(struct inode *inode) | 1034 | void ceph_queue_caps_release(struct inode *inode) |
1034 | { | 1035 | { |
@@ -1049,7 +1050,7 @@ void ceph_queue_caps_release(struct inode *inode) | |||
1049 | 1050 | ||
1050 | /* | 1051 | /* |
1051 | * Send a cap msg on the given inode. Update our caps state, then | 1052 | * Send a cap msg on the given inode. Update our caps state, then |
1052 | * drop i_lock and send the message. | 1053 | * drop i_ceph_lock and send the message. |
1053 | * | 1054 | * |
1054 | * Make note of max_size reported/requested from mds, revoked caps | 1055 | * Make note of max_size reported/requested from mds, revoked caps |
1055 | * that have now been implemented. | 1056 | * that have now been implemented. |
@@ -1061,13 +1062,13 @@ void ceph_queue_caps_release(struct inode *inode) | |||
1061 | * Return non-zero if delayed release, or we experienced an error | 1062 | * Return non-zero if delayed release, or we experienced an error |
1062 | * such that the caller should requeue + retry later. | 1063 | * such that the caller should requeue + retry later. |
1063 | * | 1064 | * |
1064 | * called with i_lock, then drops it. | 1065 | * called with i_ceph_lock, then drops it. |
1065 | * caller should hold snap_rwsem (read), s_mutex. | 1066 | * caller should hold snap_rwsem (read), s_mutex. |
1066 | */ | 1067 | */ |
1067 | static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | 1068 | static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, |
1068 | int op, int used, int want, int retain, int flushing, | 1069 | int op, int used, int want, int retain, int flushing, |
1069 | unsigned *pflush_tid) | 1070 | unsigned *pflush_tid) |
1070 | __releases(cap->ci->vfs_inode->i_lock) | 1071 | __releases(cap->ci->i_ceph_lock) |
1071 | { | 1072 | { |
1072 | struct ceph_inode_info *ci = cap->ci; | 1073 | struct ceph_inode_info *ci = cap->ci; |
1073 | struct inode *inode = &ci->vfs_inode; | 1074 | struct inode *inode = &ci->vfs_inode; |
@@ -1170,7 +1171,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1170 | xattr_version = ci->i_xattrs.version; | 1171 | xattr_version = ci->i_xattrs.version; |
1171 | } | 1172 | } |
1172 | 1173 | ||
1173 | spin_unlock(&inode->i_lock); | 1174 | spin_unlock(&ci->i_ceph_lock); |
1174 | 1175 | ||
1175 | ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id, | 1176 | ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id, |
1176 | op, keep, want, flushing, seq, flush_tid, issue_seq, mseq, | 1177 | op, keep, want, flushing, seq, flush_tid, issue_seq, mseq, |
@@ -1198,13 +1199,13 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1198 | * Unless @again is true, skip cap_snaps that were already sent to | 1199 | * Unless @again is true, skip cap_snaps that were already sent to |
1199 | * the MDS (i.e., during this session). | 1200 | * the MDS (i.e., during this session). |
1200 | * | 1201 | * |
1201 | * Called under i_lock. Takes s_mutex as needed. | 1202 | * Called under i_ceph_lock. Takes s_mutex as needed. |
1202 | */ | 1203 | */ |
1203 | void __ceph_flush_snaps(struct ceph_inode_info *ci, | 1204 | void __ceph_flush_snaps(struct ceph_inode_info *ci, |
1204 | struct ceph_mds_session **psession, | 1205 | struct ceph_mds_session **psession, |
1205 | int again) | 1206 | int again) |
1206 | __releases(ci->vfs_inode->i_lock) | 1207 | __releases(ci->i_ceph_lock) |
1207 | __acquires(ci->vfs_inode->i_lock) | 1208 | __acquires(ci->i_ceph_lock) |
1208 | { | 1209 | { |
1209 | struct inode *inode = &ci->vfs_inode; | 1210 | struct inode *inode = &ci->vfs_inode; |
1210 | int mds; | 1211 | int mds; |
@@ -1261,7 +1262,7 @@ retry: | |||
1261 | session = NULL; | 1262 | session = NULL; |
1262 | } | 1263 | } |
1263 | if (!session) { | 1264 | if (!session) { |
1264 | spin_unlock(&inode->i_lock); | 1265 | spin_unlock(&ci->i_ceph_lock); |
1265 | mutex_lock(&mdsc->mutex); | 1266 | mutex_lock(&mdsc->mutex); |
1266 | session = __ceph_lookup_mds_session(mdsc, mds); | 1267 | session = __ceph_lookup_mds_session(mdsc, mds); |
1267 | mutex_unlock(&mdsc->mutex); | 1268 | mutex_unlock(&mdsc->mutex); |
@@ -1275,7 +1276,7 @@ retry: | |||
1275 | * deletion or migration. retry, and we'll | 1276 | * deletion or migration. retry, and we'll |
1276 | * get a better @mds value next time. | 1277 | * get a better @mds value next time. |
1277 | */ | 1278 | */ |
1278 | spin_lock(&inode->i_lock); | 1279 | spin_lock(&ci->i_ceph_lock); |
1279 | goto retry; | 1280 | goto retry; |
1280 | } | 1281 | } |
1281 | 1282 | ||
@@ -1285,7 +1286,7 @@ retry: | |||
1285 | list_del_init(&capsnap->flushing_item); | 1286 | list_del_init(&capsnap->flushing_item); |
1286 | list_add_tail(&capsnap->flushing_item, | 1287 | list_add_tail(&capsnap->flushing_item, |
1287 | &session->s_cap_snaps_flushing); | 1288 | &session->s_cap_snaps_flushing); |
1288 | spin_unlock(&inode->i_lock); | 1289 | spin_unlock(&ci->i_ceph_lock); |
1289 | 1290 | ||
1290 | dout("flush_snaps %p cap_snap %p follows %lld tid %llu\n", | 1291 | dout("flush_snaps %p cap_snap %p follows %lld tid %llu\n", |
1291 | inode, capsnap, capsnap->follows, capsnap->flush_tid); | 1292 | inode, capsnap, capsnap->follows, capsnap->flush_tid); |
@@ -1302,7 +1303,7 @@ retry: | |||
1302 | next_follows = capsnap->follows + 1; | 1303 | next_follows = capsnap->follows + 1; |
1303 | ceph_put_cap_snap(capsnap); | 1304 | ceph_put_cap_snap(capsnap); |
1304 | 1305 | ||
1305 | spin_lock(&inode->i_lock); | 1306 | spin_lock(&ci->i_ceph_lock); |
1306 | goto retry; | 1307 | goto retry; |
1307 | } | 1308 | } |
1308 | 1309 | ||
@@ -1322,11 +1323,9 @@ out: | |||
1322 | 1323 | ||
1323 | static void ceph_flush_snaps(struct ceph_inode_info *ci) | 1324 | static void ceph_flush_snaps(struct ceph_inode_info *ci) |
1324 | { | 1325 | { |
1325 | struct inode *inode = &ci->vfs_inode; | 1326 | spin_lock(&ci->i_ceph_lock); |
1326 | |||
1327 | spin_lock(&inode->i_lock); | ||
1328 | __ceph_flush_snaps(ci, NULL, 0); | 1327 | __ceph_flush_snaps(ci, NULL, 0); |
1329 | spin_unlock(&inode->i_lock); | 1328 | spin_unlock(&ci->i_ceph_lock); |
1330 | } | 1329 | } |
1331 | 1330 | ||
1332 | /* | 1331 | /* |
@@ -1373,7 +1372,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) | |||
1373 | * Add dirty inode to the flushing list. Assigned a seq number so we | 1372 | * Add dirty inode to the flushing list. Assigned a seq number so we |
1374 | * can wait for caps to flush without starving. | 1373 | * can wait for caps to flush without starving. |
1375 | * | 1374 | * |
1376 | * Called under i_lock. | 1375 | * Called under i_ceph_lock. |
1377 | */ | 1376 | */ |
1378 | static int __mark_caps_flushing(struct inode *inode, | 1377 | static int __mark_caps_flushing(struct inode *inode, |
1379 | struct ceph_mds_session *session) | 1378 | struct ceph_mds_session *session) |
@@ -1421,9 +1420,9 @@ static int try_nonblocking_invalidate(struct inode *inode) | |||
1421 | struct ceph_inode_info *ci = ceph_inode(inode); | 1420 | struct ceph_inode_info *ci = ceph_inode(inode); |
1422 | u32 invalidating_gen = ci->i_rdcache_gen; | 1421 | u32 invalidating_gen = ci->i_rdcache_gen; |
1423 | 1422 | ||
1424 | spin_unlock(&inode->i_lock); | 1423 | spin_unlock(&ci->i_ceph_lock); |
1425 | invalidate_mapping_pages(&inode->i_data, 0, -1); | 1424 | invalidate_mapping_pages(&inode->i_data, 0, -1); |
1426 | spin_lock(&inode->i_lock); | 1425 | spin_lock(&ci->i_ceph_lock); |
1427 | 1426 | ||
1428 | if (inode->i_data.nrpages == 0 && | 1427 | if (inode->i_data.nrpages == 0 && |
1429 | invalidating_gen == ci->i_rdcache_gen) { | 1428 | invalidating_gen == ci->i_rdcache_gen) { |
@@ -1470,7 +1469,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, | |||
1470 | if (mdsc->stopping) | 1469 | if (mdsc->stopping) |
1471 | is_delayed = 1; | 1470 | is_delayed = 1; |
1472 | 1471 | ||
1473 | spin_lock(&inode->i_lock); | 1472 | spin_lock(&ci->i_ceph_lock); |
1474 | 1473 | ||
1475 | if (ci->i_ceph_flags & CEPH_I_FLUSH) | 1474 | if (ci->i_ceph_flags & CEPH_I_FLUSH) |
1476 | flags |= CHECK_CAPS_FLUSH; | 1475 | flags |= CHECK_CAPS_FLUSH; |
@@ -1480,7 +1479,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, | |||
1480 | __ceph_flush_snaps(ci, &session, 0); | 1479 | __ceph_flush_snaps(ci, &session, 0); |
1481 | goto retry_locked; | 1480 | goto retry_locked; |
1482 | retry: | 1481 | retry: |
1483 | spin_lock(&inode->i_lock); | 1482 | spin_lock(&ci->i_ceph_lock); |
1484 | retry_locked: | 1483 | retry_locked: |
1485 | file_wanted = __ceph_caps_file_wanted(ci); | 1484 | file_wanted = __ceph_caps_file_wanted(ci); |
1486 | used = __ceph_caps_used(ci); | 1485 | used = __ceph_caps_used(ci); |
@@ -1634,7 +1633,7 @@ ack: | |||
1634 | if (mutex_trylock(&session->s_mutex) == 0) { | 1633 | if (mutex_trylock(&session->s_mutex) == 0) { |
1635 | dout("inverting session/ino locks on %p\n", | 1634 | dout("inverting session/ino locks on %p\n", |
1636 | session); | 1635 | session); |
1637 | spin_unlock(&inode->i_lock); | 1636 | spin_unlock(&ci->i_ceph_lock); |
1638 | if (took_snap_rwsem) { | 1637 | if (took_snap_rwsem) { |
1639 | up_read(&mdsc->snap_rwsem); | 1638 | up_read(&mdsc->snap_rwsem); |
1640 | took_snap_rwsem = 0; | 1639 | took_snap_rwsem = 0; |
@@ -1648,7 +1647,7 @@ ack: | |||
1648 | if (down_read_trylock(&mdsc->snap_rwsem) == 0) { | 1647 | if (down_read_trylock(&mdsc->snap_rwsem) == 0) { |
1649 | dout("inverting snap/in locks on %p\n", | 1648 | dout("inverting snap/in locks on %p\n", |
1650 | inode); | 1649 | inode); |
1651 | spin_unlock(&inode->i_lock); | 1650 | spin_unlock(&ci->i_ceph_lock); |
1652 | down_read(&mdsc->snap_rwsem); | 1651 | down_read(&mdsc->snap_rwsem); |
1653 | took_snap_rwsem = 1; | 1652 | took_snap_rwsem = 1; |
1654 | goto retry; | 1653 | goto retry; |
@@ -1664,10 +1663,10 @@ ack: | |||
1664 | mds = cap->mds; /* remember mds, so we don't repeat */ | 1663 | mds = cap->mds; /* remember mds, so we don't repeat */ |
1665 | sent++; | 1664 | sent++; |
1666 | 1665 | ||
1667 | /* __send_cap drops i_lock */ | 1666 | /* __send_cap drops i_ceph_lock */ |
1668 | delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, used, want, | 1667 | delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, used, want, |
1669 | retain, flushing, NULL); | 1668 | retain, flushing, NULL); |
1670 | goto retry; /* retake i_lock and restart our cap scan. */ | 1669 | goto retry; /* retake i_ceph_lock and restart our cap scan. */ |
1671 | } | 1670 | } |
1672 | 1671 | ||
1673 | /* | 1672 | /* |
@@ -1681,7 +1680,7 @@ ack: | |||
1681 | else if (!is_delayed || force_requeue) | 1680 | else if (!is_delayed || force_requeue) |
1682 | __cap_delay_requeue(mdsc, ci); | 1681 | __cap_delay_requeue(mdsc, ci); |
1683 | 1682 | ||
1684 | spin_unlock(&inode->i_lock); | 1683 | spin_unlock(&ci->i_ceph_lock); |
1685 | 1684 | ||
1686 | if (queue_invalidate) | 1685 | if (queue_invalidate) |
1687 | ceph_queue_invalidate(inode); | 1686 | ceph_queue_invalidate(inode); |
@@ -1704,7 +1703,7 @@ static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session, | |||
1704 | int flushing = 0; | 1703 | int flushing = 0; |
1705 | 1704 | ||
1706 | retry: | 1705 | retry: |
1707 | spin_lock(&inode->i_lock); | 1706 | spin_lock(&ci->i_ceph_lock); |
1708 | if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { | 1707 | if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { |
1709 | dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); | 1708 | dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); |
1710 | goto out; | 1709 | goto out; |
@@ -1716,7 +1715,7 @@ retry: | |||
1716 | int delayed; | 1715 | int delayed; |
1717 | 1716 | ||
1718 | if (!session) { | 1717 | if (!session) { |
1719 | spin_unlock(&inode->i_lock); | 1718 | spin_unlock(&ci->i_ceph_lock); |
1720 | session = cap->session; | 1719 | session = cap->session; |
1721 | mutex_lock(&session->s_mutex); | 1720 | mutex_lock(&session->s_mutex); |
1722 | goto retry; | 1721 | goto retry; |
@@ -1727,18 +1726,18 @@ retry: | |||
1727 | 1726 | ||
1728 | flushing = __mark_caps_flushing(inode, session); | 1727 | flushing = __mark_caps_flushing(inode, session); |
1729 | 1728 | ||
1730 | /* __send_cap drops i_lock */ | 1729 | /* __send_cap drops i_ceph_lock */ |
1731 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, used, want, | 1730 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, used, want, |
1732 | cap->issued | cap->implemented, flushing, | 1731 | cap->issued | cap->implemented, flushing, |
1733 | flush_tid); | 1732 | flush_tid); |
1734 | if (!delayed) | 1733 | if (!delayed) |
1735 | goto out_unlocked; | 1734 | goto out_unlocked; |
1736 | 1735 | ||
1737 | spin_lock(&inode->i_lock); | 1736 | spin_lock(&ci->i_ceph_lock); |
1738 | __cap_delay_requeue(mdsc, ci); | 1737 | __cap_delay_requeue(mdsc, ci); |
1739 | } | 1738 | } |
1740 | out: | 1739 | out: |
1741 | spin_unlock(&inode->i_lock); | 1740 | spin_unlock(&ci->i_ceph_lock); |
1742 | out_unlocked: | 1741 | out_unlocked: |
1743 | if (session && unlock_session) | 1742 | if (session && unlock_session) |
1744 | mutex_unlock(&session->s_mutex); | 1743 | mutex_unlock(&session->s_mutex); |
@@ -1753,7 +1752,7 @@ static int caps_are_flushed(struct inode *inode, unsigned tid) | |||
1753 | struct ceph_inode_info *ci = ceph_inode(inode); | 1752 | struct ceph_inode_info *ci = ceph_inode(inode); |
1754 | int i, ret = 1; | 1753 | int i, ret = 1; |
1755 | 1754 | ||
1756 | spin_lock(&inode->i_lock); | 1755 | spin_lock(&ci->i_ceph_lock); |
1757 | for (i = 0; i < CEPH_CAP_BITS; i++) | 1756 | for (i = 0; i < CEPH_CAP_BITS; i++) |
1758 | if ((ci->i_flushing_caps & (1 << i)) && | 1757 | if ((ci->i_flushing_caps & (1 << i)) && |
1759 | ci->i_cap_flush_tid[i] <= tid) { | 1758 | ci->i_cap_flush_tid[i] <= tid) { |
@@ -1761,7 +1760,7 @@ static int caps_are_flushed(struct inode *inode, unsigned tid) | |||
1761 | ret = 0; | 1760 | ret = 0; |
1762 | break; | 1761 | break; |
1763 | } | 1762 | } |
1764 | spin_unlock(&inode->i_lock); | 1763 | spin_unlock(&ci->i_ceph_lock); |
1765 | return ret; | 1764 | return ret; |
1766 | } | 1765 | } |
1767 | 1766 | ||
@@ -1868,10 +1867,10 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
1868 | struct ceph_mds_client *mdsc = | 1867 | struct ceph_mds_client *mdsc = |
1869 | ceph_sb_to_client(inode->i_sb)->mdsc; | 1868 | ceph_sb_to_client(inode->i_sb)->mdsc; |
1870 | 1869 | ||
1871 | spin_lock(&inode->i_lock); | 1870 | spin_lock(&ci->i_ceph_lock); |
1872 | if (__ceph_caps_dirty(ci)) | 1871 | if (__ceph_caps_dirty(ci)) |
1873 | __cap_delay_requeue_front(mdsc, ci); | 1872 | __cap_delay_requeue_front(mdsc, ci); |
1874 | spin_unlock(&inode->i_lock); | 1873 | spin_unlock(&ci->i_ceph_lock); |
1875 | } | 1874 | } |
1876 | return err; | 1875 | return err; |
1877 | } | 1876 | } |
@@ -1894,7 +1893,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
1894 | struct inode *inode = &ci->vfs_inode; | 1893 | struct inode *inode = &ci->vfs_inode; |
1895 | struct ceph_cap *cap; | 1894 | struct ceph_cap *cap; |
1896 | 1895 | ||
1897 | spin_lock(&inode->i_lock); | 1896 | spin_lock(&ci->i_ceph_lock); |
1898 | cap = ci->i_auth_cap; | 1897 | cap = ci->i_auth_cap; |
1899 | if (cap && cap->session == session) { | 1898 | if (cap && cap->session == session) { |
1900 | dout("kick_flushing_caps %p cap %p capsnap %p\n", inode, | 1899 | dout("kick_flushing_caps %p cap %p capsnap %p\n", inode, |
@@ -1904,7 +1903,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
1904 | pr_err("%p auth cap %p not mds%d ???\n", inode, | 1903 | pr_err("%p auth cap %p not mds%d ???\n", inode, |
1905 | cap, session->s_mds); | 1904 | cap, session->s_mds); |
1906 | } | 1905 | } |
1907 | spin_unlock(&inode->i_lock); | 1906 | spin_unlock(&ci->i_ceph_lock); |
1908 | } | 1907 | } |
1909 | } | 1908 | } |
1910 | 1909 | ||
@@ -1921,7 +1920,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
1921 | struct ceph_cap *cap; | 1920 | struct ceph_cap *cap; |
1922 | int delayed = 0; | 1921 | int delayed = 0; |
1923 | 1922 | ||
1924 | spin_lock(&inode->i_lock); | 1923 | spin_lock(&ci->i_ceph_lock); |
1925 | cap = ci->i_auth_cap; | 1924 | cap = ci->i_auth_cap; |
1926 | if (cap && cap->session == session) { | 1925 | if (cap && cap->session == session) { |
1927 | dout("kick_flushing_caps %p cap %p %s\n", inode, | 1926 | dout("kick_flushing_caps %p cap %p %s\n", inode, |
@@ -1932,14 +1931,14 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
1932 | cap->issued | cap->implemented, | 1931 | cap->issued | cap->implemented, |
1933 | ci->i_flushing_caps, NULL); | 1932 | ci->i_flushing_caps, NULL); |
1934 | if (delayed) { | 1933 | if (delayed) { |
1935 | spin_lock(&inode->i_lock); | 1934 | spin_lock(&ci->i_ceph_lock); |
1936 | __cap_delay_requeue(mdsc, ci); | 1935 | __cap_delay_requeue(mdsc, ci); |
1937 | spin_unlock(&inode->i_lock); | 1936 | spin_unlock(&ci->i_ceph_lock); |
1938 | } | 1937 | } |
1939 | } else { | 1938 | } else { |
1940 | pr_err("%p auth cap %p not mds%d ???\n", inode, | 1939 | pr_err("%p auth cap %p not mds%d ???\n", inode, |
1941 | cap, session->s_mds); | 1940 | cap, session->s_mds); |
1942 | spin_unlock(&inode->i_lock); | 1941 | spin_unlock(&ci->i_ceph_lock); |
1943 | } | 1942 | } |
1944 | } | 1943 | } |
1945 | } | 1944 | } |
@@ -1952,7 +1951,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
1952 | struct ceph_cap *cap; | 1951 | struct ceph_cap *cap; |
1953 | int delayed = 0; | 1952 | int delayed = 0; |
1954 | 1953 | ||
1955 | spin_lock(&inode->i_lock); | 1954 | spin_lock(&ci->i_ceph_lock); |
1956 | cap = ci->i_auth_cap; | 1955 | cap = ci->i_auth_cap; |
1957 | dout("kick_flushing_inode_caps %p flushing %s flush_seq %lld\n", inode, | 1956 | dout("kick_flushing_inode_caps %p flushing %s flush_seq %lld\n", inode, |
1958 | ceph_cap_string(ci->i_flushing_caps), ci->i_cap_flush_seq); | 1957 | ceph_cap_string(ci->i_flushing_caps), ci->i_cap_flush_seq); |
@@ -1964,12 +1963,12 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
1964 | cap->issued | cap->implemented, | 1963 | cap->issued | cap->implemented, |
1965 | ci->i_flushing_caps, NULL); | 1964 | ci->i_flushing_caps, NULL); |
1966 | if (delayed) { | 1965 | if (delayed) { |
1967 | spin_lock(&inode->i_lock); | 1966 | spin_lock(&ci->i_ceph_lock); |
1968 | __cap_delay_requeue(mdsc, ci); | 1967 | __cap_delay_requeue(mdsc, ci); |
1969 | spin_unlock(&inode->i_lock); | 1968 | spin_unlock(&ci->i_ceph_lock); |
1970 | } | 1969 | } |
1971 | } else { | 1970 | } else { |
1972 | spin_unlock(&inode->i_lock); | 1971 | spin_unlock(&ci->i_ceph_lock); |
1973 | } | 1972 | } |
1974 | } | 1973 | } |
1975 | 1974 | ||
@@ -1978,7 +1977,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
1978 | * Take references to capabilities we hold, so that we don't release | 1977 | * Take references to capabilities we hold, so that we don't release |
1979 | * them to the MDS prematurely. | 1978 | * them to the MDS prematurely. |
1980 | * | 1979 | * |
1981 | * Protected by i_lock. | 1980 | * Protected by i_ceph_lock. |
1982 | */ | 1981 | */ |
1983 | static void __take_cap_refs(struct ceph_inode_info *ci, int got) | 1982 | static void __take_cap_refs(struct ceph_inode_info *ci, int got) |
1984 | { | 1983 | { |
@@ -2016,7 +2015,7 @@ static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want, | |||
2016 | 2015 | ||
2017 | dout("get_cap_refs %p need %s want %s\n", inode, | 2016 | dout("get_cap_refs %p need %s want %s\n", inode, |
2018 | ceph_cap_string(need), ceph_cap_string(want)); | 2017 | ceph_cap_string(need), ceph_cap_string(want)); |
2019 | spin_lock(&inode->i_lock); | 2018 | spin_lock(&ci->i_ceph_lock); |
2020 | 2019 | ||
2021 | /* make sure file is actually open */ | 2020 | /* make sure file is actually open */ |
2022 | file_wanted = __ceph_caps_file_wanted(ci); | 2021 | file_wanted = __ceph_caps_file_wanted(ci); |
@@ -2077,7 +2076,7 @@ static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want, | |||
2077 | ceph_cap_string(have), ceph_cap_string(need)); | 2076 | ceph_cap_string(have), ceph_cap_string(need)); |
2078 | } | 2077 | } |
2079 | out: | 2078 | out: |
2080 | spin_unlock(&inode->i_lock); | 2079 | spin_unlock(&ci->i_ceph_lock); |
2081 | dout("get_cap_refs %p ret %d got %s\n", inode, | 2080 | dout("get_cap_refs %p ret %d got %s\n", inode, |
2082 | ret, ceph_cap_string(*got)); | 2081 | ret, ceph_cap_string(*got)); |
2083 | return ret; | 2082 | return ret; |
@@ -2094,7 +2093,7 @@ static void check_max_size(struct inode *inode, loff_t endoff) | |||
2094 | int check = 0; | 2093 | int check = 0; |
2095 | 2094 | ||
2096 | /* do we need to explicitly request a larger max_size? */ | 2095 | /* do we need to explicitly request a larger max_size? */ |
2097 | spin_lock(&inode->i_lock); | 2096 | spin_lock(&ci->i_ceph_lock); |
2098 | if ((endoff >= ci->i_max_size || | 2097 | if ((endoff >= ci->i_max_size || |
2099 | endoff > (inode->i_size << 1)) && | 2098 | endoff > (inode->i_size << 1)) && |
2100 | endoff > ci->i_wanted_max_size) { | 2099 | endoff > ci->i_wanted_max_size) { |
@@ -2103,7 +2102,7 @@ static void check_max_size(struct inode *inode, loff_t endoff) | |||
2103 | ci->i_wanted_max_size = endoff; | 2102 | ci->i_wanted_max_size = endoff; |
2104 | check = 1; | 2103 | check = 1; |
2105 | } | 2104 | } |
2106 | spin_unlock(&inode->i_lock); | 2105 | spin_unlock(&ci->i_ceph_lock); |
2107 | if (check) | 2106 | if (check) |
2108 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 2107 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
2109 | } | 2108 | } |
@@ -2140,9 +2139,9 @@ retry: | |||
2140 | */ | 2139 | */ |
2141 | void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps) | 2140 | void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps) |
2142 | { | 2141 | { |
2143 | spin_lock(&ci->vfs_inode.i_lock); | 2142 | spin_lock(&ci->i_ceph_lock); |
2144 | __take_cap_refs(ci, caps); | 2143 | __take_cap_refs(ci, caps); |
2145 | spin_unlock(&ci->vfs_inode.i_lock); | 2144 | spin_unlock(&ci->i_ceph_lock); |
2146 | } | 2145 | } |
2147 | 2146 | ||
2148 | /* | 2147 | /* |
@@ -2160,7 +2159,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had) | |||
2160 | int last = 0, put = 0, flushsnaps = 0, wake = 0; | 2159 | int last = 0, put = 0, flushsnaps = 0, wake = 0; |
2161 | struct ceph_cap_snap *capsnap; | 2160 | struct ceph_cap_snap *capsnap; |
2162 | 2161 | ||
2163 | spin_lock(&inode->i_lock); | 2162 | spin_lock(&ci->i_ceph_lock); |
2164 | if (had & CEPH_CAP_PIN) | 2163 | if (had & CEPH_CAP_PIN) |
2165 | --ci->i_pin_ref; | 2164 | --ci->i_pin_ref; |
2166 | if (had & CEPH_CAP_FILE_RD) | 2165 | if (had & CEPH_CAP_FILE_RD) |
@@ -2193,7 +2192,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had) | |||
2193 | } | 2192 | } |
2194 | } | 2193 | } |
2195 | } | 2194 | } |
2196 | spin_unlock(&inode->i_lock); | 2195 | spin_unlock(&ci->i_ceph_lock); |
2197 | 2196 | ||
2198 | dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had), | 2197 | dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had), |
2199 | last ? " last" : "", put ? " put" : ""); | 2198 | last ? " last" : "", put ? " put" : ""); |
@@ -2225,7 +2224,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
2225 | int found = 0; | 2224 | int found = 0; |
2226 | struct ceph_cap_snap *capsnap = NULL; | 2225 | struct ceph_cap_snap *capsnap = NULL; |
2227 | 2226 | ||
2228 | spin_lock(&inode->i_lock); | 2227 | spin_lock(&ci->i_ceph_lock); |
2229 | ci->i_wrbuffer_ref -= nr; | 2228 | ci->i_wrbuffer_ref -= nr; |
2230 | last = !ci->i_wrbuffer_ref; | 2229 | last = !ci->i_wrbuffer_ref; |
2231 | 2230 | ||
@@ -2274,7 +2273,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
2274 | } | 2273 | } |
2275 | } | 2274 | } |
2276 | 2275 | ||
2277 | spin_unlock(&inode->i_lock); | 2276 | spin_unlock(&ci->i_ceph_lock); |
2278 | 2277 | ||
2279 | if (last) { | 2278 | if (last) { |
2280 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 2279 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
@@ -2291,7 +2290,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
2291 | * Handle a cap GRANT message from the MDS. (Note that a GRANT may | 2290 | * Handle a cap GRANT message from the MDS. (Note that a GRANT may |
2292 | * actually be a revocation if it specifies a smaller cap set.) | 2291 | * actually be a revocation if it specifies a smaller cap set.) |
2293 | * | 2292 | * |
2294 | * caller holds s_mutex and i_lock, we drop both. | 2293 | * caller holds s_mutex and i_ceph_lock, we drop both. |
2295 | * | 2294 | * |
2296 | * return value: | 2295 | * return value: |
2297 | * 0 - ok | 2296 | * 0 - ok |
@@ -2302,7 +2301,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2302 | struct ceph_mds_session *session, | 2301 | struct ceph_mds_session *session, |
2303 | struct ceph_cap *cap, | 2302 | struct ceph_cap *cap, |
2304 | struct ceph_buffer *xattr_buf) | 2303 | struct ceph_buffer *xattr_buf) |
2305 | __releases(inode->i_lock) | 2304 | __releases(ci->i_ceph_lock) |
2306 | { | 2305 | { |
2307 | struct ceph_inode_info *ci = ceph_inode(inode); | 2306 | struct ceph_inode_info *ci = ceph_inode(inode); |
2308 | int mds = session->s_mds; | 2307 | int mds = session->s_mds; |
@@ -2453,7 +2452,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2453 | } | 2452 | } |
2454 | BUG_ON(cap->issued & ~cap->implemented); | 2453 | BUG_ON(cap->issued & ~cap->implemented); |
2455 | 2454 | ||
2456 | spin_unlock(&inode->i_lock); | 2455 | spin_unlock(&ci->i_ceph_lock); |
2457 | if (writeback) | 2456 | if (writeback) |
2458 | /* | 2457 | /* |
2459 | * queue inode for writeback: we can't actually call | 2458 | * queue inode for writeback: we can't actually call |
@@ -2483,7 +2482,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, | |||
2483 | struct ceph_mds_caps *m, | 2482 | struct ceph_mds_caps *m, |
2484 | struct ceph_mds_session *session, | 2483 | struct ceph_mds_session *session, |
2485 | struct ceph_cap *cap) | 2484 | struct ceph_cap *cap) |
2486 | __releases(inode->i_lock) | 2485 | __releases(ci->i_ceph_lock) |
2487 | { | 2486 | { |
2488 | struct ceph_inode_info *ci = ceph_inode(inode); | 2487 | struct ceph_inode_info *ci = ceph_inode(inode); |
2489 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; | 2488 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; |
@@ -2539,7 +2538,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, | |||
2539 | wake_up_all(&ci->i_cap_wq); | 2538 | wake_up_all(&ci->i_cap_wq); |
2540 | 2539 | ||
2541 | out: | 2540 | out: |
2542 | spin_unlock(&inode->i_lock); | 2541 | spin_unlock(&ci->i_ceph_lock); |
2543 | if (drop) | 2542 | if (drop) |
2544 | iput(inode); | 2543 | iput(inode); |
2545 | } | 2544 | } |
@@ -2562,7 +2561,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
2562 | dout("handle_cap_flushsnap_ack inode %p ci %p mds%d follows %lld\n", | 2561 | dout("handle_cap_flushsnap_ack inode %p ci %p mds%d follows %lld\n", |
2563 | inode, ci, session->s_mds, follows); | 2562 | inode, ci, session->s_mds, follows); |
2564 | 2563 | ||
2565 | spin_lock(&inode->i_lock); | 2564 | spin_lock(&ci->i_ceph_lock); |
2566 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { | 2565 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { |
2567 | if (capsnap->follows == follows) { | 2566 | if (capsnap->follows == follows) { |
2568 | if (capsnap->flush_tid != flush_tid) { | 2567 | if (capsnap->flush_tid != flush_tid) { |
@@ -2585,7 +2584,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
2585 | capsnap, capsnap->follows); | 2584 | capsnap, capsnap->follows); |
2586 | } | 2585 | } |
2587 | } | 2586 | } |
2588 | spin_unlock(&inode->i_lock); | 2587 | spin_unlock(&ci->i_ceph_lock); |
2589 | if (drop) | 2588 | if (drop) |
2590 | iput(inode); | 2589 | iput(inode); |
2591 | } | 2590 | } |
@@ -2598,7 +2597,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
2598 | static void handle_cap_trunc(struct inode *inode, | 2597 | static void handle_cap_trunc(struct inode *inode, |
2599 | struct ceph_mds_caps *trunc, | 2598 | struct ceph_mds_caps *trunc, |
2600 | struct ceph_mds_session *session) | 2599 | struct ceph_mds_session *session) |
2601 | __releases(inode->i_lock) | 2600 | __releases(ci->i_ceph_lock) |
2602 | { | 2601 | { |
2603 | struct ceph_inode_info *ci = ceph_inode(inode); | 2602 | struct ceph_inode_info *ci = ceph_inode(inode); |
2604 | int mds = session->s_mds; | 2603 | int mds = session->s_mds; |
@@ -2617,7 +2616,7 @@ static void handle_cap_trunc(struct inode *inode, | |||
2617 | inode, mds, seq, truncate_size, truncate_seq); | 2616 | inode, mds, seq, truncate_size, truncate_seq); |
2618 | queue_trunc = ceph_fill_file_size(inode, issued, | 2617 | queue_trunc = ceph_fill_file_size(inode, issued, |
2619 | truncate_seq, truncate_size, size); | 2618 | truncate_seq, truncate_size, size); |
2620 | spin_unlock(&inode->i_lock); | 2619 | spin_unlock(&ci->i_ceph_lock); |
2621 | 2620 | ||
2622 | if (queue_trunc) | 2621 | if (queue_trunc) |
2623 | ceph_queue_vmtruncate(inode); | 2622 | ceph_queue_vmtruncate(inode); |
@@ -2646,7 +2645,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, | |||
2646 | dout("handle_cap_export inode %p ci %p mds%d mseq %d\n", | 2645 | dout("handle_cap_export inode %p ci %p mds%d mseq %d\n", |
2647 | inode, ci, mds, mseq); | 2646 | inode, ci, mds, mseq); |
2648 | 2647 | ||
2649 | spin_lock(&inode->i_lock); | 2648 | spin_lock(&ci->i_ceph_lock); |
2650 | 2649 | ||
2651 | /* make sure we haven't seen a higher mseq */ | 2650 | /* make sure we haven't seen a higher mseq */ |
2652 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { | 2651 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { |
@@ -2690,7 +2689,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, | |||
2690 | } | 2689 | } |
2691 | /* else, we already released it */ | 2690 | /* else, we already released it */ |
2692 | 2691 | ||
2693 | spin_unlock(&inode->i_lock); | 2692 | spin_unlock(&ci->i_ceph_lock); |
2694 | } | 2693 | } |
2695 | 2694 | ||
2696 | /* | 2695 | /* |
@@ -2745,9 +2744,9 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | |||
2745 | up_read(&mdsc->snap_rwsem); | 2744 | up_read(&mdsc->snap_rwsem); |
2746 | 2745 | ||
2747 | /* make sure we re-request max_size, if necessary */ | 2746 | /* make sure we re-request max_size, if necessary */ |
2748 | spin_lock(&inode->i_lock); | 2747 | spin_lock(&ci->i_ceph_lock); |
2749 | ci->i_requested_max_size = 0; | 2748 | ci->i_requested_max_size = 0; |
2750 | spin_unlock(&inode->i_lock); | 2749 | spin_unlock(&ci->i_ceph_lock); |
2751 | } | 2750 | } |
2752 | 2751 | ||
2753 | /* | 2752 | /* |
@@ -2762,6 +2761,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2762 | struct ceph_mds_client *mdsc = session->s_mdsc; | 2761 | struct ceph_mds_client *mdsc = session->s_mdsc; |
2763 | struct super_block *sb = mdsc->fsc->sb; | 2762 | struct super_block *sb = mdsc->fsc->sb; |
2764 | struct inode *inode; | 2763 | struct inode *inode; |
2764 | struct ceph_inode_info *ci; | ||
2765 | struct ceph_cap *cap; | 2765 | struct ceph_cap *cap; |
2766 | struct ceph_mds_caps *h; | 2766 | struct ceph_mds_caps *h; |
2767 | int mds = session->s_mds; | 2767 | int mds = session->s_mds; |
@@ -2815,6 +2815,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2815 | 2815 | ||
2816 | /* lookup ino */ | 2816 | /* lookup ino */ |
2817 | inode = ceph_find_inode(sb, vino); | 2817 | inode = ceph_find_inode(sb, vino); |
2818 | ci = ceph_inode(inode); | ||
2818 | dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino, | 2819 | dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino, |
2819 | vino.snap, inode); | 2820 | vino.snap, inode); |
2820 | if (!inode) { | 2821 | if (!inode) { |
@@ -2844,16 +2845,16 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2844 | } | 2845 | } |
2845 | 2846 | ||
2846 | /* the rest require a cap */ | 2847 | /* the rest require a cap */ |
2847 | spin_lock(&inode->i_lock); | 2848 | spin_lock(&ci->i_ceph_lock); |
2848 | cap = __get_cap_for_mds(ceph_inode(inode), mds); | 2849 | cap = __get_cap_for_mds(ceph_inode(inode), mds); |
2849 | if (!cap) { | 2850 | if (!cap) { |
2850 | dout(" no cap on %p ino %llx.%llx from mds%d\n", | 2851 | dout(" no cap on %p ino %llx.%llx from mds%d\n", |
2851 | inode, ceph_ino(inode), ceph_snap(inode), mds); | 2852 | inode, ceph_ino(inode), ceph_snap(inode), mds); |
2852 | spin_unlock(&inode->i_lock); | 2853 | spin_unlock(&ci->i_ceph_lock); |
2853 | goto flush_cap_releases; | 2854 | goto flush_cap_releases; |
2854 | } | 2855 | } |
2855 | 2856 | ||
2856 | /* note that each of these drops i_lock for us */ | 2857 | /* note that each of these drops i_ceph_lock for us */ |
2857 | switch (op) { | 2858 | switch (op) { |
2858 | case CEPH_CAP_OP_REVOKE: | 2859 | case CEPH_CAP_OP_REVOKE: |
2859 | case CEPH_CAP_OP_GRANT: | 2860 | case CEPH_CAP_OP_GRANT: |
@@ -2869,7 +2870,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2869 | break; | 2870 | break; |
2870 | 2871 | ||
2871 | default: | 2872 | default: |
2872 | spin_unlock(&inode->i_lock); | 2873 | spin_unlock(&ci->i_ceph_lock); |
2873 | pr_err("ceph_handle_caps: unknown cap op %d %s\n", op, | 2874 | pr_err("ceph_handle_caps: unknown cap op %d %s\n", op, |
2874 | ceph_cap_op_name(op)); | 2875 | ceph_cap_op_name(op)); |
2875 | } | 2876 | } |
@@ -2962,13 +2963,13 @@ void ceph_put_fmode(struct ceph_inode_info *ci, int fmode) | |||
2962 | struct inode *inode = &ci->vfs_inode; | 2963 | struct inode *inode = &ci->vfs_inode; |
2963 | int last = 0; | 2964 | int last = 0; |
2964 | 2965 | ||
2965 | spin_lock(&inode->i_lock); | 2966 | spin_lock(&ci->i_ceph_lock); |
2966 | dout("put_fmode %p fmode %d %d -> %d\n", inode, fmode, | 2967 | dout("put_fmode %p fmode %d %d -> %d\n", inode, fmode, |
2967 | ci->i_nr_by_mode[fmode], ci->i_nr_by_mode[fmode]-1); | 2968 | ci->i_nr_by_mode[fmode], ci->i_nr_by_mode[fmode]-1); |
2968 | BUG_ON(ci->i_nr_by_mode[fmode] == 0); | 2969 | BUG_ON(ci->i_nr_by_mode[fmode] == 0); |
2969 | if (--ci->i_nr_by_mode[fmode] == 0) | 2970 | if (--ci->i_nr_by_mode[fmode] == 0) |
2970 | last++; | 2971 | last++; |
2971 | spin_unlock(&inode->i_lock); | 2972 | spin_unlock(&ci->i_ceph_lock); |
2972 | 2973 | ||
2973 | if (last && ci->i_vino.snap == CEPH_NOSNAP) | 2974 | if (last && ci->i_vino.snap == CEPH_NOSNAP) |
2974 | ceph_check_caps(ci, 0, NULL); | 2975 | ceph_check_caps(ci, 0, NULL); |
@@ -2991,7 +2992,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
2991 | int used, dirty; | 2992 | int used, dirty; |
2992 | int ret = 0; | 2993 | int ret = 0; |
2993 | 2994 | ||
2994 | spin_lock(&inode->i_lock); | 2995 | spin_lock(&ci->i_ceph_lock); |
2995 | used = __ceph_caps_used(ci); | 2996 | used = __ceph_caps_used(ci); |
2996 | dirty = __ceph_caps_dirty(ci); | 2997 | dirty = __ceph_caps_dirty(ci); |
2997 | 2998 | ||
@@ -3046,7 +3047,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
3046 | inode, cap, ceph_cap_string(cap->issued)); | 3047 | inode, cap, ceph_cap_string(cap->issued)); |
3047 | } | 3048 | } |
3048 | } | 3049 | } |
3049 | spin_unlock(&inode->i_lock); | 3050 | spin_unlock(&ci->i_ceph_lock); |
3050 | return ret; | 3051 | return ret; |
3051 | } | 3052 | } |
3052 | 3053 | ||
@@ -3061,7 +3062,7 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry, | |||
3061 | 3062 | ||
3062 | /* | 3063 | /* |
3063 | * force an record for the directory caps if we have a dentry lease. | 3064 | * force an record for the directory caps if we have a dentry lease. |
3064 | * this is racy (can't take i_lock and d_lock together), but it | 3065 | * this is racy (can't take i_ceph_lock and d_lock together), but it |
3065 | * doesn't have to be perfect; the mds will revoke anything we don't | 3066 | * doesn't have to be perfect; the mds will revoke anything we don't |
3066 | * release. | 3067 | * release. |
3067 | */ | 3068 | */ |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index bca3948e9dbf..3eeb97661262 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -281,18 +281,18 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
281 | } | 281 | } |
282 | 282 | ||
283 | /* can we use the dcache? */ | 283 | /* can we use the dcache? */ |
284 | spin_lock(&inode->i_lock); | 284 | spin_lock(&ci->i_ceph_lock); |
285 | if ((filp->f_pos == 2 || fi->dentry) && | 285 | if ((filp->f_pos == 2 || fi->dentry) && |
286 | !ceph_test_mount_opt(fsc, NOASYNCREADDIR) && | 286 | !ceph_test_mount_opt(fsc, NOASYNCREADDIR) && |
287 | ceph_snap(inode) != CEPH_SNAPDIR && | 287 | ceph_snap(inode) != CEPH_SNAPDIR && |
288 | ceph_dir_test_complete(inode) && | 288 | ceph_dir_test_complete(inode) && |
289 | __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1)) { | 289 | __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1)) { |
290 | spin_unlock(&inode->i_lock); | 290 | spin_unlock(&ci->i_ceph_lock); |
291 | err = __dcache_readdir(filp, dirent, filldir); | 291 | err = __dcache_readdir(filp, dirent, filldir); |
292 | if (err != -EAGAIN) | 292 | if (err != -EAGAIN) |
293 | return err; | 293 | return err; |
294 | } else { | 294 | } else { |
295 | spin_unlock(&inode->i_lock); | 295 | spin_unlock(&ci->i_ceph_lock); |
296 | } | 296 | } |
297 | if (fi->dentry) { | 297 | if (fi->dentry) { |
298 | err = note_last_dentry(fi, fi->dentry->d_name.name, | 298 | err = note_last_dentry(fi, fi->dentry->d_name.name, |
@@ -428,12 +428,12 @@ more: | |||
428 | * were released during the whole readdir, and we should have | 428 | * were released during the whole readdir, and we should have |
429 | * the complete dir contents in our cache. | 429 | * the complete dir contents in our cache. |
430 | */ | 430 | */ |
431 | spin_lock(&inode->i_lock); | 431 | spin_lock(&ci->i_ceph_lock); |
432 | if (ci->i_release_count == fi->dir_release_count) { | 432 | if (ci->i_release_count == fi->dir_release_count) { |
433 | ceph_dir_set_complete(inode); | 433 | ceph_dir_set_complete(inode); |
434 | ci->i_max_offset = filp->f_pos; | 434 | ci->i_max_offset = filp->f_pos; |
435 | } | 435 | } |
436 | spin_unlock(&inode->i_lock); | 436 | spin_unlock(&ci->i_ceph_lock); |
437 | 437 | ||
438 | dout("readdir %p filp %p done.\n", inode, filp); | 438 | dout("readdir %p filp %p done.\n", inode, filp); |
439 | return 0; | 439 | return 0; |
@@ -607,7 +607,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
607 | struct ceph_inode_info *ci = ceph_inode(dir); | 607 | struct ceph_inode_info *ci = ceph_inode(dir); |
608 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 608 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
609 | 609 | ||
610 | spin_lock(&dir->i_lock); | 610 | spin_lock(&ci->i_ceph_lock); |
611 | dout(" dir %p flags are %d\n", dir, ci->i_ceph_flags); | 611 | dout(" dir %p flags are %d\n", dir, ci->i_ceph_flags); |
612 | if (strncmp(dentry->d_name.name, | 612 | if (strncmp(dentry->d_name.name, |
613 | fsc->mount_options->snapdir_name, | 613 | fsc->mount_options->snapdir_name, |
@@ -615,13 +615,13 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
615 | !is_root_ceph_dentry(dir, dentry) && | 615 | !is_root_ceph_dentry(dir, dentry) && |
616 | ceph_dir_test_complete(dir) && | 616 | ceph_dir_test_complete(dir) && |
617 | (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { | 617 | (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { |
618 | spin_unlock(&dir->i_lock); | 618 | spin_unlock(&ci->i_ceph_lock); |
619 | dout(" dir %p complete, -ENOENT\n", dir); | 619 | dout(" dir %p complete, -ENOENT\n", dir); |
620 | d_add(dentry, NULL); | 620 | d_add(dentry, NULL); |
621 | di->lease_shared_gen = ci->i_shared_gen; | 621 | di->lease_shared_gen = ci->i_shared_gen; |
622 | return NULL; | 622 | return NULL; |
623 | } | 623 | } |
624 | spin_unlock(&dir->i_lock); | 624 | spin_unlock(&ci->i_ceph_lock); |
625 | } | 625 | } |
626 | 626 | ||
627 | op = ceph_snap(dir) == CEPH_SNAPDIR ? | 627 | op = ceph_snap(dir) == CEPH_SNAPDIR ? |
@@ -841,12 +841,12 @@ static int drop_caps_for_unlink(struct inode *inode) | |||
841 | struct ceph_inode_info *ci = ceph_inode(inode); | 841 | struct ceph_inode_info *ci = ceph_inode(inode); |
842 | int drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; | 842 | int drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; |
843 | 843 | ||
844 | spin_lock(&inode->i_lock); | 844 | spin_lock(&ci->i_ceph_lock); |
845 | if (inode->i_nlink == 1) { | 845 | if (inode->i_nlink == 1) { |
846 | drop |= ~(__ceph_caps_wanted(ci) | CEPH_CAP_PIN); | 846 | drop |= ~(__ceph_caps_wanted(ci) | CEPH_CAP_PIN); |
847 | ci->i_ceph_flags |= CEPH_I_NODELAY; | 847 | ci->i_ceph_flags |= CEPH_I_NODELAY; |
848 | } | 848 | } |
849 | spin_unlock(&inode->i_lock); | 849 | spin_unlock(&ci->i_ceph_lock); |
850 | return drop; | 850 | return drop; |
851 | } | 851 | } |
852 | 852 | ||
@@ -1015,10 +1015,10 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry) | |||
1015 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 1015 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
1016 | int valid = 0; | 1016 | int valid = 0; |
1017 | 1017 | ||
1018 | spin_lock(&dir->i_lock); | 1018 | spin_lock(&ci->i_ceph_lock); |
1019 | if (ci->i_shared_gen == di->lease_shared_gen) | 1019 | if (ci->i_shared_gen == di->lease_shared_gen) |
1020 | valid = __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1); | 1020 | valid = __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1); |
1021 | spin_unlock(&dir->i_lock); | 1021 | spin_unlock(&ci->i_ceph_lock); |
1022 | dout("dir_lease_is_valid dir %p v%u dentry %p v%u = %d\n", | 1022 | dout("dir_lease_is_valid dir %p v%u dentry %p v%u = %d\n", |
1023 | dir, (unsigned)ci->i_shared_gen, dentry, | 1023 | dir, (unsigned)ci->i_shared_gen, dentry, |
1024 | (unsigned)di->lease_shared_gen, valid); | 1024 | (unsigned)di->lease_shared_gen, valid); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index ce549d31eeb7..ed72428d9c75 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -147,9 +147,9 @@ int ceph_open(struct inode *inode, struct file *file) | |||
147 | 147 | ||
148 | /* trivially open snapdir */ | 148 | /* trivially open snapdir */ |
149 | if (ceph_snap(inode) == CEPH_SNAPDIR) { | 149 | if (ceph_snap(inode) == CEPH_SNAPDIR) { |
150 | spin_lock(&inode->i_lock); | 150 | spin_lock(&ci->i_ceph_lock); |
151 | __ceph_get_fmode(ci, fmode); | 151 | __ceph_get_fmode(ci, fmode); |
152 | spin_unlock(&inode->i_lock); | 152 | spin_unlock(&ci->i_ceph_lock); |
153 | return ceph_init_file(inode, file, fmode); | 153 | return ceph_init_file(inode, file, fmode); |
154 | } | 154 | } |
155 | 155 | ||
@@ -158,7 +158,7 @@ int ceph_open(struct inode *inode, struct file *file) | |||
158 | * write) or any MDS (for read). Update wanted set | 158 | * write) or any MDS (for read). Update wanted set |
159 | * asynchronously. | 159 | * asynchronously. |
160 | */ | 160 | */ |
161 | spin_lock(&inode->i_lock); | 161 | spin_lock(&ci->i_ceph_lock); |
162 | if (__ceph_is_any_real_caps(ci) && | 162 | if (__ceph_is_any_real_caps(ci) && |
163 | (((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) { | 163 | (((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) { |
164 | int mds_wanted = __ceph_caps_mds_wanted(ci); | 164 | int mds_wanted = __ceph_caps_mds_wanted(ci); |
@@ -168,7 +168,7 @@ int ceph_open(struct inode *inode, struct file *file) | |||
168 | inode, fmode, ceph_cap_string(wanted), | 168 | inode, fmode, ceph_cap_string(wanted), |
169 | ceph_cap_string(issued)); | 169 | ceph_cap_string(issued)); |
170 | __ceph_get_fmode(ci, fmode); | 170 | __ceph_get_fmode(ci, fmode); |
171 | spin_unlock(&inode->i_lock); | 171 | spin_unlock(&ci->i_ceph_lock); |
172 | 172 | ||
173 | /* adjust wanted? */ | 173 | /* adjust wanted? */ |
174 | if ((issued & wanted) != wanted && | 174 | if ((issued & wanted) != wanted && |
@@ -180,10 +180,10 @@ int ceph_open(struct inode *inode, struct file *file) | |||
180 | } else if (ceph_snap(inode) != CEPH_NOSNAP && | 180 | } else if (ceph_snap(inode) != CEPH_NOSNAP && |
181 | (ci->i_snap_caps & wanted) == wanted) { | 181 | (ci->i_snap_caps & wanted) == wanted) { |
182 | __ceph_get_fmode(ci, fmode); | 182 | __ceph_get_fmode(ci, fmode); |
183 | spin_unlock(&inode->i_lock); | 183 | spin_unlock(&ci->i_ceph_lock); |
184 | return ceph_init_file(inode, file, fmode); | 184 | return ceph_init_file(inode, file, fmode); |
185 | } | 185 | } |
186 | spin_unlock(&inode->i_lock); | 186 | spin_unlock(&ci->i_ceph_lock); |
187 | 187 | ||
188 | dout("open fmode %d wants %s\n", fmode, ceph_cap_string(wanted)); | 188 | dout("open fmode %d wants %s\n", fmode, ceph_cap_string(wanted)); |
189 | req = prepare_open_request(inode->i_sb, flags, 0); | 189 | req = prepare_open_request(inode->i_sb, flags, 0); |
@@ -743,9 +743,9 @@ retry_snap: | |||
743 | */ | 743 | */ |
744 | int dirty; | 744 | int dirty; |
745 | 745 | ||
746 | spin_lock(&inode->i_lock); | 746 | spin_lock(&ci->i_ceph_lock); |
747 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); | 747 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); |
748 | spin_unlock(&inode->i_lock); | 748 | spin_unlock(&ci->i_ceph_lock); |
749 | ceph_put_cap_refs(ci, got); | 749 | ceph_put_cap_refs(ci, got); |
750 | 750 | ||
751 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); | 751 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); |
@@ -764,9 +764,9 @@ retry_snap: | |||
764 | 764 | ||
765 | if (ret >= 0) { | 765 | if (ret >= 0) { |
766 | int dirty; | 766 | int dirty; |
767 | spin_lock(&inode->i_lock); | 767 | spin_lock(&ci->i_ceph_lock); |
768 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); | 768 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); |
769 | spin_unlock(&inode->i_lock); | 769 | spin_unlock(&ci->i_ceph_lock); |
770 | if (dirty) | 770 | if (dirty) |
771 | __mark_inode_dirty(inode, dirty); | 771 | __mark_inode_dirty(inode, dirty); |
772 | } | 772 | } |
@@ -797,7 +797,8 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | |||
797 | 797 | ||
798 | mutex_lock(&inode->i_mutex); | 798 | mutex_lock(&inode->i_mutex); |
799 | __ceph_do_pending_vmtruncate(inode); | 799 | __ceph_do_pending_vmtruncate(inode); |
800 | if (origin != SEEK_CUR || origin != SEEK_SET) { | 800 | |
801 | if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) { | ||
801 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); | 802 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); |
802 | if (ret < 0) { | 803 | if (ret < 0) { |
803 | offset = ret; | 804 | offset = ret; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 116f36502f17..87fb132fb330 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -297,6 +297,8 @@ struct inode *ceph_alloc_inode(struct super_block *sb) | |||
297 | 297 | ||
298 | dout("alloc_inode %p\n", &ci->vfs_inode); | 298 | dout("alloc_inode %p\n", &ci->vfs_inode); |
299 | 299 | ||
300 | spin_lock_init(&ci->i_ceph_lock); | ||
301 | |||
300 | ci->i_version = 0; | 302 | ci->i_version = 0; |
301 | ci->i_time_warp_seq = 0; | 303 | ci->i_time_warp_seq = 0; |
302 | ci->i_ceph_flags = 0; | 304 | ci->i_ceph_flags = 0; |
@@ -583,7 +585,7 @@ static int fill_inode(struct inode *inode, | |||
583 | iinfo->xattr_len); | 585 | iinfo->xattr_len); |
584 | } | 586 | } |
585 | 587 | ||
586 | spin_lock(&inode->i_lock); | 588 | spin_lock(&ci->i_ceph_lock); |
587 | 589 | ||
588 | /* | 590 | /* |
589 | * provided version will be odd if inode value is projected, | 591 | * provided version will be odd if inode value is projected, |
@@ -680,7 +682,7 @@ static int fill_inode(struct inode *inode, | |||
680 | char *sym; | 682 | char *sym; |
681 | 683 | ||
682 | BUG_ON(symlen != inode->i_size); | 684 | BUG_ON(symlen != inode->i_size); |
683 | spin_unlock(&inode->i_lock); | 685 | spin_unlock(&ci->i_ceph_lock); |
684 | 686 | ||
685 | err = -ENOMEM; | 687 | err = -ENOMEM; |
686 | sym = kmalloc(symlen+1, GFP_NOFS); | 688 | sym = kmalloc(symlen+1, GFP_NOFS); |
@@ -689,7 +691,7 @@ static int fill_inode(struct inode *inode, | |||
689 | memcpy(sym, iinfo->symlink, symlen); | 691 | memcpy(sym, iinfo->symlink, symlen); |
690 | sym[symlen] = 0; | 692 | sym[symlen] = 0; |
691 | 693 | ||
692 | spin_lock(&inode->i_lock); | 694 | spin_lock(&ci->i_ceph_lock); |
693 | if (!ci->i_symlink) | 695 | if (!ci->i_symlink) |
694 | ci->i_symlink = sym; | 696 | ci->i_symlink = sym; |
695 | else | 697 | else |
@@ -715,7 +717,7 @@ static int fill_inode(struct inode *inode, | |||
715 | } | 717 | } |
716 | 718 | ||
717 | no_change: | 719 | no_change: |
718 | spin_unlock(&inode->i_lock); | 720 | spin_unlock(&ci->i_ceph_lock); |
719 | 721 | ||
720 | /* queue truncate if we saw i_size decrease */ | 722 | /* queue truncate if we saw i_size decrease */ |
721 | if (queue_trunc) | 723 | if (queue_trunc) |
@@ -750,13 +752,13 @@ no_change: | |||
750 | info->cap.flags, | 752 | info->cap.flags, |
751 | caps_reservation); | 753 | caps_reservation); |
752 | } else { | 754 | } else { |
753 | spin_lock(&inode->i_lock); | 755 | spin_lock(&ci->i_ceph_lock); |
754 | dout(" %p got snap_caps %s\n", inode, | 756 | dout(" %p got snap_caps %s\n", inode, |
755 | ceph_cap_string(le32_to_cpu(info->cap.caps))); | 757 | ceph_cap_string(le32_to_cpu(info->cap.caps))); |
756 | ci->i_snap_caps |= le32_to_cpu(info->cap.caps); | 758 | ci->i_snap_caps |= le32_to_cpu(info->cap.caps); |
757 | if (cap_fmode >= 0) | 759 | if (cap_fmode >= 0) |
758 | __ceph_get_fmode(ci, cap_fmode); | 760 | __ceph_get_fmode(ci, cap_fmode); |
759 | spin_unlock(&inode->i_lock); | 761 | spin_unlock(&ci->i_ceph_lock); |
760 | } | 762 | } |
761 | } else if (cap_fmode >= 0) { | 763 | } else if (cap_fmode >= 0) { |
762 | pr_warning("mds issued no caps on %llx.%llx\n", | 764 | pr_warning("mds issued no caps on %llx.%llx\n", |
@@ -849,19 +851,20 @@ static void ceph_set_dentry_offset(struct dentry *dn) | |||
849 | { | 851 | { |
850 | struct dentry *dir = dn->d_parent; | 852 | struct dentry *dir = dn->d_parent; |
851 | struct inode *inode = dir->d_inode; | 853 | struct inode *inode = dir->d_inode; |
854 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
852 | struct ceph_dentry_info *di; | 855 | struct ceph_dentry_info *di; |
853 | 856 | ||
854 | BUG_ON(!inode); | 857 | BUG_ON(!inode); |
855 | 858 | ||
856 | di = ceph_dentry(dn); | 859 | di = ceph_dentry(dn); |
857 | 860 | ||
858 | spin_lock(&inode->i_lock); | 861 | spin_lock(&ci->i_ceph_lock); |
859 | if (!ceph_dir_test_complete(inode)) { | 862 | if (!ceph_dir_test_complete(inode)) { |
860 | spin_unlock(&inode->i_lock); | 863 | spin_unlock(&ci->i_ceph_lock); |
861 | return; | 864 | return; |
862 | } | 865 | } |
863 | di->offset = ceph_inode(inode)->i_max_offset++; | 866 | di->offset = ceph_inode(inode)->i_max_offset++; |
864 | spin_unlock(&inode->i_lock); | 867 | spin_unlock(&ci->i_ceph_lock); |
865 | 868 | ||
866 | spin_lock(&dir->d_lock); | 869 | spin_lock(&dir->d_lock); |
867 | spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); | 870 | spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); |
@@ -1308,7 +1311,7 @@ int ceph_inode_set_size(struct inode *inode, loff_t size) | |||
1308 | struct ceph_inode_info *ci = ceph_inode(inode); | 1311 | struct ceph_inode_info *ci = ceph_inode(inode); |
1309 | int ret = 0; | 1312 | int ret = 0; |
1310 | 1313 | ||
1311 | spin_lock(&inode->i_lock); | 1314 | spin_lock(&ci->i_ceph_lock); |
1312 | dout("set_size %p %llu -> %llu\n", inode, inode->i_size, size); | 1315 | dout("set_size %p %llu -> %llu\n", inode, inode->i_size, size); |
1313 | inode->i_size = size; | 1316 | inode->i_size = size; |
1314 | inode->i_blocks = (size + (1 << 9) - 1) >> 9; | 1317 | inode->i_blocks = (size + (1 << 9) - 1) >> 9; |
@@ -1318,7 +1321,7 @@ int ceph_inode_set_size(struct inode *inode, loff_t size) | |||
1318 | (ci->i_reported_size << 1) < ci->i_max_size) | 1321 | (ci->i_reported_size << 1) < ci->i_max_size) |
1319 | ret = 1; | 1322 | ret = 1; |
1320 | 1323 | ||
1321 | spin_unlock(&inode->i_lock); | 1324 | spin_unlock(&ci->i_ceph_lock); |
1322 | return ret; | 1325 | return ret; |
1323 | } | 1326 | } |
1324 | 1327 | ||
@@ -1376,20 +1379,20 @@ static void ceph_invalidate_work(struct work_struct *work) | |||
1376 | u32 orig_gen; | 1379 | u32 orig_gen; |
1377 | int check = 0; | 1380 | int check = 0; |
1378 | 1381 | ||
1379 | spin_lock(&inode->i_lock); | 1382 | spin_lock(&ci->i_ceph_lock); |
1380 | dout("invalidate_pages %p gen %d revoking %d\n", inode, | 1383 | dout("invalidate_pages %p gen %d revoking %d\n", inode, |
1381 | ci->i_rdcache_gen, ci->i_rdcache_revoking); | 1384 | ci->i_rdcache_gen, ci->i_rdcache_revoking); |
1382 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { | 1385 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { |
1383 | /* nevermind! */ | 1386 | /* nevermind! */ |
1384 | spin_unlock(&inode->i_lock); | 1387 | spin_unlock(&ci->i_ceph_lock); |
1385 | goto out; | 1388 | goto out; |
1386 | } | 1389 | } |
1387 | orig_gen = ci->i_rdcache_gen; | 1390 | orig_gen = ci->i_rdcache_gen; |
1388 | spin_unlock(&inode->i_lock); | 1391 | spin_unlock(&ci->i_ceph_lock); |
1389 | 1392 | ||
1390 | truncate_inode_pages(&inode->i_data, 0); | 1393 | truncate_inode_pages(&inode->i_data, 0); |
1391 | 1394 | ||
1392 | spin_lock(&inode->i_lock); | 1395 | spin_lock(&ci->i_ceph_lock); |
1393 | if (orig_gen == ci->i_rdcache_gen && | 1396 | if (orig_gen == ci->i_rdcache_gen && |
1394 | orig_gen == ci->i_rdcache_revoking) { | 1397 | orig_gen == ci->i_rdcache_revoking) { |
1395 | dout("invalidate_pages %p gen %d successful\n", inode, | 1398 | dout("invalidate_pages %p gen %d successful\n", inode, |
@@ -1401,7 +1404,7 @@ static void ceph_invalidate_work(struct work_struct *work) | |||
1401 | inode, orig_gen, ci->i_rdcache_gen, | 1404 | inode, orig_gen, ci->i_rdcache_gen, |
1402 | ci->i_rdcache_revoking); | 1405 | ci->i_rdcache_revoking); |
1403 | } | 1406 | } |
1404 | spin_unlock(&inode->i_lock); | 1407 | spin_unlock(&ci->i_ceph_lock); |
1405 | 1408 | ||
1406 | if (check) | 1409 | if (check) |
1407 | ceph_check_caps(ci, 0, NULL); | 1410 | ceph_check_caps(ci, 0, NULL); |
@@ -1460,10 +1463,10 @@ void __ceph_do_pending_vmtruncate(struct inode *inode) | |||
1460 | int wrbuffer_refs, wake = 0; | 1463 | int wrbuffer_refs, wake = 0; |
1461 | 1464 | ||
1462 | retry: | 1465 | retry: |
1463 | spin_lock(&inode->i_lock); | 1466 | spin_lock(&ci->i_ceph_lock); |
1464 | if (ci->i_truncate_pending == 0) { | 1467 | if (ci->i_truncate_pending == 0) { |
1465 | dout("__do_pending_vmtruncate %p none pending\n", inode); | 1468 | dout("__do_pending_vmtruncate %p none pending\n", inode); |
1466 | spin_unlock(&inode->i_lock); | 1469 | spin_unlock(&ci->i_ceph_lock); |
1467 | return; | 1470 | return; |
1468 | } | 1471 | } |
1469 | 1472 | ||
@@ -1474,7 +1477,7 @@ retry: | |||
1474 | if (ci->i_wrbuffer_ref_head < ci->i_wrbuffer_ref) { | 1477 | if (ci->i_wrbuffer_ref_head < ci->i_wrbuffer_ref) { |
1475 | dout("__do_pending_vmtruncate %p flushing snaps first\n", | 1478 | dout("__do_pending_vmtruncate %p flushing snaps first\n", |
1476 | inode); | 1479 | inode); |
1477 | spin_unlock(&inode->i_lock); | 1480 | spin_unlock(&ci->i_ceph_lock); |
1478 | filemap_write_and_wait_range(&inode->i_data, 0, | 1481 | filemap_write_and_wait_range(&inode->i_data, 0, |
1479 | inode->i_sb->s_maxbytes); | 1482 | inode->i_sb->s_maxbytes); |
1480 | goto retry; | 1483 | goto retry; |
@@ -1484,15 +1487,15 @@ retry: | |||
1484 | wrbuffer_refs = ci->i_wrbuffer_ref; | 1487 | wrbuffer_refs = ci->i_wrbuffer_ref; |
1485 | dout("__do_pending_vmtruncate %p (%d) to %lld\n", inode, | 1488 | dout("__do_pending_vmtruncate %p (%d) to %lld\n", inode, |
1486 | ci->i_truncate_pending, to); | 1489 | ci->i_truncate_pending, to); |
1487 | spin_unlock(&inode->i_lock); | 1490 | spin_unlock(&ci->i_ceph_lock); |
1488 | 1491 | ||
1489 | truncate_inode_pages(inode->i_mapping, to); | 1492 | truncate_inode_pages(inode->i_mapping, to); |
1490 | 1493 | ||
1491 | spin_lock(&inode->i_lock); | 1494 | spin_lock(&ci->i_ceph_lock); |
1492 | ci->i_truncate_pending--; | 1495 | ci->i_truncate_pending--; |
1493 | if (ci->i_truncate_pending == 0) | 1496 | if (ci->i_truncate_pending == 0) |
1494 | wake = 1; | 1497 | wake = 1; |
1495 | spin_unlock(&inode->i_lock); | 1498 | spin_unlock(&ci->i_ceph_lock); |
1496 | 1499 | ||
1497 | if (wrbuffer_refs == 0) | 1500 | if (wrbuffer_refs == 0) |
1498 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 1501 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
@@ -1547,7 +1550,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1547 | if (IS_ERR(req)) | 1550 | if (IS_ERR(req)) |
1548 | return PTR_ERR(req); | 1551 | return PTR_ERR(req); |
1549 | 1552 | ||
1550 | spin_lock(&inode->i_lock); | 1553 | spin_lock(&ci->i_ceph_lock); |
1551 | issued = __ceph_caps_issued(ci, NULL); | 1554 | issued = __ceph_caps_issued(ci, NULL); |
1552 | dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); | 1555 | dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); |
1553 | 1556 | ||
@@ -1695,7 +1698,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1695 | } | 1698 | } |
1696 | 1699 | ||
1697 | release &= issued; | 1700 | release &= issued; |
1698 | spin_unlock(&inode->i_lock); | 1701 | spin_unlock(&ci->i_ceph_lock); |
1699 | 1702 | ||
1700 | if (inode_dirty_flags) | 1703 | if (inode_dirty_flags) |
1701 | __mark_inode_dirty(inode, inode_dirty_flags); | 1704 | __mark_inode_dirty(inode, inode_dirty_flags); |
@@ -1717,7 +1720,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1717 | __ceph_do_pending_vmtruncate(inode); | 1720 | __ceph_do_pending_vmtruncate(inode); |
1718 | return err; | 1721 | return err; |
1719 | out: | 1722 | out: |
1720 | spin_unlock(&inode->i_lock); | 1723 | spin_unlock(&ci->i_ceph_lock); |
1721 | ceph_mdsc_put_request(req); | 1724 | ceph_mdsc_put_request(req); |
1722 | return err; | 1725 | return err; |
1723 | } | 1726 | } |
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index 5a14c29cbba6..790914a598dd 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
@@ -241,11 +241,11 @@ static long ceph_ioctl_lazyio(struct file *file) | |||
241 | struct ceph_inode_info *ci = ceph_inode(inode); | 241 | struct ceph_inode_info *ci = ceph_inode(inode); |
242 | 242 | ||
243 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { | 243 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { |
244 | spin_lock(&inode->i_lock); | 244 | spin_lock(&ci->i_ceph_lock); |
245 | ci->i_nr_by_mode[fi->fmode]--; | 245 | ci->i_nr_by_mode[fi->fmode]--; |
246 | fi->fmode |= CEPH_FILE_MODE_LAZY; | 246 | fi->fmode |= CEPH_FILE_MODE_LAZY; |
247 | ci->i_nr_by_mode[fi->fmode]++; | 247 | ci->i_nr_by_mode[fi->fmode]++; |
248 | spin_unlock(&inode->i_lock); | 248 | spin_unlock(&ci->i_ceph_lock); |
249 | dout("ioctl_layzio: file %p marked lazy\n", file); | 249 | dout("ioctl_layzio: file %p marked lazy\n", file); |
250 | 250 | ||
251 | ceph_check_caps(ci, 0, NULL); | 251 | ceph_check_caps(ci, 0, NULL); |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 264ab701154f..6203d805eb45 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -732,21 +732,21 @@ static int __choose_mds(struct ceph_mds_client *mdsc, | |||
732 | } | 732 | } |
733 | } | 733 | } |
734 | 734 | ||
735 | spin_lock(&inode->i_lock); | 735 | spin_lock(&ci->i_ceph_lock); |
736 | cap = NULL; | 736 | cap = NULL; |
737 | if (mode == USE_AUTH_MDS) | 737 | if (mode == USE_AUTH_MDS) |
738 | cap = ci->i_auth_cap; | 738 | cap = ci->i_auth_cap; |
739 | if (!cap && !RB_EMPTY_ROOT(&ci->i_caps)) | 739 | if (!cap && !RB_EMPTY_ROOT(&ci->i_caps)) |
740 | cap = rb_entry(rb_first(&ci->i_caps), struct ceph_cap, ci_node); | 740 | cap = rb_entry(rb_first(&ci->i_caps), struct ceph_cap, ci_node); |
741 | if (!cap) { | 741 | if (!cap) { |
742 | spin_unlock(&inode->i_lock); | 742 | spin_unlock(&ci->i_ceph_lock); |
743 | goto random; | 743 | goto random; |
744 | } | 744 | } |
745 | mds = cap->session->s_mds; | 745 | mds = cap->session->s_mds; |
746 | dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n", | 746 | dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n", |
747 | inode, ceph_vinop(inode), mds, | 747 | inode, ceph_vinop(inode), mds, |
748 | cap == ci->i_auth_cap ? "auth " : "", cap); | 748 | cap == ci->i_auth_cap ? "auth " : "", cap); |
749 | spin_unlock(&inode->i_lock); | 749 | spin_unlock(&ci->i_ceph_lock); |
750 | return mds; | 750 | return mds; |
751 | 751 | ||
752 | random: | 752 | random: |
@@ -951,7 +951,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
951 | 951 | ||
952 | dout("removing cap %p, ci is %p, inode is %p\n", | 952 | dout("removing cap %p, ci is %p, inode is %p\n", |
953 | cap, ci, &ci->vfs_inode); | 953 | cap, ci, &ci->vfs_inode); |
954 | spin_lock(&inode->i_lock); | 954 | spin_lock(&ci->i_ceph_lock); |
955 | __ceph_remove_cap(cap); | 955 | __ceph_remove_cap(cap); |
956 | if (!__ceph_is_any_real_caps(ci)) { | 956 | if (!__ceph_is_any_real_caps(ci)) { |
957 | struct ceph_mds_client *mdsc = | 957 | struct ceph_mds_client *mdsc = |
@@ -984,7 +984,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
984 | } | 984 | } |
985 | spin_unlock(&mdsc->cap_dirty_lock); | 985 | spin_unlock(&mdsc->cap_dirty_lock); |
986 | } | 986 | } |
987 | spin_unlock(&inode->i_lock); | 987 | spin_unlock(&ci->i_ceph_lock); |
988 | while (drop--) | 988 | while (drop--) |
989 | iput(inode); | 989 | iput(inode); |
990 | return 0; | 990 | return 0; |
@@ -1015,10 +1015,10 @@ static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap, | |||
1015 | 1015 | ||
1016 | wake_up_all(&ci->i_cap_wq); | 1016 | wake_up_all(&ci->i_cap_wq); |
1017 | if (arg) { | 1017 | if (arg) { |
1018 | spin_lock(&inode->i_lock); | 1018 | spin_lock(&ci->i_ceph_lock); |
1019 | ci->i_wanted_max_size = 0; | 1019 | ci->i_wanted_max_size = 0; |
1020 | ci->i_requested_max_size = 0; | 1020 | ci->i_requested_max_size = 0; |
1021 | spin_unlock(&inode->i_lock); | 1021 | spin_unlock(&ci->i_ceph_lock); |
1022 | } | 1022 | } |
1023 | return 0; | 1023 | return 0; |
1024 | } | 1024 | } |
@@ -1151,7 +1151,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
1151 | if (session->s_trim_caps <= 0) | 1151 | if (session->s_trim_caps <= 0) |
1152 | return -1; | 1152 | return -1; |
1153 | 1153 | ||
1154 | spin_lock(&inode->i_lock); | 1154 | spin_lock(&ci->i_ceph_lock); |
1155 | mine = cap->issued | cap->implemented; | 1155 | mine = cap->issued | cap->implemented; |
1156 | used = __ceph_caps_used(ci); | 1156 | used = __ceph_caps_used(ci); |
1157 | oissued = __ceph_caps_issued_other(ci, cap); | 1157 | oissued = __ceph_caps_issued_other(ci, cap); |
@@ -1170,7 +1170,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
1170 | __ceph_remove_cap(cap); | 1170 | __ceph_remove_cap(cap); |
1171 | } else { | 1171 | } else { |
1172 | /* try to drop referring dentries */ | 1172 | /* try to drop referring dentries */ |
1173 | spin_unlock(&inode->i_lock); | 1173 | spin_unlock(&ci->i_ceph_lock); |
1174 | d_prune_aliases(inode); | 1174 | d_prune_aliases(inode); |
1175 | dout("trim_caps_cb %p cap %p pruned, count now %d\n", | 1175 | dout("trim_caps_cb %p cap %p pruned, count now %d\n", |
1176 | inode, cap, atomic_read(&inode->i_count)); | 1176 | inode, cap, atomic_read(&inode->i_count)); |
@@ -1178,7 +1178,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | out: | 1180 | out: |
1181 | spin_unlock(&inode->i_lock); | 1181 | spin_unlock(&ci->i_ceph_lock); |
1182 | return 0; | 1182 | return 0; |
1183 | } | 1183 | } |
1184 | 1184 | ||
@@ -1296,7 +1296,7 @@ static int check_cap_flush(struct ceph_mds_client *mdsc, u64 want_flush_seq) | |||
1296 | i_flushing_item); | 1296 | i_flushing_item); |
1297 | struct inode *inode = &ci->vfs_inode; | 1297 | struct inode *inode = &ci->vfs_inode; |
1298 | 1298 | ||
1299 | spin_lock(&inode->i_lock); | 1299 | spin_lock(&ci->i_ceph_lock); |
1300 | if (ci->i_cap_flush_seq <= want_flush_seq) { | 1300 | if (ci->i_cap_flush_seq <= want_flush_seq) { |
1301 | dout("check_cap_flush still flushing %p " | 1301 | dout("check_cap_flush still flushing %p " |
1302 | "seq %lld <= %lld to mds%d\n", inode, | 1302 | "seq %lld <= %lld to mds%d\n", inode, |
@@ -1304,7 +1304,7 @@ static int check_cap_flush(struct ceph_mds_client *mdsc, u64 want_flush_seq) | |||
1304 | session->s_mds); | 1304 | session->s_mds); |
1305 | ret = 0; | 1305 | ret = 0; |
1306 | } | 1306 | } |
1307 | spin_unlock(&inode->i_lock); | 1307 | spin_unlock(&ci->i_ceph_lock); |
1308 | } | 1308 | } |
1309 | mutex_unlock(&session->s_mutex); | 1309 | mutex_unlock(&session->s_mutex); |
1310 | ceph_put_mds_session(session); | 1310 | ceph_put_mds_session(session); |
@@ -1495,6 +1495,7 @@ retry: | |||
1495 | pos, temp); | 1495 | pos, temp); |
1496 | } else if (stop_on_nosnap && inode && | 1496 | } else if (stop_on_nosnap && inode && |
1497 | ceph_snap(inode) == CEPH_NOSNAP) { | 1497 | ceph_snap(inode) == CEPH_NOSNAP) { |
1498 | spin_unlock(&temp->d_lock); | ||
1498 | break; | 1499 | break; |
1499 | } else { | 1500 | } else { |
1500 | pos -= temp->d_name.len; | 1501 | pos -= temp->d_name.len; |
@@ -2011,10 +2012,10 @@ void ceph_invalidate_dir_request(struct ceph_mds_request *req) | |||
2011 | struct ceph_inode_info *ci = ceph_inode(inode); | 2012 | struct ceph_inode_info *ci = ceph_inode(inode); |
2012 | 2013 | ||
2013 | dout("invalidate_dir_request %p (D_COMPLETE, lease(s))\n", inode); | 2014 | dout("invalidate_dir_request %p (D_COMPLETE, lease(s))\n", inode); |
2014 | spin_lock(&inode->i_lock); | 2015 | spin_lock(&ci->i_ceph_lock); |
2015 | ceph_dir_clear_complete(inode); | 2016 | ceph_dir_clear_complete(inode); |
2016 | ci->i_release_count++; | 2017 | ci->i_release_count++; |
2017 | spin_unlock(&inode->i_lock); | 2018 | spin_unlock(&ci->i_ceph_lock); |
2018 | 2019 | ||
2019 | if (req->r_dentry) | 2020 | if (req->r_dentry) |
2020 | ceph_invalidate_dentry_lease(req->r_dentry); | 2021 | ceph_invalidate_dentry_lease(req->r_dentry); |
@@ -2422,7 +2423,7 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
2422 | if (err) | 2423 | if (err) |
2423 | goto out_free; | 2424 | goto out_free; |
2424 | 2425 | ||
2425 | spin_lock(&inode->i_lock); | 2426 | spin_lock(&ci->i_ceph_lock); |
2426 | cap->seq = 0; /* reset cap seq */ | 2427 | cap->seq = 0; /* reset cap seq */ |
2427 | cap->issue_seq = 0; /* and issue_seq */ | 2428 | cap->issue_seq = 0; /* and issue_seq */ |
2428 | 2429 | ||
@@ -2445,7 +2446,7 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
2445 | rec.v1.pathbase = cpu_to_le64(pathbase); | 2446 | rec.v1.pathbase = cpu_to_le64(pathbase); |
2446 | reclen = sizeof(rec.v1); | 2447 | reclen = sizeof(rec.v1); |
2447 | } | 2448 | } |
2448 | spin_unlock(&inode->i_lock); | 2449 | spin_unlock(&ci->i_ceph_lock); |
2449 | 2450 | ||
2450 | if (recon_state->flock) { | 2451 | if (recon_state->flock) { |
2451 | int num_fcntl_locks, num_flock_locks; | 2452 | int num_fcntl_locks, num_flock_locks; |
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 4bb239921dbd..a50ca0e39475 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | * mdsc->snap_rwsem | 21 | * mdsc->snap_rwsem |
22 | * | 22 | * |
23 | * inode->i_lock | 23 | * ci->i_ceph_lock |
24 | * mdsc->snap_flush_lock | 24 | * mdsc->snap_flush_lock |
25 | * mdsc->cap_delay_lock | 25 | * mdsc->cap_delay_lock |
26 | * | 26 | * |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index e26437191333..a559c80f127a 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -446,7 +446,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | 448 | ||
449 | spin_lock(&inode->i_lock); | 449 | spin_lock(&ci->i_ceph_lock); |
450 | used = __ceph_caps_used(ci); | 450 | used = __ceph_caps_used(ci); |
451 | dirty = __ceph_caps_dirty(ci); | 451 | dirty = __ceph_caps_dirty(ci); |
452 | 452 | ||
@@ -528,7 +528,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
528 | kfree(capsnap); | 528 | kfree(capsnap); |
529 | } | 529 | } |
530 | 530 | ||
531 | spin_unlock(&inode->i_lock); | 531 | spin_unlock(&ci->i_ceph_lock); |
532 | } | 532 | } |
533 | 533 | ||
534 | /* | 534 | /* |
@@ -537,7 +537,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
537 | * | 537 | * |
538 | * If capsnap can now be flushed, add to snap_flush list, and return 1. | 538 | * If capsnap can now be flushed, add to snap_flush list, and return 1. |
539 | * | 539 | * |
540 | * Caller must hold i_lock. | 540 | * Caller must hold i_ceph_lock. |
541 | */ | 541 | */ |
542 | int __ceph_finish_cap_snap(struct ceph_inode_info *ci, | 542 | int __ceph_finish_cap_snap(struct ceph_inode_info *ci, |
543 | struct ceph_cap_snap *capsnap) | 543 | struct ceph_cap_snap *capsnap) |
@@ -739,9 +739,9 @@ static void flush_snaps(struct ceph_mds_client *mdsc) | |||
739 | inode = &ci->vfs_inode; | 739 | inode = &ci->vfs_inode; |
740 | ihold(inode); | 740 | ihold(inode); |
741 | spin_unlock(&mdsc->snap_flush_lock); | 741 | spin_unlock(&mdsc->snap_flush_lock); |
742 | spin_lock(&inode->i_lock); | 742 | spin_lock(&ci->i_ceph_lock); |
743 | __ceph_flush_snaps(ci, &session, 0); | 743 | __ceph_flush_snaps(ci, &session, 0); |
744 | spin_unlock(&inode->i_lock); | 744 | spin_unlock(&ci->i_ceph_lock); |
745 | iput(inode); | 745 | iput(inode); |
746 | spin_lock(&mdsc->snap_flush_lock); | 746 | spin_lock(&mdsc->snap_flush_lock); |
747 | } | 747 | } |
@@ -847,7 +847,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
847 | continue; | 847 | continue; |
848 | ci = ceph_inode(inode); | 848 | ci = ceph_inode(inode); |
849 | 849 | ||
850 | spin_lock(&inode->i_lock); | 850 | spin_lock(&ci->i_ceph_lock); |
851 | if (!ci->i_snap_realm) | 851 | if (!ci->i_snap_realm) |
852 | goto skip_inode; | 852 | goto skip_inode; |
853 | /* | 853 | /* |
@@ -876,7 +876,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
876 | oldrealm = ci->i_snap_realm; | 876 | oldrealm = ci->i_snap_realm; |
877 | ci->i_snap_realm = realm; | 877 | ci->i_snap_realm = realm; |
878 | spin_unlock(&realm->inodes_with_caps_lock); | 878 | spin_unlock(&realm->inodes_with_caps_lock); |
879 | spin_unlock(&inode->i_lock); | 879 | spin_unlock(&ci->i_ceph_lock); |
880 | 880 | ||
881 | ceph_get_snap_realm(mdsc, realm); | 881 | ceph_get_snap_realm(mdsc, realm); |
882 | ceph_put_snap_realm(mdsc, oldrealm); | 882 | ceph_put_snap_realm(mdsc, oldrealm); |
@@ -885,7 +885,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
885 | continue; | 885 | continue; |
886 | 886 | ||
887 | skip_inode: | 887 | skip_inode: |
888 | spin_unlock(&inode->i_lock); | 888 | spin_unlock(&ci->i_ceph_lock); |
889 | iput(inode); | 889 | iput(inode); |
890 | } | 890 | } |
891 | 891 | ||
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 8dc73a594a90..b48f15f101a0 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -383,7 +383,7 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
383 | if (fsopt->rsize != CEPH_RSIZE_DEFAULT) | 383 | if (fsopt->rsize != CEPH_RSIZE_DEFAULT) |
384 | seq_printf(m, ",rsize=%d", fsopt->rsize); | 384 | seq_printf(m, ",rsize=%d", fsopt->rsize); |
385 | if (fsopt->rasize != CEPH_RASIZE_DEFAULT) | 385 | if (fsopt->rasize != CEPH_RASIZE_DEFAULT) |
386 | seq_printf(m, ",rasize=%d", fsopt->rsize); | 386 | seq_printf(m, ",rasize=%d", fsopt->rasize); |
387 | if (fsopt->congestion_kb != default_congestion_kb()) | 387 | if (fsopt->congestion_kb != default_congestion_kb()) |
388 | seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb); | 388 | seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb); |
389 | if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) | 389 | if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 01bf189e08a9..edcbf3774a56 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -220,7 +220,7 @@ struct ceph_dentry_info { | |||
220 | * The locking for D_COMPLETE is a bit odd: | 220 | * The locking for D_COMPLETE is a bit odd: |
221 | * - we can clear it at almost any time (see ceph_d_prune) | 221 | * - we can clear it at almost any time (see ceph_d_prune) |
222 | * - it is only meaningful if: | 222 | * - it is only meaningful if: |
223 | * - we hold dir inode i_lock | 223 | * - we hold dir inode i_ceph_lock |
224 | * - we hold dir FILE_SHARED caps | 224 | * - we hold dir FILE_SHARED caps |
225 | * - the dentry D_COMPLETE is set | 225 | * - the dentry D_COMPLETE is set |
226 | */ | 226 | */ |
@@ -250,6 +250,8 @@ struct ceph_inode_xattrs_info { | |||
250 | struct ceph_inode_info { | 250 | struct ceph_inode_info { |
251 | struct ceph_vino i_vino; /* ceph ino + snap */ | 251 | struct ceph_vino i_vino; /* ceph ino + snap */ |
252 | 252 | ||
253 | spinlock_t i_ceph_lock; | ||
254 | |||
253 | u64 i_version; | 255 | u64 i_version; |
254 | u32 i_time_warp_seq; | 256 | u32 i_time_warp_seq; |
255 | 257 | ||
@@ -271,7 +273,7 @@ struct ceph_inode_info { | |||
271 | 273 | ||
272 | struct ceph_inode_xattrs_info i_xattrs; | 274 | struct ceph_inode_xattrs_info i_xattrs; |
273 | 275 | ||
274 | /* capabilities. protected _both_ by i_lock and cap->session's | 276 | /* capabilities. protected _both_ by i_ceph_lock and cap->session's |
275 | * s_mutex. */ | 277 | * s_mutex. */ |
276 | struct rb_root i_caps; /* cap list */ | 278 | struct rb_root i_caps; /* cap list */ |
277 | struct ceph_cap *i_auth_cap; /* authoritative cap, if any */ | 279 | struct ceph_cap *i_auth_cap; /* authoritative cap, if any */ |
@@ -437,18 +439,18 @@ static inline void ceph_i_clear(struct inode *inode, unsigned mask) | |||
437 | { | 439 | { |
438 | struct ceph_inode_info *ci = ceph_inode(inode); | 440 | struct ceph_inode_info *ci = ceph_inode(inode); |
439 | 441 | ||
440 | spin_lock(&inode->i_lock); | 442 | spin_lock(&ci->i_ceph_lock); |
441 | ci->i_ceph_flags &= ~mask; | 443 | ci->i_ceph_flags &= ~mask; |
442 | spin_unlock(&inode->i_lock); | 444 | spin_unlock(&ci->i_ceph_lock); |
443 | } | 445 | } |
444 | 446 | ||
445 | static inline void ceph_i_set(struct inode *inode, unsigned mask) | 447 | static inline void ceph_i_set(struct inode *inode, unsigned mask) |
446 | { | 448 | { |
447 | struct ceph_inode_info *ci = ceph_inode(inode); | 449 | struct ceph_inode_info *ci = ceph_inode(inode); |
448 | 450 | ||
449 | spin_lock(&inode->i_lock); | 451 | spin_lock(&ci->i_ceph_lock); |
450 | ci->i_ceph_flags |= mask; | 452 | ci->i_ceph_flags |= mask; |
451 | spin_unlock(&inode->i_lock); | 453 | spin_unlock(&ci->i_ceph_lock); |
452 | } | 454 | } |
453 | 455 | ||
454 | static inline bool ceph_i_test(struct inode *inode, unsigned mask) | 456 | static inline bool ceph_i_test(struct inode *inode, unsigned mask) |
@@ -456,9 +458,9 @@ static inline bool ceph_i_test(struct inode *inode, unsigned mask) | |||
456 | struct ceph_inode_info *ci = ceph_inode(inode); | 458 | struct ceph_inode_info *ci = ceph_inode(inode); |
457 | bool r; | 459 | bool r; |
458 | 460 | ||
459 | spin_lock(&inode->i_lock); | 461 | spin_lock(&ci->i_ceph_lock); |
460 | r = (ci->i_ceph_flags & mask) == mask; | 462 | r = (ci->i_ceph_flags & mask) == mask; |
461 | spin_unlock(&inode->i_lock); | 463 | spin_unlock(&ci->i_ceph_lock); |
462 | return r; | 464 | return r; |
463 | } | 465 | } |
464 | 466 | ||
@@ -508,9 +510,9 @@ extern int __ceph_caps_issued_other(struct ceph_inode_info *ci, | |||
508 | static inline int ceph_caps_issued(struct ceph_inode_info *ci) | 510 | static inline int ceph_caps_issued(struct ceph_inode_info *ci) |
509 | { | 511 | { |
510 | int issued; | 512 | int issued; |
511 | spin_lock(&ci->vfs_inode.i_lock); | 513 | spin_lock(&ci->i_ceph_lock); |
512 | issued = __ceph_caps_issued(ci, NULL); | 514 | issued = __ceph_caps_issued(ci, NULL); |
513 | spin_unlock(&ci->vfs_inode.i_lock); | 515 | spin_unlock(&ci->i_ceph_lock); |
514 | return issued; | 516 | return issued; |
515 | } | 517 | } |
516 | 518 | ||
@@ -518,9 +520,9 @@ static inline int ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, | |||
518 | int touch) | 520 | int touch) |
519 | { | 521 | { |
520 | int r; | 522 | int r; |
521 | spin_lock(&ci->vfs_inode.i_lock); | 523 | spin_lock(&ci->i_ceph_lock); |
522 | r = __ceph_caps_issued_mask(ci, mask, touch); | 524 | r = __ceph_caps_issued_mask(ci, mask, touch); |
523 | spin_unlock(&ci->vfs_inode.i_lock); | 525 | spin_unlock(&ci->i_ceph_lock); |
524 | return r; | 526 | return r; |
525 | } | 527 | } |
526 | 528 | ||
@@ -743,10 +745,9 @@ extern int ceph_add_cap(struct inode *inode, | |||
743 | extern void __ceph_remove_cap(struct ceph_cap *cap); | 745 | extern void __ceph_remove_cap(struct ceph_cap *cap); |
744 | static inline void ceph_remove_cap(struct ceph_cap *cap) | 746 | static inline void ceph_remove_cap(struct ceph_cap *cap) |
745 | { | 747 | { |
746 | struct inode *inode = &cap->ci->vfs_inode; | 748 | spin_lock(&cap->ci->i_ceph_lock); |
747 | spin_lock(&inode->i_lock); | ||
748 | __ceph_remove_cap(cap); | 749 | __ceph_remove_cap(cap); |
749 | spin_unlock(&inode->i_lock); | 750 | spin_unlock(&cap->ci->i_ceph_lock); |
750 | } | 751 | } |
751 | extern void ceph_put_cap(struct ceph_mds_client *mdsc, | 752 | extern void ceph_put_cap(struct ceph_mds_client *mdsc, |
752 | struct ceph_cap *cap); | 753 | struct ceph_cap *cap); |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 96c6739a0280..a5e36e4488a7 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
@@ -343,8 +343,8 @@ void __ceph_destroy_xattrs(struct ceph_inode_info *ci) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | static int __build_xattrs(struct inode *inode) | 345 | static int __build_xattrs(struct inode *inode) |
346 | __releases(inode->i_lock) | 346 | __releases(ci->i_ceph_lock) |
347 | __acquires(inode->i_lock) | 347 | __acquires(ci->i_ceph_lock) |
348 | { | 348 | { |
349 | u32 namelen; | 349 | u32 namelen; |
350 | u32 numattr = 0; | 350 | u32 numattr = 0; |
@@ -372,7 +372,7 @@ start: | |||
372 | end = p + ci->i_xattrs.blob->vec.iov_len; | 372 | end = p + ci->i_xattrs.blob->vec.iov_len; |
373 | ceph_decode_32_safe(&p, end, numattr, bad); | 373 | ceph_decode_32_safe(&p, end, numattr, bad); |
374 | xattr_version = ci->i_xattrs.version; | 374 | xattr_version = ci->i_xattrs.version; |
375 | spin_unlock(&inode->i_lock); | 375 | spin_unlock(&ci->i_ceph_lock); |
376 | 376 | ||
377 | xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *), | 377 | xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *), |
378 | GFP_NOFS); | 378 | GFP_NOFS); |
@@ -387,7 +387,7 @@ start: | |||
387 | goto bad_lock; | 387 | goto bad_lock; |
388 | } | 388 | } |
389 | 389 | ||
390 | spin_lock(&inode->i_lock); | 390 | spin_lock(&ci->i_ceph_lock); |
391 | if (ci->i_xattrs.version != xattr_version) { | 391 | if (ci->i_xattrs.version != xattr_version) { |
392 | /* lost a race, retry */ | 392 | /* lost a race, retry */ |
393 | for (i = 0; i < numattr; i++) | 393 | for (i = 0; i < numattr; i++) |
@@ -418,7 +418,7 @@ start: | |||
418 | 418 | ||
419 | return err; | 419 | return err; |
420 | bad_lock: | 420 | bad_lock: |
421 | spin_lock(&inode->i_lock); | 421 | spin_lock(&ci->i_ceph_lock); |
422 | bad: | 422 | bad: |
423 | if (xattrs) { | 423 | if (xattrs) { |
424 | for (i = 0; i < numattr; i++) | 424 | for (i = 0; i < numattr; i++) |
@@ -512,7 +512,7 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value, | |||
512 | if (vxattrs) | 512 | if (vxattrs) |
513 | vxattr = ceph_match_vxattr(vxattrs, name); | 513 | vxattr = ceph_match_vxattr(vxattrs, name); |
514 | 514 | ||
515 | spin_lock(&inode->i_lock); | 515 | spin_lock(&ci->i_ceph_lock); |
516 | dout("getxattr %p ver=%lld index_ver=%lld\n", inode, | 516 | dout("getxattr %p ver=%lld index_ver=%lld\n", inode, |
517 | ci->i_xattrs.version, ci->i_xattrs.index_version); | 517 | ci->i_xattrs.version, ci->i_xattrs.index_version); |
518 | 518 | ||
@@ -520,14 +520,14 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value, | |||
520 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { | 520 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { |
521 | goto get_xattr; | 521 | goto get_xattr; |
522 | } else { | 522 | } else { |
523 | spin_unlock(&inode->i_lock); | 523 | spin_unlock(&ci->i_ceph_lock); |
524 | /* get xattrs from mds (if we don't already have them) */ | 524 | /* get xattrs from mds (if we don't already have them) */ |
525 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); | 525 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); |
526 | if (err) | 526 | if (err) |
527 | return err; | 527 | return err; |
528 | } | 528 | } |
529 | 529 | ||
530 | spin_lock(&inode->i_lock); | 530 | spin_lock(&ci->i_ceph_lock); |
531 | 531 | ||
532 | if (vxattr && vxattr->readonly) { | 532 | if (vxattr && vxattr->readonly) { |
533 | err = vxattr->getxattr_cb(ci, value, size); | 533 | err = vxattr->getxattr_cb(ci, value, size); |
@@ -558,7 +558,7 @@ get_xattr: | |||
558 | memcpy(value, xattr->val, xattr->val_len); | 558 | memcpy(value, xattr->val, xattr->val_len); |
559 | 559 | ||
560 | out: | 560 | out: |
561 | spin_unlock(&inode->i_lock); | 561 | spin_unlock(&ci->i_ceph_lock); |
562 | return err; | 562 | return err; |
563 | } | 563 | } |
564 | 564 | ||
@@ -573,7 +573,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) | |||
573 | u32 len; | 573 | u32 len; |
574 | int i; | 574 | int i; |
575 | 575 | ||
576 | spin_lock(&inode->i_lock); | 576 | spin_lock(&ci->i_ceph_lock); |
577 | dout("listxattr %p ver=%lld index_ver=%lld\n", inode, | 577 | dout("listxattr %p ver=%lld index_ver=%lld\n", inode, |
578 | ci->i_xattrs.version, ci->i_xattrs.index_version); | 578 | ci->i_xattrs.version, ci->i_xattrs.index_version); |
579 | 579 | ||
@@ -581,13 +581,13 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) | |||
581 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { | 581 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { |
582 | goto list_xattr; | 582 | goto list_xattr; |
583 | } else { | 583 | } else { |
584 | spin_unlock(&inode->i_lock); | 584 | spin_unlock(&ci->i_ceph_lock); |
585 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); | 585 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); |
586 | if (err) | 586 | if (err) |
587 | return err; | 587 | return err; |
588 | } | 588 | } |
589 | 589 | ||
590 | spin_lock(&inode->i_lock); | 590 | spin_lock(&ci->i_ceph_lock); |
591 | 591 | ||
592 | err = __build_xattrs(inode); | 592 | err = __build_xattrs(inode); |
593 | if (err < 0) | 593 | if (err < 0) |
@@ -619,7 +619,7 @@ list_xattr: | |||
619 | } | 619 | } |
620 | 620 | ||
621 | out: | 621 | out: |
622 | spin_unlock(&inode->i_lock); | 622 | spin_unlock(&ci->i_ceph_lock); |
623 | return err; | 623 | return err; |
624 | } | 624 | } |
625 | 625 | ||
@@ -739,7 +739,7 @@ int ceph_setxattr(struct dentry *dentry, const char *name, | |||
739 | if (!xattr) | 739 | if (!xattr) |
740 | goto out; | 740 | goto out; |
741 | 741 | ||
742 | spin_lock(&inode->i_lock); | 742 | spin_lock(&ci->i_ceph_lock); |
743 | retry: | 743 | retry: |
744 | issued = __ceph_caps_issued(ci, NULL); | 744 | issued = __ceph_caps_issued(ci, NULL); |
745 | if (!(issued & CEPH_CAP_XATTR_EXCL)) | 745 | if (!(issued & CEPH_CAP_XATTR_EXCL)) |
@@ -752,12 +752,12 @@ retry: | |||
752 | required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) { | 752 | required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) { |
753 | struct ceph_buffer *blob = NULL; | 753 | struct ceph_buffer *blob = NULL; |
754 | 754 | ||
755 | spin_unlock(&inode->i_lock); | 755 | spin_unlock(&ci->i_ceph_lock); |
756 | dout(" preaallocating new blob size=%d\n", required_blob_size); | 756 | dout(" preaallocating new blob size=%d\n", required_blob_size); |
757 | blob = ceph_buffer_new(required_blob_size, GFP_NOFS); | 757 | blob = ceph_buffer_new(required_blob_size, GFP_NOFS); |
758 | if (!blob) | 758 | if (!blob) |
759 | goto out; | 759 | goto out; |
760 | spin_lock(&inode->i_lock); | 760 | spin_lock(&ci->i_ceph_lock); |
761 | if (ci->i_xattrs.prealloc_blob) | 761 | if (ci->i_xattrs.prealloc_blob) |
762 | ceph_buffer_put(ci->i_xattrs.prealloc_blob); | 762 | ceph_buffer_put(ci->i_xattrs.prealloc_blob); |
763 | ci->i_xattrs.prealloc_blob = blob; | 763 | ci->i_xattrs.prealloc_blob = blob; |
@@ -770,13 +770,13 @@ retry: | |||
770 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); | 770 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); |
771 | ci->i_xattrs.dirty = true; | 771 | ci->i_xattrs.dirty = true; |
772 | inode->i_ctime = CURRENT_TIME; | 772 | inode->i_ctime = CURRENT_TIME; |
773 | spin_unlock(&inode->i_lock); | 773 | spin_unlock(&ci->i_ceph_lock); |
774 | if (dirty) | 774 | if (dirty) |
775 | __mark_inode_dirty(inode, dirty); | 775 | __mark_inode_dirty(inode, dirty); |
776 | return err; | 776 | return err; |
777 | 777 | ||
778 | do_sync: | 778 | do_sync: |
779 | spin_unlock(&inode->i_lock); | 779 | spin_unlock(&ci->i_ceph_lock); |
780 | err = ceph_sync_setxattr(dentry, name, value, size, flags); | 780 | err = ceph_sync_setxattr(dentry, name, value, size, flags); |
781 | out: | 781 | out: |
782 | kfree(newname); | 782 | kfree(newname); |
@@ -833,7 +833,7 @@ int ceph_removexattr(struct dentry *dentry, const char *name) | |||
833 | return -EOPNOTSUPP; | 833 | return -EOPNOTSUPP; |
834 | } | 834 | } |
835 | 835 | ||
836 | spin_lock(&inode->i_lock); | 836 | spin_lock(&ci->i_ceph_lock); |
837 | __build_xattrs(inode); | 837 | __build_xattrs(inode); |
838 | issued = __ceph_caps_issued(ci, NULL); | 838 | issued = __ceph_caps_issued(ci, NULL); |
839 | dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued)); | 839 | dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued)); |
@@ -846,12 +846,12 @@ int ceph_removexattr(struct dentry *dentry, const char *name) | |||
846 | ci->i_xattrs.dirty = true; | 846 | ci->i_xattrs.dirty = true; |
847 | inode->i_ctime = CURRENT_TIME; | 847 | inode->i_ctime = CURRENT_TIME; |
848 | 848 | ||
849 | spin_unlock(&inode->i_lock); | 849 | spin_unlock(&ci->i_ceph_lock); |
850 | if (dirty) | 850 | if (dirty) |
851 | __mark_inode_dirty(inode, dirty); | 851 | __mark_inode_dirty(inode, dirty); |
852 | return err; | 852 | return err; |
853 | do_sync: | 853 | do_sync: |
854 | spin_unlock(&inode->i_lock); | 854 | spin_unlock(&ci->i_ceph_lock); |
855 | err = ceph_send_removexattr(dentry, name); | 855 | err = ceph_send_removexattr(dentry, name); |
856 | return err; | 856 | return err; |
857 | } | 857 | } |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index ca418aaf6352..9d8715c45f25 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -292,7 +292,7 @@ int __init configfs_inode_init(void) | |||
292 | return bdi_init(&configfs_backing_dev_info); | 292 | return bdi_init(&configfs_backing_dev_info); |
293 | } | 293 | } |
294 | 294 | ||
295 | void __exit configfs_inode_exit(void) | 295 | void configfs_inode_exit(void) |
296 | { | 296 | { |
297 | bdi_destroy(&configfs_backing_dev_info); | 297 | bdi_destroy(&configfs_backing_dev_info); |
298 | } | 298 | } |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index ecc62178beda..276e15cafd58 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
@@ -143,28 +143,26 @@ static int __init configfs_init(void) | |||
143 | goto out; | 143 | goto out; |
144 | 144 | ||
145 | config_kobj = kobject_create_and_add("config", kernel_kobj); | 145 | config_kobj = kobject_create_and_add("config", kernel_kobj); |
146 | if (!config_kobj) { | 146 | if (!config_kobj) |
147 | kmem_cache_destroy(configfs_dir_cachep); | 147 | goto out2; |
148 | configfs_dir_cachep = NULL; | 148 | |
149 | goto out; | 149 | err = configfs_inode_init(); |
150 | } | 150 | if (err) |
151 | goto out3; | ||
151 | 152 | ||
152 | err = register_filesystem(&configfs_fs_type); | 153 | err = register_filesystem(&configfs_fs_type); |
153 | if (err) { | 154 | if (err) |
154 | printk(KERN_ERR "configfs: Unable to register filesystem!\n"); | 155 | goto out4; |
155 | kobject_put(config_kobj); | ||
156 | kmem_cache_destroy(configfs_dir_cachep); | ||
157 | configfs_dir_cachep = NULL; | ||
158 | goto out; | ||
159 | } | ||
160 | 156 | ||
161 | err = configfs_inode_init(); | 157 | return 0; |
162 | if (err) { | 158 | out4: |
163 | unregister_filesystem(&configfs_fs_type); | 159 | printk(KERN_ERR "configfs: Unable to register filesystem!\n"); |
164 | kobject_put(config_kobj); | 160 | configfs_inode_exit(); |
165 | kmem_cache_destroy(configfs_dir_cachep); | 161 | out3: |
166 | configfs_dir_cachep = NULL; | 162 | kobject_put(config_kobj); |
167 | } | 163 | out2: |
164 | kmem_cache_destroy(configfs_dir_cachep); | ||
165 | configfs_dir_cachep = NULL; | ||
168 | out: | 166 | out: |
169 | return err; | 167 | return err; |
170 | } | 168 | } |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 61fa9e1614af..607b1557d292 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1095,7 +1095,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, | |||
1095 | le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block), | 1095 | le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block), |
1096 | ext4_idx_pblock(EXT_FIRST_INDEX(neh))); | 1096 | ext4_idx_pblock(EXT_FIRST_INDEX(neh))); |
1097 | 1097 | ||
1098 | neh->eh_depth = cpu_to_le16(neh->eh_depth + 1); | 1098 | neh->eh_depth = cpu_to_le16(le16_to_cpu(neh->eh_depth) + 1); |
1099 | ext4_mark_inode_dirty(handle, inode); | 1099 | ext4_mark_inode_dirty(handle, inode); |
1100 | out: | 1100 | out: |
1101 | brelse(bh); | 1101 | brelse(bh); |
@@ -2955,7 +2955,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
2955 | /* Pre-conditions */ | 2955 | /* Pre-conditions */ |
2956 | BUG_ON(!ext4_ext_is_uninitialized(ex)); | 2956 | BUG_ON(!ext4_ext_is_uninitialized(ex)); |
2957 | BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); | 2957 | BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); |
2958 | BUG_ON(map->m_lblk + map->m_len > ee_block + ee_len); | ||
2959 | 2958 | ||
2960 | /* | 2959 | /* |
2961 | * Attempt to transfer newly initialized blocks from the currently | 2960 | * Attempt to transfer newly initialized blocks from the currently |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 848f436df29f..92655fd89657 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1339,8 +1339,11 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd, | |||
1339 | clear_buffer_unwritten(bh); | 1339 | clear_buffer_unwritten(bh); |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | /* skip page if block allocation undone */ | 1342 | /* |
1343 | if (buffer_delay(bh) || buffer_unwritten(bh)) | 1343 | * skip page if block allocation undone and |
1344 | * block is dirty | ||
1345 | */ | ||
1346 | if (ext4_bh_delay_or_unwritten(NULL, bh)) | ||
1344 | skip_page = 1; | 1347 | skip_page = 1; |
1345 | bh = bh->b_this_page; | 1348 | bh = bh->b_this_page; |
1346 | block_start += bh->b_size; | 1349 | block_start += bh->b_size; |
@@ -2387,7 +2390,6 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, | |||
2387 | pgoff_t index; | 2390 | pgoff_t index; |
2388 | struct inode *inode = mapping->host; | 2391 | struct inode *inode = mapping->host; |
2389 | handle_t *handle; | 2392 | handle_t *handle; |
2390 | loff_t page_len; | ||
2391 | 2393 | ||
2392 | index = pos >> PAGE_CACHE_SHIFT; | 2394 | index = pos >> PAGE_CACHE_SHIFT; |
2393 | 2395 | ||
@@ -2434,13 +2436,6 @@ retry: | |||
2434 | */ | 2436 | */ |
2435 | if (pos + len > inode->i_size) | 2437 | if (pos + len > inode->i_size) |
2436 | ext4_truncate_failed_write(inode); | 2438 | ext4_truncate_failed_write(inode); |
2437 | } else { | ||
2438 | page_len = pos & (PAGE_CACHE_SIZE - 1); | ||
2439 | if (page_len > 0) { | ||
2440 | ret = ext4_discard_partial_page_buffers_no_lock(handle, | ||
2441 | inode, page, pos - page_len, page_len, | ||
2442 | EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED); | ||
2443 | } | ||
2444 | } | 2439 | } |
2445 | 2440 | ||
2446 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 2441 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
@@ -2483,7 +2478,6 @@ static int ext4_da_write_end(struct file *file, | |||
2483 | loff_t new_i_size; | 2478 | loff_t new_i_size; |
2484 | unsigned long start, end; | 2479 | unsigned long start, end; |
2485 | int write_mode = (int)(unsigned long)fsdata; | 2480 | int write_mode = (int)(unsigned long)fsdata; |
2486 | loff_t page_len; | ||
2487 | 2481 | ||
2488 | if (write_mode == FALL_BACK_TO_NONDELALLOC) { | 2482 | if (write_mode == FALL_BACK_TO_NONDELALLOC) { |
2489 | if (ext4_should_order_data(inode)) { | 2483 | if (ext4_should_order_data(inode)) { |
@@ -2508,7 +2502,7 @@ static int ext4_da_write_end(struct file *file, | |||
2508 | */ | 2502 | */ |
2509 | 2503 | ||
2510 | new_i_size = pos + copied; | 2504 | new_i_size = pos + copied; |
2511 | if (new_i_size > EXT4_I(inode)->i_disksize) { | 2505 | if (copied && new_i_size > EXT4_I(inode)->i_disksize) { |
2512 | if (ext4_da_should_update_i_disksize(page, end)) { | 2506 | if (ext4_da_should_update_i_disksize(page, end)) { |
2513 | down_write(&EXT4_I(inode)->i_data_sem); | 2507 | down_write(&EXT4_I(inode)->i_data_sem); |
2514 | if (new_i_size > EXT4_I(inode)->i_disksize) { | 2508 | if (new_i_size > EXT4_I(inode)->i_disksize) { |
@@ -2532,16 +2526,6 @@ static int ext4_da_write_end(struct file *file, | |||
2532 | } | 2526 | } |
2533 | ret2 = generic_write_end(file, mapping, pos, len, copied, | 2527 | ret2 = generic_write_end(file, mapping, pos, len, copied, |
2534 | page, fsdata); | 2528 | page, fsdata); |
2535 | |||
2536 | page_len = PAGE_CACHE_SIZE - | ||
2537 | ((pos + copied - 1) & (PAGE_CACHE_SIZE - 1)); | ||
2538 | |||
2539 | if (page_len > 0) { | ||
2540 | ret = ext4_discard_partial_page_buffers_no_lock(handle, | ||
2541 | inode, page, pos + copied - 1, page_len, | ||
2542 | EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED); | ||
2543 | } | ||
2544 | |||
2545 | copied = ret2; | 2529 | copied = ret2; |
2546 | if (ret2 < 0) | 2530 | if (ret2 < 0) |
2547 | ret = ret2; | 2531 | ret = ret2; |
@@ -2781,10 +2765,11 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, | |||
2781 | iocb->private, io_end->inode->i_ino, iocb, offset, | 2765 | iocb->private, io_end->inode->i_ino, iocb, offset, |
2782 | size); | 2766 | size); |
2783 | 2767 | ||
2768 | iocb->private = NULL; | ||
2769 | |||
2784 | /* if not aio dio with unwritten extents, just free io and return */ | 2770 | /* if not aio dio with unwritten extents, just free io and return */ |
2785 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | 2771 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { |
2786 | ext4_free_io_end(io_end); | 2772 | ext4_free_io_end(io_end); |
2787 | iocb->private = NULL; | ||
2788 | out: | 2773 | out: |
2789 | if (is_async) | 2774 | if (is_async) |
2790 | aio_complete(iocb, ret, 0); | 2775 | aio_complete(iocb, ret, 0); |
@@ -2807,7 +2792,6 @@ out: | |||
2807 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); | 2792 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
2808 | 2793 | ||
2809 | /* queue the work to convert unwritten extents to written */ | 2794 | /* queue the work to convert unwritten extents to written */ |
2810 | iocb->private = NULL; | ||
2811 | queue_work(wq, &io_end->work); | 2795 | queue_work(wq, &io_end->work); |
2812 | 2796 | ||
2813 | /* XXX: probably should move into the real I/O completion handler */ | 2797 | /* XXX: probably should move into the real I/O completion handler */ |
@@ -3203,26 +3187,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle, | |||
3203 | 3187 | ||
3204 | iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); | 3188 | iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); |
3205 | 3189 | ||
3206 | if (!page_has_buffers(page)) { | 3190 | if (!page_has_buffers(page)) |
3207 | /* | 3191 | create_empty_buffers(page, blocksize, 0); |
3208 | * If the range to be discarded covers a partial block | ||
3209 | * we need to get the page buffers. This is because | ||
3210 | * partial blocks cannot be released and the page needs | ||
3211 | * to be updated with the contents of the block before | ||
3212 | * we write the zeros on top of it. | ||
3213 | */ | ||
3214 | if ((from & (blocksize - 1)) || | ||
3215 | ((from + length) & (blocksize - 1))) { | ||
3216 | create_empty_buffers(page, blocksize, 0); | ||
3217 | } else { | ||
3218 | /* | ||
3219 | * If there are no partial blocks, | ||
3220 | * there is nothing to update, | ||
3221 | * so we can return now | ||
3222 | */ | ||
3223 | return 0; | ||
3224 | } | ||
3225 | } | ||
3226 | 3192 | ||
3227 | /* Find the buffer that contains "offset" */ | 3193 | /* Find the buffer that contains "offset" */ |
3228 | bh = page_buffers(page); | 3194 | bh = page_buffers(page); |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 7ce1d0b19c94..7e106c810c62 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -385,6 +385,18 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
385 | 385 | ||
386 | block_end = block_start + blocksize; | 386 | block_end = block_start + blocksize; |
387 | if (block_start >= len) { | 387 | if (block_start >= len) { |
388 | /* | ||
389 | * Comments copied from block_write_full_page_endio: | ||
390 | * | ||
391 | * The page straddles i_size. It must be zeroed out on | ||
392 | * each and every writepage invocation because it may | ||
393 | * be mmapped. "A file is mapped in multiples of the | ||
394 | * page size. For a file that is not a multiple of | ||
395 | * the page size, the remaining memory is zeroed when | ||
396 | * mapped, and writes to that region are not written | ||
397 | * out to the file." | ||
398 | */ | ||
399 | zero_user_segment(page, block_start, block_end); | ||
388 | clear_buffer_dirty(bh); | 400 | clear_buffer_dirty(bh); |
389 | set_buffer_uptodate(bh); | 401 | set_buffer_uptodate(bh); |
390 | continue; | 402 | continue; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3858767ec672..3e1329e2f826 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1155,9 +1155,9 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
1155 | seq_puts(seq, ",block_validity"); | 1155 | seq_puts(seq, ",block_validity"); |
1156 | 1156 | ||
1157 | if (!test_opt(sb, INIT_INODE_TABLE)) | 1157 | if (!test_opt(sb, INIT_INODE_TABLE)) |
1158 | seq_puts(seq, ",noinit_inode_table"); | 1158 | seq_puts(seq, ",noinit_itable"); |
1159 | else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) | 1159 | else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) |
1160 | seq_printf(seq, ",init_inode_table=%u", | 1160 | seq_printf(seq, ",init_itable=%u", |
1161 | (unsigned) sbi->s_li_wait_mult); | 1161 | (unsigned) sbi->s_li_wait_mult); |
1162 | 1162 | ||
1163 | ext4_show_quota_options(seq, sb); | 1163 | ext4_show_quota_options(seq, sb); |
@@ -1333,8 +1333,7 @@ enum { | |||
1333 | Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity, | 1333 | Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity, |
1334 | Opt_inode_readahead_blks, Opt_journal_ioprio, | 1334 | Opt_inode_readahead_blks, Opt_journal_ioprio, |
1335 | Opt_dioread_nolock, Opt_dioread_lock, | 1335 | Opt_dioread_nolock, Opt_dioread_lock, |
1336 | Opt_discard, Opt_nodiscard, | 1336 | Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable, |
1337 | Opt_init_inode_table, Opt_noinit_inode_table, | ||
1338 | }; | 1337 | }; |
1339 | 1338 | ||
1340 | static const match_table_t tokens = { | 1339 | static const match_table_t tokens = { |
@@ -1407,9 +1406,9 @@ static const match_table_t tokens = { | |||
1407 | {Opt_dioread_lock, "dioread_lock"}, | 1406 | {Opt_dioread_lock, "dioread_lock"}, |
1408 | {Opt_discard, "discard"}, | 1407 | {Opt_discard, "discard"}, |
1409 | {Opt_nodiscard, "nodiscard"}, | 1408 | {Opt_nodiscard, "nodiscard"}, |
1410 | {Opt_init_inode_table, "init_itable=%u"}, | 1409 | {Opt_init_itable, "init_itable=%u"}, |
1411 | {Opt_init_inode_table, "init_itable"}, | 1410 | {Opt_init_itable, "init_itable"}, |
1412 | {Opt_noinit_inode_table, "noinit_itable"}, | 1411 | {Opt_noinit_itable, "noinit_itable"}, |
1413 | {Opt_err, NULL}, | 1412 | {Opt_err, NULL}, |
1414 | }; | 1413 | }; |
1415 | 1414 | ||
@@ -1892,7 +1891,7 @@ set_qf_format: | |||
1892 | case Opt_dioread_lock: | 1891 | case Opt_dioread_lock: |
1893 | clear_opt(sb, DIOREAD_NOLOCK); | 1892 | clear_opt(sb, DIOREAD_NOLOCK); |
1894 | break; | 1893 | break; |
1895 | case Opt_init_inode_table: | 1894 | case Opt_init_itable: |
1896 | set_opt(sb, INIT_INODE_TABLE); | 1895 | set_opt(sb, INIT_INODE_TABLE); |
1897 | if (args[0].from) { | 1896 | if (args[0].from) { |
1898 | if (match_int(&args[0], &option)) | 1897 | if (match_int(&args[0], &option)) |
@@ -1903,7 +1902,7 @@ set_qf_format: | |||
1903 | return 0; | 1902 | return 0; |
1904 | sbi->s_li_wait_mult = option; | 1903 | sbi->s_li_wait_mult = option; |
1905 | break; | 1904 | break; |
1906 | case Opt_noinit_inode_table: | 1905 | case Opt_noinit_itable: |
1907 | clear_opt(sb, INIT_INODE_TABLE); | 1906 | clear_opt(sb, INIT_INODE_TABLE); |
1908 | break; | 1907 | break; |
1909 | default: | 1908 | default: |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 73c3992b2bb4..ac86f8b3e3cb 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -156,6 +156,7 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | |||
156 | * bdi_start_writeback - start writeback | 156 | * bdi_start_writeback - start writeback |
157 | * @bdi: the backing device to write from | 157 | * @bdi: the backing device to write from |
158 | * @nr_pages: the number of pages to write | 158 | * @nr_pages: the number of pages to write |
159 | * @reason: reason why some writeback work was initiated | ||
159 | * | 160 | * |
160 | * Description: | 161 | * Description: |
161 | * This does WB_SYNC_NONE opportunistic writeback. The IO is only | 162 | * This does WB_SYNC_NONE opportunistic writeback. The IO is only |
@@ -1223,6 +1224,7 @@ static void wait_sb_inodes(struct super_block *sb) | |||
1223 | * writeback_inodes_sb_nr - writeback dirty inodes from given super_block | 1224 | * writeback_inodes_sb_nr - writeback dirty inodes from given super_block |
1224 | * @sb: the superblock | 1225 | * @sb: the superblock |
1225 | * @nr: the number of pages to write | 1226 | * @nr: the number of pages to write |
1227 | * @reason: reason why some writeback work initiated | ||
1226 | * | 1228 | * |
1227 | * Start writeback on some inodes on this super_block. No guarantees are made | 1229 | * Start writeback on some inodes on this super_block. No guarantees are made |
1228 | * on how many (if any) will be written, and this function does not wait | 1230 | * on how many (if any) will be written, and this function does not wait |
@@ -1251,6 +1253,7 @@ EXPORT_SYMBOL(writeback_inodes_sb_nr); | |||
1251 | /** | 1253 | /** |
1252 | * writeback_inodes_sb - writeback dirty inodes from given super_block | 1254 | * writeback_inodes_sb - writeback dirty inodes from given super_block |
1253 | * @sb: the superblock | 1255 | * @sb: the superblock |
1256 | * @reason: reason why some writeback work was initiated | ||
1254 | * | 1257 | * |
1255 | * Start writeback on some inodes on this super_block. No guarantees are made | 1258 | * Start writeback on some inodes on this super_block. No guarantees are made |
1256 | * on how many (if any) will be written, and this function does not wait | 1259 | * on how many (if any) will be written, and this function does not wait |
@@ -1265,6 +1268,7 @@ EXPORT_SYMBOL(writeback_inodes_sb); | |||
1265 | /** | 1268 | /** |
1266 | * writeback_inodes_sb_if_idle - start writeback if none underway | 1269 | * writeback_inodes_sb_if_idle - start writeback if none underway |
1267 | * @sb: the superblock | 1270 | * @sb: the superblock |
1271 | * @reason: reason why some writeback work was initiated | ||
1268 | * | 1272 | * |
1269 | * Invoke writeback_inodes_sb if no writeback is currently underway. | 1273 | * Invoke writeback_inodes_sb if no writeback is currently underway. |
1270 | * Returns 1 if writeback was started, 0 if not. | 1274 | * Returns 1 if writeback was started, 0 if not. |
@@ -1285,6 +1289,7 @@ EXPORT_SYMBOL(writeback_inodes_sb_if_idle); | |||
1285 | * writeback_inodes_sb_if_idle - start writeback if none underway | 1289 | * writeback_inodes_sb_if_idle - start writeback if none underway |
1286 | * @sb: the superblock | 1290 | * @sb: the superblock |
1287 | * @nr: the number of pages to write | 1291 | * @nr: the number of pages to write |
1292 | * @reason: reason why some writeback work was initiated | ||
1288 | * | 1293 | * |
1289 | * Invoke writeback_inodes_sb if no writeback is currently underway. | 1294 | * Invoke writeback_inodes_sb if no writeback is currently underway. |
1290 | * Returns 1 if writeback was started, 0 if not. | 1295 | * Returns 1 if writeback was started, 0 if not. |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 5cb8614508c3..2aaf3eaaf13d 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -1512,7 +1512,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, | |||
1512 | else if (outarg->offset + num > file_size) | 1512 | else if (outarg->offset + num > file_size) |
1513 | num = file_size - outarg->offset; | 1513 | num = file_size - outarg->offset; |
1514 | 1514 | ||
1515 | while (num) { | 1515 | while (num && req->num_pages < FUSE_MAX_PAGES_PER_REQ) { |
1516 | struct page *page; | 1516 | struct page *page; |
1517 | unsigned int this_num; | 1517 | unsigned int this_num; |
1518 | 1518 | ||
@@ -1526,6 +1526,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, | |||
1526 | 1526 | ||
1527 | num -= this_num; | 1527 | num -= this_num; |
1528 | total_len += this_num; | 1528 | total_len += this_num; |
1529 | index++; | ||
1529 | } | 1530 | } |
1530 | req->misc.retrieve_in.offset = outarg->offset; | 1531 | req->misc.retrieve_in.offset = outarg->offset; |
1531 | req->misc.retrieve_in.size = total_len; | 1532 | req->misc.retrieve_in.size = total_len; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 594f07a81c28..0c84100acd44 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -1556,7 +1556,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | |||
1556 | struct inode *inode = file->f_path.dentry->d_inode; | 1556 | struct inode *inode = file->f_path.dentry->d_inode; |
1557 | 1557 | ||
1558 | mutex_lock(&inode->i_mutex); | 1558 | mutex_lock(&inode->i_mutex); |
1559 | if (origin != SEEK_CUR || origin != SEEK_SET) { | 1559 | if (origin != SEEK_CUR && origin != SEEK_SET) { |
1560 | retval = fuse_update_attributes(inode, NULL, file, NULL); | 1560 | retval = fuse_update_attributes(inode, NULL, file, NULL); |
1561 | if (retval) | 1561 | if (retval) |
1562 | goto exit; | 1562 | goto exit; |
@@ -1567,6 +1567,10 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | |||
1567 | offset += i_size_read(inode); | 1567 | offset += i_size_read(inode); |
1568 | break; | 1568 | break; |
1569 | case SEEK_CUR: | 1569 | case SEEK_CUR: |
1570 | if (offset == 0) { | ||
1571 | retval = file->f_pos; | ||
1572 | goto exit; | ||
1573 | } | ||
1570 | offset += file->f_pos; | 1574 | offset += file->f_pos; |
1571 | break; | 1575 | break; |
1572 | case SEEK_DATA: | 1576 | case SEEK_DATA: |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 3e6d72756479..aa83109b9431 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -1138,28 +1138,28 @@ static int __init fuse_fs_init(void) | |||
1138 | { | 1138 | { |
1139 | int err; | 1139 | int err; |
1140 | 1140 | ||
1141 | err = register_filesystem(&fuse_fs_type); | ||
1142 | if (err) | ||
1143 | goto out; | ||
1144 | |||
1145 | err = register_fuseblk(); | ||
1146 | if (err) | ||
1147 | goto out_unreg; | ||
1148 | |||
1149 | fuse_inode_cachep = kmem_cache_create("fuse_inode", | 1141 | fuse_inode_cachep = kmem_cache_create("fuse_inode", |
1150 | sizeof(struct fuse_inode), | 1142 | sizeof(struct fuse_inode), |
1151 | 0, SLAB_HWCACHE_ALIGN, | 1143 | 0, SLAB_HWCACHE_ALIGN, |
1152 | fuse_inode_init_once); | 1144 | fuse_inode_init_once); |
1153 | err = -ENOMEM; | 1145 | err = -ENOMEM; |
1154 | if (!fuse_inode_cachep) | 1146 | if (!fuse_inode_cachep) |
1155 | goto out_unreg2; | 1147 | goto out; |
1148 | |||
1149 | err = register_fuseblk(); | ||
1150 | if (err) | ||
1151 | goto out2; | ||
1152 | |||
1153 | err = register_filesystem(&fuse_fs_type); | ||
1154 | if (err) | ||
1155 | goto out3; | ||
1156 | 1156 | ||
1157 | return 0; | 1157 | return 0; |
1158 | 1158 | ||
1159 | out_unreg2: | 1159 | out3: |
1160 | unregister_fuseblk(); | 1160 | unregister_fuseblk(); |
1161 | out_unreg: | 1161 | out2: |
1162 | unregister_filesystem(&fuse_fs_type); | 1162 | kmem_cache_destroy(fuse_inode_cachep); |
1163 | out: | 1163 | out: |
1164 | return err; | 1164 | return err; |
1165 | } | 1165 | } |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 5b5fa33b6b9d..cbd1a61c110a 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -548,7 +548,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
548 | 548 | ||
549 | error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); | 549 | error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); |
550 | if (error) | 550 | if (error) |
551 | goto out_bdi; | 551 | goto out_fput; |
552 | 552 | ||
553 | server->ncp_filp = ncp_filp; | 553 | server->ncp_filp = ncp_filp; |
554 | server->ncp_sock = sock; | 554 | server->ncp_sock = sock; |
@@ -559,7 +559,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
559 | error = -EBADF; | 559 | error = -EBADF; |
560 | server->info_filp = fget(data.info_fd); | 560 | server->info_filp = fget(data.info_fd); |
561 | if (!server->info_filp) | 561 | if (!server->info_filp) |
562 | goto out_fput; | 562 | goto out_bdi; |
563 | error = -ENOTSOCK; | 563 | error = -ENOTSOCK; |
564 | sock_inode = server->info_filp->f_path.dentry->d_inode; | 564 | sock_inode = server->info_filp->f_path.dentry->d_inode; |
565 | if (!S_ISSOCK(sock_inode->i_mode)) | 565 | if (!S_ISSOCK(sock_inode->i_mode)) |
@@ -746,9 +746,9 @@ out_nls: | |||
746 | out_fput2: | 746 | out_fput2: |
747 | if (server->info_filp) | 747 | if (server->info_filp) |
748 | fput(server->info_filp); | 748 | fput(server->info_filp); |
749 | out_fput: | ||
750 | bdi_destroy(&server->bdi); | ||
751 | out_bdi: | 749 | out_bdi: |
750 | bdi_destroy(&server->bdi); | ||
751 | out_fput: | ||
752 | /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: | 752 | /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: |
753 | * | 753 | * |
754 | * The previously used put_filp(ncp_filp); was bogus, since | 754 | * The previously used put_filp(ncp_filp); was bogus, since |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 9a8a2b77b874..03102d978180 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = { | |||
91 | 91 | ||
92 | void __init proc_root_init(void) | 92 | void __init proc_root_init(void) |
93 | { | 93 | { |
94 | struct vfsmount *mnt; | ||
95 | int err; | 94 | int err; |
96 | 95 | ||
97 | proc_init_inodecache(); | 96 | proc_init_inodecache(); |
98 | err = register_filesystem(&proc_fs_type); | 97 | err = register_filesystem(&proc_fs_type); |
99 | if (err) | 98 | if (err) |
100 | return; | 99 | return; |
101 | mnt = kern_mount_data(&proc_fs_type, &init_pid_ns); | 100 | err = pid_ns_prepare_proc(&init_pid_ns); |
102 | if (IS_ERR(mnt)) { | 101 | if (err) { |
103 | unregister_filesystem(&proc_fs_type); | 102 | unregister_filesystem(&proc_fs_type); |
104 | return; | 103 | return; |
105 | } | 104 | } |
106 | 105 | ||
107 | init_pid_ns.proc_mnt = mnt; | ||
108 | proc_symlink("mounts", NULL, "self/mounts"); | 106 | proc_symlink("mounts", NULL, "self/mounts"); |
109 | 107 | ||
110 | proc_net_init(); | 108 | proc_net_init(); |
@@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns) | |||
209 | 207 | ||
210 | void pid_ns_release_proc(struct pid_namespace *ns) | 208 | void pid_ns_release_proc(struct pid_namespace *ns) |
211 | { | 209 | { |
212 | mntput(ns->proc_mnt); | 210 | kern_unmount(ns->proc_mnt); |
213 | } | 211 | } |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 20403dc5d437..ae0e76bb6ebf 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -2264,19 +2264,12 @@ static int __init ubifs_init(void) | |||
2264 | return -EINVAL; | 2264 | return -EINVAL; |
2265 | } | 2265 | } |
2266 | 2266 | ||
2267 | err = register_filesystem(&ubifs_fs_type); | ||
2268 | if (err) { | ||
2269 | ubifs_err("cannot register file system, error %d", err); | ||
2270 | return err; | ||
2271 | } | ||
2272 | |||
2273 | err = -ENOMEM; | ||
2274 | ubifs_inode_slab = kmem_cache_create("ubifs_inode_slab", | 2267 | ubifs_inode_slab = kmem_cache_create("ubifs_inode_slab", |
2275 | sizeof(struct ubifs_inode), 0, | 2268 | sizeof(struct ubifs_inode), 0, |
2276 | SLAB_MEM_SPREAD | SLAB_RECLAIM_ACCOUNT, | 2269 | SLAB_MEM_SPREAD | SLAB_RECLAIM_ACCOUNT, |
2277 | &inode_slab_ctor); | 2270 | &inode_slab_ctor); |
2278 | if (!ubifs_inode_slab) | 2271 | if (!ubifs_inode_slab) |
2279 | goto out_reg; | 2272 | return -ENOMEM; |
2280 | 2273 | ||
2281 | register_shrinker(&ubifs_shrinker_info); | 2274 | register_shrinker(&ubifs_shrinker_info); |
2282 | 2275 | ||
@@ -2288,15 +2281,20 @@ static int __init ubifs_init(void) | |||
2288 | if (err) | 2281 | if (err) |
2289 | goto out_compr; | 2282 | goto out_compr; |
2290 | 2283 | ||
2284 | err = register_filesystem(&ubifs_fs_type); | ||
2285 | if (err) { | ||
2286 | ubifs_err("cannot register file system, error %d", err); | ||
2287 | goto out_dbg; | ||
2288 | } | ||
2291 | return 0; | 2289 | return 0; |
2292 | 2290 | ||
2291 | out_dbg: | ||
2292 | dbg_debugfs_exit(); | ||
2293 | out_compr: | 2293 | out_compr: |
2294 | ubifs_compressors_exit(); | 2294 | ubifs_compressors_exit(); |
2295 | out_shrinker: | 2295 | out_shrinker: |
2296 | unregister_shrinker(&ubifs_shrinker_info); | 2296 | unregister_shrinker(&ubifs_shrinker_info); |
2297 | kmem_cache_destroy(ubifs_inode_slab); | 2297 | kmem_cache_destroy(ubifs_inode_slab); |
2298 | out_reg: | ||
2299 | unregister_filesystem(&ubifs_fs_type); | ||
2300 | return err; | 2298 | return err; |
2301 | } | 2299 | } |
2302 | /* late_initcall to let compressors initialize first */ | 2300 | /* late_initcall to let compressors initialize first */ |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 4e4fbb820e20..14b6cd022284 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -182,8 +182,11 @@ | |||
182 | {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 182 | {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
183 | {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 183 | {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
184 | {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 184 | {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
185 | {0x1002, 0x6751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
185 | {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 186 | {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
186 | {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 187 | {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
188 | {0x1002, 0x675B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
189 | {0x1002, 0x675D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
187 | {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 190 | {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
188 | {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 191 | {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
189 | {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 192 | {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
@@ -195,8 +198,10 @@ | |||
195 | {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 198 | {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
196 | {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 199 | {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 200 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
201 | {0x1002, 0x6772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 202 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 203 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
204 | {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
200 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 205 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
201 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 206 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
202 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 207 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
@@ -246,6 +251,7 @@ | |||
246 | {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 251 | {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
247 | {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 252 | {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
248 | {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 253 | {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
254 | {0x1002, 0x68fa, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
249 | {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 255 | {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
250 | {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ | 256 | {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ |
251 | {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 257 | {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
@@ -488,6 +494,8 @@ | |||
488 | {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 494 | {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
489 | {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 495 | {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
490 | {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 496 | {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
497 | {0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
498 | {0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
491 | {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 499 | {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
492 | {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 500 | {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
493 | {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 501 | {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
@@ -502,6 +510,8 @@ | |||
502 | {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 510 | {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
503 | {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 511 | {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
504 | {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 512 | {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
513 | {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
514 | {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
505 | {0, 0, 0} | 515 | {0, 0, 0} |
506 | 516 | ||
507 | #define r128_PCI_IDS \ | 517 | #define r128_PCI_IDS \ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c7a6d3b5bc7b..94acd8172b5b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -805,9 +805,6 @@ extern void blk_unprep_request(struct request *); | |||
805 | */ | 805 | */ |
806 | extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, | 806 | extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, |
807 | spinlock_t *lock, int node_id); | 807 | spinlock_t *lock, int node_id); |
808 | extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *, | ||
809 | request_fn_proc *, | ||
810 | spinlock_t *, int node_id); | ||
811 | extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); | 808 | extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); |
812 | extern struct request_queue *blk_init_allocated_queue(struct request_queue *, | 809 | extern struct request_queue *blk_init_allocated_queue(struct request_queue *, |
813 | request_fn_proc *, spinlock_t *); | 810 | request_fn_proc *, spinlock_t *); |
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index ef90cbd8e173..57c9a8ae4f2d 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h | |||
@@ -31,6 +31,7 @@ extern void free_dmar_iommu(struct intel_iommu *iommu); | |||
31 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); | 31 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); |
32 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); | 32 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); |
33 | extern int dmar_disabled; | 33 | extern int dmar_disabled; |
34 | extern int intel_iommu_enabled; | ||
34 | #else | 35 | #else |
35 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) | 36 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) |
36 | { | 37 | { |
@@ -44,6 +45,7 @@ static inline void free_dmar_iommu(struct intel_iommu *iommu) | |||
44 | { | 45 | { |
45 | } | 46 | } |
46 | #define dmar_disabled (1) | 47 | #define dmar_disabled (1) |
48 | #define intel_iommu_enabled (0) | ||
47 | #endif | 49 | #endif |
48 | 50 | ||
49 | 51 | ||
diff --git a/include/linux/log2.h b/include/linux/log2.h index 25b808631cd9..fd7ff3d91e6a 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h | |||
@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n) | |||
185 | #define rounddown_pow_of_two(n) \ | 185 | #define rounddown_pow_of_two(n) \ |
186 | ( \ | 186 | ( \ |
187 | __builtin_constant_p(n) ? ( \ | 187 | __builtin_constant_p(n) ? ( \ |
188 | (n == 1) ? 0 : \ | ||
189 | (1UL << ilog2(n))) : \ | 188 | (1UL << ilog2(n))) : \ |
190 | __rounddown_pow_of_two(n) \ | 189 | __rounddown_pow_of_two(n) \ |
191 | ) | 190 | ) |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 415f2db414e1..c8ef9bc54d50 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -218,6 +218,7 @@ struct mmc_card { | |||
218 | #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ | 218 | #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ |
219 | #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ | 219 | #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ |
220 | #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ | 220 | #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ |
221 | #define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */ | ||
221 | /* byte mode */ | 222 | /* byte mode */ |
222 | unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ | 223 | unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ |
223 | #define MMC_NO_POWER_NOTIFICATION 0 | 224 | #define MMC_NO_POWER_NOTIFICATION 0 |
@@ -433,6 +434,11 @@ static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c) | |||
433 | return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; | 434 | return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; |
434 | } | 435 | } |
435 | 436 | ||
437 | static inline int mmc_card_long_read_time(const struct mmc_card *c) | ||
438 | { | ||
439 | return c->quirks & MMC_QUIRK_LONG_READ_TIME; | ||
440 | } | ||
441 | |||
436 | #define mmc_card_name(c) ((c)->cid.prod_name) | 442 | #define mmc_card_name(c) ((c)->cid.prod_name) |
437 | #define mmc_card_id(c) (dev_name(&(c)->dev)) | 443 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
438 | 444 | ||
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 2e0ecfcc881d..5b4293d9819d 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -1269,7 +1269,7 @@ void mq_clear_sbinfo(struct ipc_namespace *ns) | |||
1269 | 1269 | ||
1270 | void mq_put_mnt(struct ipc_namespace *ns) | 1270 | void mq_put_mnt(struct ipc_namespace *ns) |
1271 | { | 1271 | { |
1272 | mntput(ns->mq_mnt); | 1272 | kern_unmount(ns->mq_mnt); |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | static int __init init_mqueue_fs(void) | 1275 | static int __init init_mqueue_fs(void) |
@@ -1291,11 +1291,9 @@ static int __init init_mqueue_fs(void) | |||
1291 | 1291 | ||
1292 | spin_lock_init(&mq_lock); | 1292 | spin_lock_init(&mq_lock); |
1293 | 1293 | ||
1294 | init_ipc_ns.mq_mnt = kern_mount_data(&mqueue_fs_type, &init_ipc_ns); | 1294 | error = mq_init_ns(&init_ipc_ns); |
1295 | if (IS_ERR(init_ipc_ns.mq_mnt)) { | 1295 | if (error) |
1296 | error = PTR_ERR(init_ipc_ns.mq_mnt); | ||
1297 | goto out_filesystem; | 1296 | goto out_filesystem; |
1298 | } | ||
1299 | 1297 | ||
1300 | return 0; | 1298 | return 0; |
1301 | 1299 | ||
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index 8b5ce5d3f3ef..5652101cdac0 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
@@ -27,11 +27,6 @@ DEFINE_SPINLOCK(mq_lock); | |||
27 | */ | 27 | */ |
28 | struct ipc_namespace init_ipc_ns = { | 28 | struct ipc_namespace init_ipc_ns = { |
29 | .count = ATOMIC_INIT(1), | 29 | .count = ATOMIC_INIT(1), |
30 | #ifdef CONFIG_POSIX_MQUEUE | ||
31 | .mq_queues_max = DFLT_QUEUESMAX, | ||
32 | .mq_msg_max = DFLT_MSGMAX, | ||
33 | .mq_msgsize_max = DFLT_MSGSIZEMAX, | ||
34 | #endif | ||
35 | .user_ns = &init_user_ns, | 30 | .user_ns = &init_user_ns, |
36 | }; | 31 | }; |
37 | 32 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index c0018f2d50e0..c106d3b3cc64 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2407,7 +2407,6 @@ static ssize_t generic_perform_write(struct file *file, | |||
2407 | iov_iter_count(i)); | 2407 | iov_iter_count(i)); |
2408 | 2408 | ||
2409 | again: | 2409 | again: |
2410 | |||
2411 | /* | 2410 | /* |
2412 | * Bring in the user page that we will copy from _first_. | 2411 | * Bring in the user page that we will copy from _first_. |
2413 | * Otherwise there's a nasty deadlock on copying from the | 2412 | * Otherwise there's a nasty deadlock on copying from the |
@@ -2463,7 +2462,10 @@ again: | |||
2463 | written += copied; | 2462 | written += copied; |
2464 | 2463 | ||
2465 | balance_dirty_pages_ratelimited(mapping); | 2464 | balance_dirty_pages_ratelimited(mapping); |
2466 | 2465 | if (fatal_signal_pending(current)) { | |
2466 | status = -EINTR; | ||
2467 | break; | ||
2468 | } | ||
2467 | } while (iov_iter_count(i)); | 2469 | } while (iov_iter_count(i)); |
2468 | 2470 | ||
2469 | return written ? written : status; | 2471 | return written ? written : status; |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 71252486bc6f..50f08241f981 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -411,8 +411,13 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty) | |||
411 | * | 411 | * |
412 | * Returns @bdi's dirty limit in pages. The term "dirty" in the context of | 412 | * Returns @bdi's dirty limit in pages. The term "dirty" in the context of |
413 | * dirty balancing includes all PG_dirty, PG_writeback and NFS unstable pages. | 413 | * dirty balancing includes all PG_dirty, PG_writeback and NFS unstable pages. |
414 | * And the "limit" in the name is not seriously taken as hard limit in | 414 | * |
415 | * balance_dirty_pages(). | 415 | * Note that balance_dirty_pages() will only seriously take it as a hard limit |
416 | * when sleeping max_pause per page is not enough to keep the dirty pages under | ||
417 | * control. For example, when the device is completely stalled due to some error | ||
418 | * conditions, or when there are 1000 dd tasks writing to a slow 10MB/s USB key. | ||
419 | * In the other normal situations, it acts more gently by throttling the tasks | ||
420 | * more (rather than completely block them) when the bdi dirty pages go high. | ||
416 | * | 421 | * |
417 | * It allocates high/low dirty limits to fast/slow devices, in order to prevent | 422 | * It allocates high/low dirty limits to fast/slow devices, in order to prevent |
418 | * - starving fast devices | 423 | * - starving fast devices |
@@ -594,6 +599,13 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi, | |||
594 | */ | 599 | */ |
595 | if (unlikely(bdi_thresh > thresh)) | 600 | if (unlikely(bdi_thresh > thresh)) |
596 | bdi_thresh = thresh; | 601 | bdi_thresh = thresh; |
602 | /* | ||
603 | * It's very possible that bdi_thresh is close to 0 not because the | ||
604 | * device is slow, but that it has remained inactive for long time. | ||
605 | * Honour such devices a reasonable good (hopefully IO efficient) | ||
606 | * threshold, so that the occasional writes won't be blocked and active | ||
607 | * writes can rampup the threshold quickly. | ||
608 | */ | ||
597 | bdi_thresh = max(bdi_thresh, (limit - dirty) / 8); | 609 | bdi_thresh = max(bdi_thresh, (limit - dirty) / 8); |
598 | /* | 610 | /* |
599 | * scale global setpoint to bdi's: | 611 | * scale global setpoint to bdi's: |
@@ -977,8 +989,7 @@ static unsigned long bdi_max_pause(struct backing_dev_info *bdi, | |||
977 | * | 989 | * |
978 | * 8 serves as the safety ratio. | 990 | * 8 serves as the safety ratio. |
979 | */ | 991 | */ |
980 | if (bdi_dirty) | 992 | t = min(t, bdi_dirty * HZ / (8 * bw + 1)); |
981 | t = min(t, bdi_dirty * HZ / (8 * bw + 1)); | ||
982 | 993 | ||
983 | /* | 994 | /* |
984 | * The pause time will be settled within range (max_pause/4, max_pause). | 995 | * The pause time will be settled within range (max_pause/4, max_pause). |
@@ -1136,6 +1147,19 @@ pause: | |||
1136 | if (task_ratelimit) | 1147 | if (task_ratelimit) |
1137 | break; | 1148 | break; |
1138 | 1149 | ||
1150 | /* | ||
1151 | * In the case of an unresponding NFS server and the NFS dirty | ||
1152 | * pages exceeds dirty_thresh, give the other good bdi's a pipe | ||
1153 | * to go through, so that tasks on them still remain responsive. | ||
1154 | * | ||
1155 | * In theory 1 page is enough to keep the comsumer-producer | ||
1156 | * pipe going: the flusher cleans 1 page => the task dirties 1 | ||
1157 | * more page. However bdi_dirty has accounting errors. So use | ||
1158 | * the larger and more IO friendly bdi_stat_error. | ||
1159 | */ | ||
1160 | if (bdi_dirty <= bdi_stat_error(bdi)) | ||
1161 | break; | ||
1162 | |||
1139 | if (fatal_signal_pending(current)) | 1163 | if (fatal_signal_pending(current)) |
1140 | break; | 1164 | break; |
1141 | } | 1165 | } |
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 42599e31dcad..3a94eae7abe9 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c | |||
@@ -477,7 +477,6 @@ int crush_do_rule(struct crush_map *map, | |||
477 | int i, j; | 477 | int i, j; |
478 | int numrep; | 478 | int numrep; |
479 | int firstn; | 479 | int firstn; |
480 | int rc = -1; | ||
481 | 480 | ||
482 | BUG_ON(ruleno >= map->max_rules); | 481 | BUG_ON(ruleno >= map->max_rules); |
483 | 482 | ||
@@ -491,23 +490,18 @@ int crush_do_rule(struct crush_map *map, | |||
491 | * that this may or may not correspond to the specific types | 490 | * that this may or may not correspond to the specific types |
492 | * referenced by the crush rule. | 491 | * referenced by the crush rule. |
493 | */ | 492 | */ |
494 | if (force >= 0) { | 493 | if (force >= 0 && |
495 | if (force >= map->max_devices || | 494 | force < map->max_devices && |
496 | map->device_parents[force] == 0) { | 495 | map->device_parents[force] != 0 && |
497 | /*dprintk("CRUSH: forcefed device dne\n");*/ | 496 | !is_out(map, weight, force, x)) { |
498 | rc = -1; /* force fed device dne */ | 497 | while (1) { |
499 | goto out; | 498 | force_context[++force_pos] = force; |
500 | } | 499 | if (force >= 0) |
501 | if (!is_out(map, weight, force, x)) { | 500 | force = map->device_parents[force]; |
502 | while (1) { | 501 | else |
503 | force_context[++force_pos] = force; | 502 | force = map->bucket_parents[-1-force]; |
504 | if (force >= 0) | 503 | if (force == 0) |
505 | force = map->device_parents[force]; | 504 | break; |
506 | else | ||
507 | force = map->bucket_parents[-1-force]; | ||
508 | if (force == 0) | ||
509 | break; | ||
510 | } | ||
511 | } | 505 | } |
512 | } | 506 | } |
513 | 507 | ||
@@ -600,10 +594,7 @@ int crush_do_rule(struct crush_map *map, | |||
600 | BUG_ON(1); | 594 | BUG_ON(1); |
601 | } | 595 | } |
602 | } | 596 | } |
603 | rc = result_len; | 597 | return result_len; |
604 | |||
605 | out: | ||
606 | return rc; | ||
607 | } | 598 | } |
608 | 599 | ||
609 | 600 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 7d98240def0b..c2f79e63124d 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2507,6 +2507,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
2507 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2507 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
2510 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS 1101HA", POS_FIX_LPIB), | ||
2510 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2511 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
2511 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), | 2512 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), |
2512 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), | 2513 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), |
@@ -2970,7 +2971,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
2970 | /* SCH */ | 2971 | /* SCH */ |
2971 | { PCI_DEVICE(0x8086, 0x811b), | 2972 | { PCI_DEVICE(0x8086, 0x811b), |
2972 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | 2973 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | |
2973 | AZX_DCAPS_BUFSIZE}, | 2974 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ |
2975 | /* ICH */ | ||
2974 | { PCI_DEVICE(0x8086, 0x2668), | 2976 | { PCI_DEVICE(0x8086, 0x2668), |
2975 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | | 2977 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
2976 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ | 2978 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index eeb25d529e30..616678fde486 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4929,6 +4929,12 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
4929 | set_hp_led_gpio(codec); | 4929 | set_hp_led_gpio(codec); |
4930 | return 1; | 4930 | return 1; |
4931 | } | 4931 | } |
4932 | /* BIOS bug: unfilled OEM string */ | ||
4933 | if (strstr(dev->name, "HP_Mute_LED_P_G")) { | ||
4934 | set_hp_led_gpio(codec); | ||
4935 | spec->gpio_led_polarity = 1; | ||
4936 | return 1; | ||
4937 | } | ||
4932 | } | 4938 | } |
4933 | 4939 | ||
4934 | /* | 4940 | /* |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 4584514d93d4..fa787d45d74a 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -33,7 +33,7 @@ config SND_SOC_ALL_CODECS | |||
33 | select SND_SOC_CX20442 | 33 | select SND_SOC_CX20442 |
34 | select SND_SOC_DA7210 if I2C | 34 | select SND_SOC_DA7210 if I2C |
35 | select SND_SOC_DFBMCS320 | 35 | select SND_SOC_DFBMCS320 |
36 | select SND_SOC_JZ4740_CODEC if SOC_JZ4740 | 36 | select SND_SOC_JZ4740_CODEC |
37 | select SND_SOC_LM4857 if I2C | 37 | select SND_SOC_LM4857 if I2C |
38 | select SND_SOC_MAX98088 if I2C | 38 | select SND_SOC_MAX98088 if I2C |
39 | select SND_SOC_MAX98095 if I2C | 39 | select SND_SOC_MAX98095 if I2C |
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index e373f8f06907..3e1f4e172bfb 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/io.h> | ||
18 | 19 | ||
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
20 | 21 | ||
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index 0293763debe5..5a14d5c0e0e1 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -60,6 +60,8 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name, | |||
60 | } | 60 | } |
61 | 61 | ||
62 | if (memcmp(fw->data, "WMFW", 4) != 0) { | 62 | if (memcmp(fw->data, "WMFW", 4) != 0) { |
63 | memcpy(&data32, fw->data, sizeof(data32)); | ||
64 | data32 = be32_to_cpu(data32); | ||
63 | dev_err(codec->dev, "%s: firmware has bad file magic %08x\n", | 65 | dev_err(codec->dev, "%s: firmware has bad file magic %08x\n", |
64 | name, data32); | 66 | name, data32); |
65 | goto err; | 67 | goto err; |
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 645c980d6b80..a33b04d17195 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -1968,6 +1968,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai, | |||
1968 | break; | 1968 | break; |
1969 | case 24576000: | 1969 | case 24576000: |
1970 | ratediv = WM8996_SYSCLK_DIV; | 1970 | ratediv = WM8996_SYSCLK_DIV; |
1971 | wm8996->sysclk /= 2; | ||
1971 | case 12288000: | 1972 | case 12288000: |
1972 | snd_soc_update_bits(codec, WM8996_AIF_RATE, | 1973 | snd_soc_update_bits(codec, WM8996_AIF_RATE, |
1973 | WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE); | 1974 | WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE); |
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index dea5aa4aa647..f39d7dd9fbcb 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c | |||
@@ -357,3 +357,6 @@ static void __exit snd_mxs_pcm_exit(void) | |||
357 | platform_driver_unregister(&mxs_pcm_driver); | 357 | platform_driver_unregister(&mxs_pcm_driver); |
358 | } | 358 | } |
359 | module_exit(snd_mxs_pcm_exit); | 359 | module_exit(snd_mxs_pcm_exit); |
360 | |||
361 | MODULE_LICENSE("GPL"); | ||
362 | MODULE_ALIAS("platform:mxs-pcm-audio"); | ||
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index 7fbeaec06eb4..1c57f6630a48 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c | |||
@@ -171,3 +171,4 @@ module_exit(mxs_sgtl5000_exit); | |||
171 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | 171 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); |
172 | MODULE_DESCRIPTION("MXS ALSA SoC Machine driver"); | 172 | MODULE_DESCRIPTION("MXS ALSA SoC Machine driver"); |
173 | MODULE_LICENSE("GPL"); | 173 | MODULE_LICENSE("GPL"); |
174 | MODULE_ALIAS("platform:mxs-sgtl5000"); | ||
diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c index 65c124831a00..c664e33fb6d7 100644 --- a/sound/soc/pxa/hx4700.c +++ b/sound/soc/pxa/hx4700.c | |||
@@ -209,9 +209,10 @@ static int __devinit hx4700_audio_probe(struct platform_device *pdev) | |||
209 | snd_soc_card_hx4700.dev = &pdev->dev; | 209 | snd_soc_card_hx4700.dev = &pdev->dev; |
210 | ret = snd_soc_register_card(&snd_soc_card_hx4700); | 210 | ret = snd_soc_register_card(&snd_soc_card_hx4700); |
211 | if (ret) | 211 | if (ret) |
212 | return ret; | 212 | gpio_free_array(hx4700_audio_gpios, |
213 | ARRAY_SIZE(hx4700_audio_gpios)); | ||
213 | 214 | ||
214 | return 0; | 215 | return ret; |
215 | } | 216 | } |
216 | 217 | ||
217 | static int __devexit hx4700_audio_remove(struct platform_device *pdev) | 218 | static int __devexit hx4700_audio_remove(struct platform_device *pdev) |
diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c index 1826acf20f7c..8e523fd9189e 100644 --- a/sound/soc/samsung/jive_wm8750.c +++ b/sound/soc/samsung/jive_wm8750.c | |||
@@ -101,7 +101,6 @@ static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd) | |||
101 | { | 101 | { |
102 | struct snd_soc_codec *codec = rtd->codec; | 102 | struct snd_soc_codec *codec = rtd->codec; |
103 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 103 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
104 | int err; | ||
105 | 104 | ||
106 | /* These endpoints are not being used. */ | 105 | /* These endpoints are not being used. */ |
107 | snd_soc_dapm_nc_pin(dapm, "LINPUT2"); | 106 | snd_soc_dapm_nc_pin(dapm, "LINPUT2"); |
@@ -131,7 +130,7 @@ static struct snd_soc_card snd_soc_machine_jive = { | |||
131 | .dai_link = &jive_dai, | 130 | .dai_link = &jive_dai, |
132 | .num_links = 1, | 131 | .num_links = 1, |
133 | 132 | ||
134 | .dapm_widgtets = wm8750_dapm_widgets, | 133 | .dapm_widgets = wm8750_dapm_widgets, |
135 | .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), | 134 | .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), |
136 | .dapm_routes = audio_map, | 135 | .dapm_routes = audio_map, |
137 | .num_dapm_routes = ARRAY_SIZE(audio_map), | 136 | .num_dapm_routes = ARRAY_SIZE(audio_map), |
diff --git a/sound/soc/samsung/smdk2443_wm9710.c b/sound/soc/samsung/smdk2443_wm9710.c index 3a0dbfc793f0..8bd1dc5706bf 100644 --- a/sound/soc/samsung/smdk2443_wm9710.c +++ b/sound/soc/samsung/smdk2443_wm9710.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | ||
15 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
16 | 17 | ||
17 | static struct snd_soc_card smdk2443; | 18 | static struct snd_soc_card smdk2443; |